- Joined
- Aug 17, 2013
- Messages
- 30
- Reaction score
- 1
- First Language
- English
So I'm using MOGhunter's battle scripts because they're beautiful, and function nicely. However, one of my most favored functions of an RPG is not replicated properly through these scripts, the Active Time Battle.
Granted, this may be because I can't even fully understand the 'translated' version of the AT Script, or that it just can't do what I want it to.
They have it set up so that it runs off the character's Agility, which in some cases, may be nice, but it's not quite what I'm looking for.
I'm looking for something more along the lines of the middle-era of Final Fantasy. (VII, VIII, IX, CT)
No matter what, the AT Bar should fill at a steady rate for all characters, and their Agility should, at the very least, affect where the bar starts from at the beginning of battle, rather than how quickly it fills. The latter makes battles at low levels excruciatingly long, and gives the enemies no turns at higher levels. (Even with an Enemy Levels script.)
As well, it would be nice if a 'Turn' was measured by everyone acting (like it should), rather than a set time frame.
I may just be missing something on the script itself, but it's hard to read.
Granted, this may be because I can't even fully understand the 'translated' version of the AT Script, or that it just can't do what I want it to.
They have it set up so that it runs off the character's Agility, which in some cases, may be nice, but it's not quite what I'm looking for.
I'm looking for something more along the lines of the middle-era of Final Fantasy. (VII, VIII, IX, CT)
No matter what, the AT Bar should fill at a steady rate for all characters, and their Agility should, at the very least, affect where the bar starts from at the beginning of battle, rather than how quickly it fills. The latter makes battles at low levels excruciatingly long, and gives the enemies no turns at higher levels. (Even with an Enemy Levels script.)
As well, it would be nice if a 'Turn' was measured by everyone acting (like it should), rather than a set time frame.
I may just be missing something on the script itself, but it's hard to read.
Code:
#==============================================================================# +++ MOG - AT System (v0.7 Beta) +++#==============================================================================# By Moghunter # [URL="http://www.atelier-rgss.com/#==============================================================================%23"]http://www.atelier-rgss.com/#==============================================================================#[/URL] Sistema de batalha de turnos em tempo real.#==============================================================================#==============================================================================# +++ MOG - AT System (v0.7 Beta) +++#==============================================================================# By Moghunter# [URL="http://www.atelier-rgss.com/#==============================================================================%23"]http://www.atelier-rgss.com/#==============================================================================#[/URL] Battle System that shifts in real time.#==============================================================================#==============================================================================# ● History (Version History)#==============================================================================# V 0.7 - the improvement in performance.# V 0.6 - corrected the bug of actions forced consecutively.# - Corrected the bug count of shifts of the conditions. (Stop / Sleep)# - corrected the bug to reset the TAA when the battler receives any# type of status which does not have the effect Stop / Sleep.# V 0.5 - corrected the bug count of shifts in the conditions. (States)# v 0.4 - corrected the bug of crash reaon. (Concerning the can chose from image.)# - corrected the bug of crash reaon. (Concerning the turn.)# - corrected the bug of lock screen in the implementation of the message of battle.# V 0.3 - corrected the Bug of command window to tighten the Cancel key.# - Corrected the Bug does not show the status window in the beginning.# - Best coding to increase compatibility.# - Option to define the position of the meter of TAA by X&Y of battler.# V 0.2 - corrected the bug of the selection of target for shares of cast time.# V 0.1 - First release.#==============================================================================#==============================================================================# ● Images Required#==============================================================================# You need the following images:## Battle_AT_Layout.png# Battle_AT_Meter.png## In the folder: GRAPHICS/SYSTEM/##==============================================================================# ● AT SYSTEM#==============================================================================# The speed of TA is based on the agility of Battler.# In case of preventive battles (pre-emptive strikes) the Allies begin with TA# at 80% and the enemies will begin with up to 0 (zero)# In battle surprises (Surprise) are the opposite of preventive battles.# In normal battles all battlers will begin with up to 40 %.#==============================================================================# ● CAST TIME#==============================================================================# To define a skill or item with the function of Cast Time simply set# the value of speed (Speed) different from 0 (Zero).## NOTE - It is not possible to activate 2 or more abilities with the function# Cast Time on the same turn. (If you are using characteristics of Multi Action# in your project.)#==============================================================================module MOG_AT_SYSTEM # Positioning Type Hud. # 0 - Fixed position. # 1 - Position based on value X and Y of the battler. HUD_POSITION_TYPE = 0 #General Position (Initial) of Hud. HUD_POSITION = [25,400] #Position of the TA meter AT_METER_POSITION = [29,1] #Define the position of the space between the HUD and group members. # #MEMBERS_SPACE = [Horizontal ,Vertical] # MEMBERS_SPACE = [136,0] #Speed of animation of the TA meter, set 0 if you do not want to the animation. AT_METER_FLOW_SPEED = 3 #Priority of the Hud. BATTLE_HUD_Z = 0 #Sound when the system is at maximum SE_ACTIVE = "Decision2" #Define the value of TA to activate the action. (Gauge Meter). AT_GAUGE_METER = 10000 # Definition of the type of duration (Count/formula) for a turn. # This definition influence in the activation of the events of battle. # (BATTLE EVENTS) # # 0 - duration of a shift and a fixed value. # 1 - the duration of a shift and multiplied by the quantity of batllers. # 2 - duration of a shift and based on the mean of agility the battlers. # TURN_DURATION_TYPE = 0 # Definition of value used to calculate the duration of a shift. TURN_DURATION = 60 # Definition of animation when the battler uses skills from loading. CAST_ANIMATION = 49 # Enable the window of the LOG, leave it disabled if you wish a battle more # dynamic. WAIT_LOG_WINDOW = false # Enable the initial message with the names of the enemies. MESSAGE_ENEMY_APPEAR = false# Definition of the position of the message window.# 0 - Top# 1 - Center# 2 - Lower MESSAGE_POSITION = 2end#==============================================================================# ■ Game_System#==============================================================================class Game_System attr_accessor :at_max #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize @at_max = [[MOG_AT_SYSTEM::AT_GAUGE_METER, 999999].min, 100].max mog_at_system_initialize end end#==============================================================================# ■ BattleManager#==============================================================================module BattleManager #-------------------------------------------------------------------------- # ● Battle Start #-------------------------------------------------------------------------- def self.battle_start $game_system.battle_count += 1 $game_party.on_battle_start $game_troop.on_battle_start if MOG_AT_SYSTEM::MESSAGE_ENEMY_APPEAR $game_troop.enemy_names.each do |name| $game_message.add(sprintf(Vocab::Emerge, name)) end end if @preemptive $game_message.add(sprintf(Vocab::Preemptive, $game_party.name)) elsif @surprise $game_message.add(sprintf(Vocab::Surprise, $game_party.name)) end wait_for_message end #-------------------------------------------------------------------------- # ● Input Start #-------------------------------------------------------------------------- def self.input_start_at(battler) if @phase != :input @phase = :input battler.make_actions clear_actor end return !@surprise && battler.inputable? end #-------------------------------------------------------------------------- # ● Turn Start #-------------------------------------------------------------------------- def self.turn_start @phase = :turn clear_actor make_action_orders end #-------------------------------------------------------------------------- # ● Preemtive Attack #-------------------------------------------------------------------------- def self.preemptive_attack @preemptive end #-------------------------------------------------------------------------- # ● Suprise Attack #-------------------------------------------------------------------------- def self.surprise_attack @surprise end end #==============================================================================# ■ Game Action#==============================================================================class Game_Action #-------------------------------------------------------------------------- # ● Prepare #-------------------------------------------------------------------------- alias mog_at_system_prepare prepare def prepare mog_at_system_prepare set_cast_action end #-------------------------------------------------------------------------- # ● Set Cast Action #-------------------------------------------------------------------------- def set_cast_action return if forcing if @item.object != nil and @item.object.speed != 0 and @subject.at_cast.empty? @subject.at_cast = [@item.object,@item.object.speed.abs,@target_index] @item.object = nil @subject.animation_id = MOG_AT_SYSTEM::CAST_ANIMATION @subject.at = 0 BattleManager.turn_end if @subject.auto_battle? elsif !@subject.at_cast.empty? if @subject.at_cast[1] == 0 @item.object = @subject.at_cast[0] @target_index = @subject.at_cast[2] @subject.at_cast.clear else @item.object = nil end end end end#==============================================================================# ■ Game Battler Base#==============================================================================class Game_BattlerBase #-------------------------------------------------------------------------- # ● Inputable? #-------------------------------------------------------------------------- def inputable? normal? && !auto_battle? && self.at == $game_system.at_max end end#==============================================================================# ■ Game_Battler#==============================================================================class Game_Battler < Game_BattlerBase attr_accessor :at attr_accessor :at_cast attr_accessor :at_turn_duration #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize mog_at_system_initialize @at = 0 @at_cast = [] @at_cast_selectable = true @at_turn_duration = 0 end #-------------------------------------------------------------------------- # ● At #-------------------------------------------------------------------------- def at n = at_active? ? $game_system.at_max : 0 return [[@at, n].min, 0].max end #-------------------------------------------------------------------------- # ● At Active #-------------------------------------------------------------------------- def at_active? return false if restriction >= 4 return false if self.hp == 0 return true end #-------------------------------------------------------------------------- # ● Added New State #-------------------------------------------------------------------------- alias mog_at_system_add_new_state add_new_state def add_new_state(state_id) mog_at_system_add_new_state(state_id) if restriction >= 4 self.at_cast.clear self.at = 0 end end end#==============================================================================# ■ Game Enemy#==============================================================================class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● Tranform #-------------------------------------------------------------------------- alias mog_at_system_transform transform def transform(enemy_id) mog_at_system_transform(enemy_id) self.at = 0 self.at_cast.clear endend if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW#==============================================================================# ■ BattleManager#==============================================================================class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ● Refresh #-------------------------------------------------------------------------- def refresh end #-------------------------------------------------------------------------- # ● Message Speed #-------------------------------------------------------------------------- def message_speed return 5 endendend#==============================================================================# ■ Scene Battle#==============================================================================class Scene_Battle < Scene_Base include MOG_AT_SYSTEM #-------------------------------------------------------------------------- # ● AT Wait #-------------------------------------------------------------------------- alias mog_at_system_start start def start reset_at_parameter mog_at_system_start end #-------------------------------------------------------------------------- # ● Battle Start #-------------------------------------------------------------------------- def battle_start BattleManager.battle_start process_event set_turn_duration end #-------------------------------------------------------------------------- # ● Reset AT Parameter #-------------------------------------------------------------------------- def reset_at_parameter return if @at_phase != nil @at_phase = 0 n_at = $game_system.at_max * 40 / 100 p_at = $game_system.at_max * 90 / 100 s_at = 0 all_battle_members.each do |battler| if BattleManager.preemptive_attack battler.at = p_at if battler.is_a?(Game_Actor) battler.at = s_at if battler.is_a?(Game_Enemy) elsif BattleManager.surprise_attack battler.at = p_at if battler.is_a?(Game_Enemy) battler.at = s_at if battler.is_a?(Game_Actor) else battler.at = n_at end if battler.at >= $game_system.at_max battler.at = $game_system.at_max - 1 end battler.at = 0 if battler.at < 0 battler.at_cast.clear end end #-------------------------------------------------------------------------- # ● Set Turn Duration #-------------------------------------------------------------------------- def set_turn_duration max_battlers = all_battle_members.size > 0 ? all_battle_members.size : 1 case TURN_DURATION_TYPE when 1 n = TURN_DURATION * max_battlers when 2 turn_sp = 0 all_battle_members.each do |battler| turn_sp += battler.agi end n = TURN_DURATION + (turn_sp / max_battlers) else n = TURN_DURATION end turn_time_max = [[n, 9999].min, 120].max @turn_duration = [0, turn_time_max] if @status_window != nil @status_window.open end end #-------------------------------------------------------------------------- # ● Turn End #-------------------------------------------------------------------------- def turn_end @at_phase = 0 all_battle_members.each do |battler| if battler.at >= $game_system.at_max battler.at = 0 refresh_status @log_window.display_auto_affected_status(battler) @log_window.wait_and_clear end end BattleManager.turn_end end #-------------------------------------------------------------------------- # ● Update Turn Duration #-------------------------------------------------------------------------- def update_turn_duration return if @turn_duration == nil or @turn_duration[0] == nil @turn_duration[0] += 1 if @turn_duration[0] >= @turn_duration[1] @turn_duration[0] = 0 $game_troop.increase_turn process_event check_states_effect_turn end end #-------------------------------------------------------------------------- # ● Check States Effect Turn #-------------------------------------------------------------------------- def check_states_effect_turn all_battle_members.each do |battler| battler.on_turn_end if battler.restriction >= 4 end end #-------------------------------------------------------------------------- # ● Update AT System #-------------------------------------------------------------------------- def update_at_system reset_at_parameter if @at_phase == nil set_turn_duration if @turn_duration == nil return if !can_update_at? update_turn_duration all_battle_members.each do |battler| update_battler_turn_duration(battler) if !battler.at_cast.empty? battler.at_cast[1] -= 1 if battler.at_cast[1] <= 0 execute_at_cast(battler) break end else battler.at += battler.agi end if battler.at >= $game_system.at_max battler.on_turn_end update_at_actor(battler) update_at_enemy(battler) battler.current_action.prepare if battler.current_action if battler.at_cast.empty? @at_phase = 1 turn_start if battler.is_a?(Game_Enemy) end break end end end #-------------------------------------------------------------------------- # ● Update Battler Turn Duration #-------------------------------------------------------------------------- def update_battler_turn_duration(battler) if battler.restriction >= 4 battler.at_turn_duration += 1 if battler.at_turn_duration >= $game_system.at_max battler.on_turn_end battler.at_turn_duration = 0 end else battler.at_turn_duration = 0 end end #-------------------------------------------------------------------------- # ● Execute AT CAST #-------------------------------------------------------------------------- def execute_at_cast(battler) @subject = battler battler.make_actions turn_start end #-------------------------------------------------------------------------- # ● Update AT Actor #-------------------------------------------------------------------------- def update_at_actor(battler) return if !battler.is_a?(Game_Actor) Audio.se_play("Audio/SE/" + SE_ACTIVE,100,100) start_party_command_selection_at(battler) end #-------------------------------------------------------------------------- # ● Update AT Enemy #-------------------------------------------------------------------------- def update_at_enemy(battler) return if !battler.is_a?(Game_Enemy) battler.make_actions end #-------------------------------------------------------------------------- # ● Can Update AT #-------------------------------------------------------------------------- def can_update_at? return false if $game_troop.interpreter.running? return false if BattleManager.action_forced? return false if @at_phase != 0 return false if $game_message.visible return false if BattleManager.in_turn? return true end #-------------------------------------------------------------------------- # ● Star Party Command Selection at #-------------------------------------------------------------------------- def start_party_command_selection_at(battler) unless scene_changing? refresh_status @status_window.unselect @status_window.open if BattleManager.input_start_at(battler) @actor_command_window.close next_command else turn_start end end end #-------------------------------------------------------------------------- # ● Update Basic #-------------------------------------------------------------------------- alias mog_at_system_update_basic update_basic def update_basic mog_at_system_update_basic update_at_system update_party_command $game_message.position = MESSAGE_POSITION end #-------------------------------------------------------------------------- # ● Update Party Command #-------------------------------------------------------------------------- def update_party_command return if !@party_command_window.active return if !@actor_command_window.visible return if $game_message.visible if Input.trigger?(: next_command Sound.play_cancel @party_command_window.active = false end end end#==============================================================================# ■ AT Meter#==============================================================================class AT_Meter include MOG_AT_SYSTEM #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(actor) dispose @actor = actor if HUD_POSITION_TYPE == 1 and @actor.use_sprite? @x = HUD_POSITION[0] + @actor.screen_x rescue 0 @y = HUD_POSITION[1] + @actor.screnn_y rescue 0 else @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index) @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index) end pre_cache create_layout create_at_meter end #-------------------------------------------------------------------------- # ● Pre Cache #-------------------------------------------------------------------------- def pre_cache @meter = Cache.system("Battle_AT_Meter") @meter_cw = @meter.width / 3 @meter_ch = @meter.height / 3 end #-------------------------------------------------------------------------- # ● Create Layout #-------------------------------------------------------------------------- def create_layout @layout = Sprite.new @layout.bitmap = Cache.system("Battle_AT_Layout") @layout.z = BATTLE_HUD_Z @layout.x = @x @layout.y = @y end #-------------------------------------------------------------------------- # ● Create AT Meter #-------------------------------------------------------------------------- def create_at_meter @at_meter = Sprite.new @at_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch) @at_meter.z = BATTLE_HUD_Z + 50 @at_meter.x = @x + AT_METER_POSITION[0] @at_meter.y = @y + AT_METER_POSITION[1] @at_flow = rand(@meter_cw * 2) at_flow_update end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- def dispose return if @layout == nil @layout.bitmap.dispose @layout.dispose @layout = nil @at_meter.bitmap.dispose @at_meter.dispose end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update return if @layout == nil at_position at_flow_update end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def at_position return unless HUD_POSITION_TYPE == 1 and @actor.use_sprite? @x = HUD_POSITION[0] + @actor.screen_x rescue 0 @y = HUD_POSITION[1] + @actor.screnn_y rescue 0 @layout.x = @x @layout.y = @y @at_meter.x = @x + AT_METER_POSITION[0] @at_meter.y = @y + AT_METER_POSITION[1] end #-------------------------------------------------------------------------- # ● AT Flow Update #-------------------------------------------------------------------------- def at_flow_update @at_meter.bitmap.clear if !@actor.at_cast.empty? max_cast = @actor.at_cast[0].speed.abs != 0 ? @actor.at_cast[0].speed.abs : 1 at_width = @meter_cw * @actor.at_cast[1] / max_cast ch = @meter_ch * 2 else at_width = @meter_cw * @actor.at / $game_system.at_max ch = @actor.at < $game_system.at_max ? 0 : @meter_ch end src_rect = Rect.new(@at_flow, ch,at_width, @meter_ch) @at_meter.bitmap.blt(0,0, @meter, src_rect) @at_flow += AT_METER_FLOW_SPEED @at_flow = 0 if @at_flow >= @meter_cw * 2 end end #==============================================================================# ■ Spriteset Battle#==============================================================================class Spriteset_Battle #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias mog_at_system_initialize initialize def initialize mog_at_system_initialize create_at_meter end #-------------------------------------------------------------------------- # ● Create AT Meter #-------------------------------------------------------------------------- def create_at_meter dispose_at_meter @at_meter = [] index = 0 for i in $game_party.members @at_meter.push(AT_Meter.new(i)) index += 1 break if index >= $game_party.max_battle_members end end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- alias mog_at_system_dispose dispose def dispose mog_at_system_dispose dispose_at_meter end #-------------------------------------------------------------------------- # ● Dispose AT Meter #-------------------------------------------------------------------------- def dispose_at_meter return if @at_meter == nil @at_meter.each {|sprite| sprite.dispose } @at_meter.clear @at_meter = nil end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- alias mog_at_system_update update def update mog_at_system_update update_at_meter end #-------------------------------------------------------------------------- # ● Update AT Meter #-------------------------------------------------------------------------- def update_at_meter return if @at_meter == nil @at_meter.each {|sprite| sprite.update } end end$mog_rgss3_at_system = true

