True Active Time Battle

Hibiro

Veteran
Veteran
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.

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
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
eto I don't understand a word of you say....you wanted to have a Active time stuff? or you wanted to have a English version of moghunter script?
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
He/She wants an edit to the script to change how Agility affects the turn speeds. Instead of Agility affecting how fast a battler's bar fills, the bar instead starts off filled from a specific point depending on Agility.  (Meaning most likely all battlers will have the same bar filling speed regardless but faster battlers will have the advantage)

Like for example, lets say an actor has 0 Agility, and the max is 255. With 0 AGI, the bar starts from scratch and takes 6 seconds to fill.  However with 127 AGI, the bar starts from the 1/4th point instead of from scratch. If the actor has 255 AGI, then the bar starts from the 1/2 point.

Of course this would all be adjustable to his/her liking. I'm just throwing random amounts.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You can probably do it with Yami's Classical ATB with a few edit... you can also make turns be counted as number of actions rather than per time...
 

Hibiro

Veteran
Veteran
Joined
Aug 17, 2013
Messages
30
Reaction score
1
First Language
English
Kerbonklin understands it!

The issue about throwing any other AT Script into it, is the gauge. I've used one before, and it works, but I don't get a Gauge showing on the battle screen, which is the key part of an Active Time Script.

Not sure how much simpler I can put it, but I want to use MOGhunter's battle system, as I love the layout and how it works, but I need an AT System that uses Agility for where the gauge starts in battle, NOT how quickly it fills. (Back attacks can cause it to start empty, Pre-Emptives will make it closer to full.)

Essentially, a system just like Final Fantasy VII, VIII, IX and Chrono Trigger, the speed of the gauge being altered by a boost of speed in battle, usually from a state like Haste.

I was just wondering if anyone whom understands RGSS3 better than myself could tell me if MOG's script already allows this and I'm just overlooking something, otherwise, work it out so it can work how I want it to.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yami's CATB has a gauge...
 

Kyutaru

Software Engineer & Ninja
Veteran
Joined
Jan 17, 2014
Messages
156
Reaction score
56
First Language
English
Primarily Uses
Essentially, a system just like Final Fantasy VII, VIII, IX and Chrono Trigger, the speed of the gauge being altered by a boost of speed in battle, usually from a state like Haste.
Just fyi, everything you want (gauge included) is already done and configurable using Fomar's ATB script.  He even has the ATB affectable by states rather than by Agility, with an example of Haste, Stop, and Slow.  Within the comment section there's also code you can add to normalize the battle system so that no matter how much agility you have, you will always charge at the same speed relative to other characters, with higher agility characters having the fastest react times but still capped between relative bounds (i.e. it scales so you don't have the low level/high level issue).

Check it out.

http://cobbtocs.co.uk/wp/?p=64
 

Hibiro

Veteran
Veteran
Joined
Aug 17, 2013
Messages
30
Reaction score
1
First Language
English
Just fyi, everything you want (gauge included) is already done and configurable using Fomar's ATB script.  He even has the ATB affectable by states rather than by Agility, with an example of Haste, Stop, and Slow.  Within the comment section there's also code you can add to normalize the battle system so that no matter how much agility you have, you will always charge at the same speed relative to other characters, with higher agility characters having the fastest react times but still capped between relative bounds (i.e. it scales so you don't have the low level/high level issue).

Check it out.

http://cobbtocs.co.uk/wp/?p=64
I've already tried to use that one, it does what it needs to, but the gauge doesn't show on the battle menu, since it's still MOG's battle system. (I love said system.) I'm sure there's a way to make them work together, I just don't know how myself.

Essentially, if Fomar's could be made to work with MOG's Advanced Battle Script, that would be great.

Code:
#==============================================================================# +++ MOG - Advanced Battle Hud (v2.6) +++#==============================================================================# By Moghunter # [URL="http://www.atelier-rgss.com/#==============================================================================%23"]http://www.atelier-rgss.com/#==============================================================================#[/URL] Sistema de hud avançado de batalha.#==============================================================================#==============================================================================# ● Histórico (Version History)#==============================================================================# v 2.6 - Melhor codificação# v 2.5 - Melhoria na performance#       - Correção de bugs.#==============================================================================## Battle_AT_Layout.png# Battle_AT_Meter.png##==============================================================================# ■ - FACE ANIMADAS DOS PERSONAGENS - (Opcional)#==============================================================================# 1 - Grave as imagens das faces dos personagens na pasta.## GRAPHICS/BATTLERS/## 2 - Nomeie a imagem com o mesmo nome do personagem. (EG - Hertor.png)# 3 - A largura da imagem deverá ser dividido por 5. (A escolha do tamanho#     da face é livre desde que a lagura dividido pela altura seja igual a 5 )##==============================================================================#==============================================================================# ■ BATTLE HUD SETTING#==============================================================================module MOG_BATTLE_HUD  # Ativar Battlers dos personagens em faces, deixe desativado em caso de haver  # outros scripts que usam battlers dos personagens em seu projeto.  BATTLER_FACE_ENABLE = true  #Definição geral da posição da HUD.  HUD_POSITION = [5,315]  #Definição da posição da face  FACE_POSITION = [60,30]  #Definição da posição do numero de HP.  HP_NUMBER_POSITION = [85,28]  #Definição da posição do medidor de HP.  HP_METER_POSITION = [27,37]  #Definição da posição do numero de MP.  MP_NUMBER_POSITION = [101,46]  #Definição da posição do medidor de MP.  MP_METER_POSITION = [43,55]    #Definição da posição do numero de TP.  TP_NUMBER_POSITION = [85,64]  #Definição da posição do medidor de TP.  TP_METER_POSITION = [27,73]     #Definição da posição das condições  SAMINA_GAUGE_POSITION = [43,81]  #ATB Meter  STATES_POSITION = [5,1]  #Definição da posição do comando de batalha.  COMMAND_POSITION = [0,-145]    #Definição da posição do espaço da HUD entre os membros do grupo.  MEMBERS_SPACE = [136,0]  #Definição da prioridade da HUD.  BATTLE_HUD_Z = 0  #Definição da velocidade de animação dos medidores.  METER_FLOW_SPEED = 2  #Ativa o layout mais limpo nas janelas de item e skill.   ITEM_SKILL_WINDOWS_CLEAN_STYLE = true  #Definição da opacidade das janelas.  ITEM_SKILL_WINDOW_OPACITY = 0  end#==============================================================================# ■ Game Temp#==============================================================================class Game_Temp    attr_accessor :cache_battle_hud    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------      alias mog_battle_hud_initialize initialize  def initialize      mog_battle_hud_initialize      pre_cache_battle_hud  end    #--------------------------------------------------------------------------  # ● Pre Cache Battle Hud  #--------------------------------------------------------------------------    def pre_cache_battle_hud      @cache_battle_hud = []      @cache_battle_hud.push(Cache.system("Battle_Hud_Number"))      @cache_battle_hud.push(Cache.system("Battle_Hud_Meter"))      @cache_battle_hud.push(Cache.system("Iconset"))      @cache_battle_hud.push(Cache.system("Battle_Hud_Layout"))  end  end#==============================================================================# ■ Battle_Hud#==============================================================================class Battle_Hud  include MOG_BATTLE_HUD    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------      def initialize(actor)            @actor = actor      @x = HUD_POSITION[0] + (MEMBERS_SPACE[0] * @actor.index)      @y = HUD_POSITION[1] + (MEMBERS_SPACE[1] * @actor.index)      @flow_speed = 0      pre_cache      create_layout      create_hp_number      create_hp_meter      create_mp_number      create_mp_meter      create_tp_number      create_tp_meter      create_states  end    #--------------------------------------------------------------------------  # ● Pre Cache  #--------------------------------------------------------------------------        def pre_cache      $game_temp.pre_cache_battle_hud      @number = $game_temp.cache_battle_hud[0]      @number_cw = @number.width / 10      @number_ch = @number.height / 4      @meter = $game_temp.cache_battle_hud[1]      @meter_cw = @meter.width / 3      @meter_ch = @meter.height / 3      @icon = $game_temp.cache_battle_hud[2]  end    #--------------------------------------------------------------------------  # ● Create Layout  #--------------------------------------------------------------------------        def create_layout      @layout = Sprite.new      @layout.bitmap = $game_temp.cache_battle_hud[3]      @layout.z = BATTLE_HUD_Z      @layout.x = @x      @layout.y = @y  end    #--------------------------------------------------------------------------  # ● Create HP Number  #--------------------------------------------------------------------------          def create_hp_number      @hp = @actor.hp      @hp_old = @actor.hp      @hp_ref = @hp_old      @hp_refresh = false      @hp_number = Sprite.new      @hp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)      @hp_number.z = BATTLE_HUD_Z + 2      @hp_number.x = @x + HP_NUMBER_POSITION[0]      @hp_number.y = @y + HP_NUMBER_POSITION[1]      refresh_hp_number  end    #--------------------------------------------------------------------------  # ● Create HP Meter  #--------------------------------------------------------------------------        def create_hp_meter      @hp_meter = Sprite.new      @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)      @hp_meter.z =  BATTLE_HUD_Z + 1      @hp_meter.x = @x + HP_METER_POSITION[0]      @hp_meter.y = @y + HP_METER_POSITION[1]       @hp_flow = rand(@meter_cw * 2)      @hp_width_old = @meter_cw * @actor.hp / @actor.mhp       hp_flow_update  end      #--------------------------------------------------------------------------  # ● Hp Flow Update  #--------------------------------------------------------------------------  def hp_flow_update      @hp_meter.bitmap.clear      hp_width = @meter_cw * @actor.hp / @actor.mhp      hp_src_rect = Rect.new(@hp_flow, 0,hp_width, @meter_ch)      @hp_meter.bitmap.blt(0,0, @meter, hp_src_rect)      @hp_flow += METER_FLOW_SPEED      @hp_flow = 0 if @hp_flow >=  @meter_cw * 2        end      #--------------------------------------------------------------------------  # ● Execute Damage Flow  #--------------------------------------------------------------------------   def execute_damage_flow(hp_width)     n = (@hp_width_old - hp_width).abs * 3 / 100     damage_flow = [[n, 2].min,0.5].max     @hp_width_old -= damage_flow              @hp_width_old = hp_width if @hp_width_old < hp_width      src_rect_old = Rect.new(@hp_flow, @meter_ch * 3,@hp_width_old, @meter_ch)     @hp_meter.bitmap.blt(0,0, @meter, src_rect_old)         end     #--------------------------------------------------------------------------  # ● Update HP Number  #--------------------------------------------------------------------------        def update_hp_number      @hp_refresh = true      n =  2 * (@actor.hp - @hp_old).abs / 100      hp_ref = [[n, 100].min,1].max      if @hp_old < @actor.hp          @hp += hp_ref               if @hp >= @actor.hp             @hp_old = @actor.hp              @hp = @actor.hp                @hp_ref = 0          end                      elsif @hp_old > @actor.hp              @hp -= hp_ref                           if @hp <= @actor.hp              @hp_old = @actor.hp               @hp = @actor.hp                 @hp_ref = 0           end                    end            end      #--------------------------------------------------------------------------  # ● Refresh HP Number  #--------------------------------------------------------------------------        def refresh_hp_number      @flow_speed = METER_FLOW_SPEED      @hp_number.bitmap.clear      number_value = @hp.abs.to_s.split(//)      hp_color = @hp < @actor.mhp * 30 / 100 ? @number_ch : 0      center_x = 0      for r in 0..number_value.size - 1                  number_value_abs = number_value[r].to_i          src_rect = Rect.new(@number_cw * number_value_abs, hp_color, @number_cw, @number_ch)         @hp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)          center_x += 1      end      @hp_number.x = @x + HP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))      @hp_refresh = false if @hp == @actor.hp        end      #--------------------------------------------------------------------------  # ● Create MP Number  #--------------------------------------------------------------------------          def create_mp_number      @mp = @actor.mp      @mp_old = @actor.mp      @mp_ref = @mp_old      @mp_refresh = false      @mp_number = Sprite.new      @mp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)      @mp_number.z = BATTLE_HUD_Z + 2      @mp_number.x = @x + MP_NUMBER_POSITION[0]      @mp_number.y = @y + MP_NUMBER_POSITION[1]      refresh_mp_number  end    #--------------------------------------------------------------------------  # ● Create MP Meter  #--------------------------------------------------------------------------        def create_mp_meter      @mp_meter = Sprite.new      @mp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)      @mp_meter.z =  BATTLE_HUD_Z + 1      @mp_meter.x = @x + MP_METER_POSITION[0]      @mp_meter.y = @y + MP_METER_POSITION[1]       @mp_flow = rand(@meter_cw * 2)      @mp_width_old = @meter_cw * @actor.mp / @actor.mmp rescue 0      mp_flow_update  end      #--------------------------------------------------------------------------  # ● Mp Flow Update  #--------------------------------------------------------------------------  def mp_flow_update      return if @actor.mmp == 0      @mp_meter.bitmap.clear      mp_width = @meter_cw * @actor.mp / @actor.mmp rescue 0      src_rect = Rect.new(@mp_flow, @meter_ch,mp_width, @meter_ch)      @mp_meter.bitmap.blt(0,0, @meter, src_rect)      @mp_flow += METER_FLOW_SPEED      @mp_flow = 0 if @mp_flow >=  @meter_cw * 2          end      #--------------------------------------------------------------------------  # ● Update MP Number  #--------------------------------------------------------------------------        def update_mp_number      @mp_refresh = true      n =  2 * (@actor.mp - @mp_old).abs / 100      mp_ref = [[n, 100].min,1].max      if @mp_old < @actor.mp          @mp += mp_ref               if @mp >= @actor.mp             @mp_old = @actor.mp              @mp = @actor.mp                @mp_ref = 0          end                      elsif @mp_old > @actor.mp              @mp -= mp_ref                           if @mp <= @actor.mp              @mp_old = @actor.mp               @mp = @actor.mp                 @mp_ref = 0           end                    end            end      #--------------------------------------------------------------------------  # ● Refresh MP Number  #--------------------------------------------------------------------------        def refresh_mp_number      @flow_speed = METER_FLOW_SPEED      @mp_number.bitmap.clear      number_value = @mp.abs.to_s.split(//)      center_x = 0      for r in 0..number_value.size - 1                  number_value_abs = number_value[r].to_i          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 2, @number_cw, @number_ch)         @mp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)          center_x += 1      end      @mp_number.x = @x + MP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))      @mp_refresh = false if @mp == @actor.mp        end      #--------------------------------------------------------------------------  # ● Create TP Number  #--------------------------------------------------------------------------          def create_tp_number      @tp = @actor.tp      @tp_old = @actor.tp      @tp_ref = @tp_old      @tp_refresh = false      @tp_number = Sprite.new      @tp_number.bitmap = Bitmap.new((@number_cw * 6),@number_ch)      @tp_number.z = BATTLE_HUD_Z + 2      @tp_number.x = @x + TP_NUMBER_POSITION[0]      @tp_number.y = @y + TP_NUMBER_POSITION[1]      refresh_tp_number  end    #--------------------------------------------------------------------------  # ● Create TP Meter  #--------------------------------------------------------------------------        def create_tp_meter      @tp_meter = Sprite.new      @tp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)      @tp_meter.z =  BATTLE_HUD_Z + 1      @tp_meter.x = @x + TP_METER_POSITION[0]      @tp_meter.y = @y + TP_METER_POSITION[1]       @tp_flow = rand(@meter_cw * 2)      @tp_width_old = @meter_cw * @actor.tp / @actor.max_tp rescue 0       tp_flow_update  end      #--------------------------------------------------------------------------  # ● TP Flow Update  #--------------------------------------------------------------------------  def tp_flow_update      return if @actor.max_tp == 0      @tp_meter.bitmap.clear      tp_width = @meter_cw * @actor.tp / @actor.max_tp rescue 0      src_rect = Rect.new(@tp_flow, @meter_ch * 2,tp_width, @meter_ch)      @tp_meter.bitmap.blt(0,0, @meter, src_rect)      @tp_flow += METER_FLOW_SPEED      @tp_flow = 0 if @tp_flow >=  @meter_cw * 2        end      #--------------------------------------------------------------------------  # ● Update TP Number  #--------------------------------------------------------------------------        def update_tp_number      @tp_refresh = true      n =  2 * (@actor.tp - @tp_old).abs / 100      tp_ref = [[n, 100].min,1].max      if @tp_old < @actor.tp          @tp += tp_ref               if @tp >= @actor.tp             @tp_old = @actor.tp              @tp = @actor.tp                @tp_ref = 0          end                      elsif @tp_old > @actor.tp              @tp -= tp_ref                           if @tp <= @actor.tp              @tp_old = @actor.tp               @tp = @actor.tp                 @tp_ref = 0           end                    end              end            #--------------------------------------------------------------------------  # ● Refresh TP Number  #--------------------------------------------------------------------------        def refresh_tp_number      @flow_speed = METER_FLOW_SPEED      @tp_number.bitmap.clear      number_value = @tp.truncate.to_s.split(//)      center_x = 0      for r in 0..number_value.size - 1                 number_value_abs = number_value[r].to_i          src_rect = Rect.new(@number_cw * number_value_abs, @number_ch * 3, @number_cw, @number_ch)         @tp_number.bitmap.blt((@number_cw + 1) *  r, 0, @number, src_rect)          center_x += 1      end      @tp_number.x = @x + TP_NUMBER_POSITION[0] - (center_x * (@number_cw + 1))      @tp_refresh = false if @tp == @actor.tp  end        #--------------------------------------------------------------------------  # ● Create_States  #--------------------------------------------------------------------------        def create_states      refresh_states      @status = Sprite.new      @status.bitmap = Bitmap.new(24,24)      @status.x = @x + STATES_POSITION[0]      @status.y = @y + STATES_POSITION[1]            @status_flow = -24      @states_speed = 50      @status.z = BATTLE_HUD_Z + 2      @old_states = @actor.states      flow_states  end      #--------------------------------------------------------------------------  # ● Flow_Status  #--------------------------------------------------------------------------            def flow_states      return if @actor.states.size == 0 and !@status.visible      @states_speed = 0      @status.bitmap.clear      src_rect = Rect.new(@status_flow,0, 24,24)      @status.bitmap.blt(0,0, @actor_status, src_rect)      @status.visible = @actor.states.size == 0 ? false : true      @status_flow += 1      @status_flow = -24 if @status_flow >= @states_size - 24  end        #--------------------------------------------------------------------------  # ● Refresh States  #--------------------------------------------------------------------------          def refresh_states      @old_states = @actor.states      @actor_status.dispose if @actor_status != nil      @states_size = @actor.states.size > 0 ? (48 * @actor.states.size) : 24       @actor_status = Bitmap.new(@states_size,24)      index = 0      for i in  @actor.states         rect = Rect.new(i.icon_index % 16 * 24, i.icon_index / 16 * 24, 24, 24)         @actor_status.blt(48 * index , 0, @icon, rect)         index += 1      end  end      #--------------------------------------------------------------------------  # ● Dispose  #--------------------------------------------------------------------------      def dispose      return if @layout == nil      @layout.dispose      @hp_number.bitmap.dispose      @hp_number.dispose      @hp_meter.bitmap.dispose      @hp_meter.dispose      @mp_number.bitmap.dispose      @mp_number.dispose      @mp_meter.bitmap.dispose      @mp_meter.dispose            @tp_number.bitmap.dispose      @tp_number.dispose      @tp_meter.bitmap.dispose      @tp_meter.dispose      @status.bitmap.dispose      @status.dispose      @actor_status.dispose if @actor_status != nil      @layout = nil  end    #--------------------------------------------------------------------------  # ● Update  #--------------------------------------------------------------------------      def update      return if @meter == nil      update_hp_number if @hp_old != @actor.hp      refresh_hp_number if @hp_refresh      update_mp_number if @mp_old != @actor.mp      refresh_mp_number if @mp_refresh      update_tp_number if @tp_old != @actor.tp      refresh_tp_number if @tp_refresh      refresh_states if @old_states != @actor.states      @flow_speed += 1      if @flow_speed >= METER_FLOW_SPEED         @flow_speed = 0         hp_flow_update         tp_flow_update         mp_flow_update      end      flow_states  end  end#==============================================================================# ■ Game_System#==============================================================================class Game_System    attr_accessor :battler_hud    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------      alias mog_adv_battle_hud_initialize initialize  def initialize             @battler_hud = false      mog_adv_battle_hud_initialize  end    end#==============================================================================# ■ Spriteset Battle#==============================================================================class Spriteset_Battle    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------    alias mog_battle_hud_initialize initialize  def initialize      mog_battle_hud_initialize      create_battle_hud        end    #--------------------------------------------------------------------------  # ● Create Battle Hud  #--------------------------------------------------------------------------      def create_battle_hud      @battle_hud = []      for i in $game_party.battle_members          @battle_hud.push(Battle_Hud.new(i))      end  end    #--------------------------------------------------------------------------  # ● Dispose  #--------------------------------------------------------------------------        alias mog_battle_hud_dispose dispose  def dispose      mog_battle_hud_dispose      dispose_battle_hud  end      #--------------------------------------------------------------------------  # ● Dispose Battle Hud  #--------------------------------------------------------------------------          def dispose_battle_hud      return if @battle_hud == nil      @battle_hud.each {|sprite| sprite.dispose }      @battle_hud = nil  end    #--------------------------------------------------------------------------  # ● Update  #--------------------------------------------------------------------------          alias mog_battle_hud_update update  def update      mog_battle_hud_update      update_battle_hud  end    #--------------------------------------------------------------------------  # ● Update Battle Hud  #--------------------------------------------------------------------------            def update_battle_hud      return if @battle_hud == nil      @battle_hud.each {|sprite| sprite.update }  end    end#==============================================================================# ■ Game_Actor#==============================================================================class Game_Actor < Game_Battler  include MOG_BATTLE_HUD      attr_accessor :hud_x   attr_accessor :hud_y  #--------------------------------------------------------------------------  # ● HUD X  #--------------------------------------------------------------------------       def hud_x      return HUD_POSITION[0] + (MEMBERS_SPACE[0] * index)  end    #--------------------------------------------------------------------------  # ● HUD Y  #--------------------------------------------------------------------------      def hud_y      return HUD_POSITION[1] + (MEMBERS_SPACE[1] * index)  end    end  #==============================================================================# ■ Scene Battle#==============================================================================class Scene_Battle < Scene_Base    #--------------------------------------------------------------------------  # ● Create Party Command Window  #--------------------------------------------------------------------------      alias mog_battle_hud_create_party_command_window create_party_command_window  def create_party_command_window      mog_battle_hud_create_party_command_window      set_party_window_position   end      #--------------------------------------------------------------------------  # ● Set Party Window Position  #--------------------------------------------------------------------------        def set_party_window_position      @party_command_window.viewport = nil        return if $mog_rgss3_at_system != nil      a_index = []      for actor in $game_party.alive_members          a_index = [actor.hud_x, actor.hud_y]          break      end      return if a_index.empty?       @party_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + a_index[0]      @party_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + a_index[1]        end      #--------------------------------------------------------------------------  # ● Set Party Window Position  #--------------------------------------------------------------------------          alias mog_battle_hud_start_party_command_selection start_party_command_selection  def start_party_command_selection      set_party_window_position       mog_battle_hud_start_party_command_selection  end      #--------------------------------------------------------------------------  # ● Update  #--------------------------------------------------------------------------    alias mog_battle_hud_update_basic update_basic  def update_basic      mog_battle_hud_update_basic      update_command_window_visible  end      #--------------------------------------------------------------------------  # ● Update Command Window Visible  #--------------------------------------------------------------------------      def update_command_window_visible      @status_window.visible = @status_window.active ? true : false      @actor_command_window.visible = @actor_command_window.active ? true : false      @skill_window.visible = @skill_window.active ? true : false      @item_window.visible = @item_window.active ? true : false        end    #--------------------------------------------------------------------------  # ● Start Actor Command Selection  #--------------------------------------------------------------------------      alias mog_battle_hud_start_actor_command_selection start_actor_command_selection  def start_actor_command_selection      mog_battle_hud_start_actor_command_selection      @actor_command_window.viewport = nil      @actor_command_window.x = MOG_BATTLE_HUD::COMMAND_POSITION[0] + $game_party.members[BattleManager.actor.index].hud_x      @actor_command_window.y = MOG_BATTLE_HUD::COMMAND_POSITION[1] + $game_party.members[BattleManager.actor.index].hud_y      @party_command_window.x = @actor_command_window.x      @party_command_window.y = @actor_command_window.y    end  end#==============================================================================# ■ Game_Actor#==============================================================================class Game_Actor < Game_Battler  include MOG_BATTLE_HUD    attr_accessor :battler_face  attr_accessor :battler_face_name  attr_accessor :screen_x  attr_accessor :screen_y  attr_accessor :screen_z    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------  alias mog_battle_hud_initialize setup  def setup(actor_id)      mog_battle_hud_initialize(actor_id)      battler_sprite_setup  end        #--------------------------------------------------------------------------  # ● Battler Sprite Setup  #--------------------------------------------------------------------------    def battler_sprite_setup      @battler_face = [0,0,0]      @battler_face_name = @name + "_Face"  end  if BATTLER_FACE_ENABLE  #--------------------------------------------------------------------------  # ● Use Sprite?  #--------------------------------------------------------------------------  def use_sprite?      return true  end  end  end#==============================================================================# ■ Sprite_Battler#==============================================================================class Sprite_Battler < Sprite_Base  include MOG_BATTLE_HUD    #--------------------------------------------------------------------------  # ● Dispose  #--------------------------------------------------------------------------      alias mog_battler_face_dispose dispose  def dispose      mog_battler_face_dispose      dispose_battler_face  end      #--------------------------------------------------------------------------  # ● Update  #--------------------------------------------------------------------------     alias mog_battler_face_update update  def update      refresh_face_battler      mog_battler_face_update      update_battler_face  end      #--------------------------------------------------------------------------  # ● Refresh Face Battler  #--------------------------------------------------------------------------       def refresh_face_battler      return if @face_sprite != nil       return if @battler == nil       return if @battler.is_a?(Game_Enemy)      setup_battler_screen if @battler.screen_x == nil or $game_system.battler_hud      @face_sprite = Battler_Face_Sprite.new(self.viewport, @battler)  end      #--------------------------------------------------------------------------  # ● Setup Battler Screen  #--------------------------------------------------------------------------         def setup_battler_screen      $game_system.battler_hud = true      @battler.screen_x = FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)      @battler.screen_y = FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)      @battler.screen_z = 103 if @battler.screen_z == nil  end      #--------------------------------------------------------------------------  # ● Dispose Battler Face  #--------------------------------------------------------------------------         def dispose_battler_face      return if @face_sprite == nil       @face_sprite.dispose    end    #--------------------------------------------------------------------------  # ● Update Battler Face  #--------------------------------------------------------------------------         def update_battler_face      return if @face_sprite == nil      @face_sprite.update_actor_battler  end      #--------------------------------------------------------------------------  # ● Update Posiion  #--------------------------------------------------------------------------           alias mog_battler_face_update_position update_position  def update_position      mog_battler_face_update_position      update_face_z  end      #--------------------------------------------------------------------------  # ● Update Face Z  #--------------------------------------------------------------------------           def update_face_z      return if @face_sprite == nil      @face_sprite.update_face_z(self.z)  end  #--------------------------------------------------------------------------  # ● Update Collapse  #--------------------------------------------------------------------------                             alias mog_battle_hud_update_collapse update_collapse   def update_collapse       if face_can_cancel_method?         self.opacity = 255         self.visible = true         return      end       mog_battle_hud_update_collapse   end       #--------------------------------------------------------------------------  # ● Update Instant Collapse  #--------------------------------------------------------------------------                                alias mog_battle_hud_update_instant_collapse update_instant_collapse   def update_instant_collapse      if face_can_cancel_method?         self.opacity = 255         self.visible = true         return      end       mog_battle_hud_update_instant_collapse   end      #--------------------------------------------------------------------------  # ● Init Visibility  #--------------------------------------------------------------------------                                  alias mog_battle_face_init_visibility init_visibility  def init_visibility      if face_can_cancel_method?         self.opacity = 255         self.visible = true         return      end      mog_battle_face_init_visibility  end     #--------------------------------------------------------------------------  # ● Face Can Cancel Method  #--------------------------------------------------------------------------                                    def face_can_cancel_method?      return false if !BATTLER_FACE_ENABLE      return false if @battler.is_a?(Game_Enemy)      return false if !$game_system.battler_hud      return true  end    end#==============================================================================# ■ Battler Face Sprite#==============================================================================class Battler_Face_Sprite < Sprite  include MOG_BATTLE_HUD    #--------------------------------------------------------------------------  # ● Initialize  #--------------------------------------------------------------------------                   def initialize(viewport = nil,battler)       super(viewport)       @battler = battler       @f_im = Cache.battler(@battler.battler_face_name, 0)       @f_cw = @f_im.width / 5       @f_ch = @f_im.height       self.bitmap = Bitmap.new(@f_cw,@f_ch)       x = -(@f_cw / 2) + FACE_POSITION[0] + HUD_POSITION[0] + (MEMBERS_SPACE[0] * @battler.index)       y = -@f_ch + FACE_POSITION[1] + HUD_POSITION[1] + (MEMBERS_SPACE[1] * @battler.index)       @org_pos = [x,y]       @battler.battler_face = [0,0,0]       @battler_visible = true       @low_hp = @battler.mhp * 30 / 100       @old_face_index = 0       self.z = @battler.screen_z       make_face(true)   end     #--------------------------------------------------------------------------  # ● Dispose  #--------------------------------------------------------------------------                         def dispose      super      dispose_battler_face_sprite   end      #--------------------------------------------------------------------------  # ● Dispose Battler Face Sprite  #--------------------------------------------------------------------------                      def dispose_battler_face_sprite        self.bitmap.dispose       @f_im.dispose  end       #--------------------------------------------------------------------------  # ● Update  #--------------------------------------------------------------------------    def update_face_sprite(battler)      @battler = battler      update_face_reset_time      update_face_effect  end     #--------------------------------------------------------------------------  # ● Face Base Setting  #--------------------------------------------------------------------------                   def face_base_setting       self.x = @org_pos[0]      self.y = @org_pos[1]      self.zoom_x = 1      self.zoom_y = 1      self.mirror = false     end    #--------------------------------------------------------------------------  # ● Check Base Face  #--------------------------------------------------------------------------                 def check_base_face(reset)       face_base_setting       return if @battler.battler_face[2] > 0        @battler.battler_face = [0,0,0] if reset and @battler.battler_face[1] != 2         @battler.battler_face[0] = 3 if @battler.hp < @low_hp       @battler.battler_face[0] = 4 if @battler.hp == 0   end       #--------------------------------------------------------------------------  # ● Make Face  #--------------------------------------------------------------------------                 def make_face(reset = false)       self.bitmap.clear       check_base_face(reset)       src_rect_back = Rect.new(@f_cw * @battler.battler_face[0], 0, @f_cw, @f_ch)       self.bitmap.blt(0,0, @f_im, src_rect_back)       @old_face_index = @battler.battler_face[0]    end    #--------------------------------------------------------------------------  # ● Update Actor Battler  #--------------------------------------------------------------------------              def update_actor_battler       return if self.bitmap == nil       update_face_effect       update_face_reset_time       make_face if @old_face_index != @battler.battler_face[0]                 end     #--------------------------------------------------------------------------  # ● Update Face Z  #--------------------------------------------------------------------------                   def update_face_z(value)      self.z = value + 2  end       #--------------------------------------------------------------------------  # ● Update Face Reset Time   #--------------------------------------------------------------------------                 def update_face_reset_time       return if @battler.battler_face[2] == 0       @battler.battler_face[2] -= 1       if @battler.battler_face[2] == 0 or          (@battler.hp < @low_hp and @battler.battler_face[0] == 0)          make_face(true)        end      end  #--------------------------------------------------------------------------  # ● Update Face Effect  #--------------------------------------------------------------------------                    def update_face_effect       return if @battler.battler_face[2] == 0       case @battler.battler_face[1]          when 0             face_damage          when 1..2             face_heal          when 3             face_action       end   end       #--------------------------------------------------------------------------  # ● Face Damage  #--------------------------------------------------------------------------                       def face_damage       self.x = (@org_pos[0] - (@battler.battler_face[2] /2)) + rand(@battler.battler_face[2])   end       #--------------------------------------------------------------------------  # ● Face Heal  #--------------------------------------------------------------------------                       def face_heal       case  @battler.battler_face[2]         when 20..40             self.zoom_x += 0.01             self.zoom_y = self.zoom_x         when 0..20             self.zoom_x -= 0.01             self.zoom_y = self.zoom_x              end   end          #--------------------------------------------------------------------------  # ● Face Action  #--------------------------------------------------------------------------                       def face_action       case  @battler.battler_face[2]         when 25..50             self.zoom_x += 0.01              self.zoom_y = self.zoom_x             self.mirror = true         when 0..25             self.zoom_x -= 0.01             self.zoom_y = self.zoom_x             self.mirror = false       end       self.zoom_x = self.zoom_x > 1.5 ? self.zoom_x = 1.5 : self.zoom_x < 1 ? 1 : self.zoom_x       self.zoom_y = self.zoom_y > 1.5 ? self.zoom_y = 1.5 : self.zoom_y < 1 ? 1 : self.zoom_y   end       end   #==============================================================================# ■ Battle Manager#==============================================================================class << BattleManager    #--------------------------------------------------------------------------  # ● Battle End  #--------------------------------------------------------------------------                      alias mog_battle_hud_battle_process_victory process_victory  def process_victory      execute_face_effect          mog_battle_hud_battle_process_victory  end    #--------------------------------------------------------------------------  # ● Prepare  #--------------------------------------------------------------------------                    def execute_face_effect      for i in $game_party.members          i.battler_face = [1,2,40] if i.hp > 0         end    end  end#==============================================================================# ■ Game Action#==============================================================================class Scene_Battle < Scene_Base    #--------------------------------------------------------------------------  # ● Show Animations  #--------------------------------------------------------------------------       alias mog_battle_hud_show_animation show_animation  def show_animation(targets, animation_id)      make_face_action_battle       mog_battle_hud_show_animation(targets, animation_id)  end    #--------------------------------------------------------------------------  # ● Make Face Action  #--------------------------------------------------------------------------                    def make_face_action_battle      return if !@subject.is_a?(Game_Actor)       @subject.battler_face = [2,3,50]  end      end  #==============================================================================# ■ Game Battler#==============================================================================class Game_Battler < Game_BattlerBase    #--------------------------------------------------------------------------  # ● Item Apply  #--------------------------------------------------------------------------                  alias mog_battle_hud_item_apply item_apply   def item_apply(user, item)      old_hp = self.hp      old_mp = self.mp      mog_battle_hud_item_apply(user, item)      check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)  end    #--------------------------------------------------------------------------  # ● Check Face Effect  #--------------------------------------------------------------------------    def check_face_effect(old_hp,old_mp)      if self.hp > old_hp or self.mp > old_mp         self.battler_face = [1,1,40]      elsif self.hp < old_hp         self.battler_face = [3,0,40]      end    end      #--------------------------------------------------------------------------  # ● Added New State  #--------------------------------------------------------------------------    alias mog_battle_hud_add_new_state add_new_state  def add_new_state(state_id)      mog_battle_hud_add_new_state(state_id)      if self.is_a?(Game_Actor)         self.battler_face = [1,1,40] if $data_states[state_id].note =~ /<Good State>/         self.battler_face = [3,0,40] if $data_states[state_id].note =~ /<Bad State>/      end     end        #--------------------------------------------------------------------------  # ● Regenerate HP  #--------------------------------------------------------------------------  alias mog_battle_hud_regenerate_hp regenerate_hp  def regenerate_hp      old_hp = self.hp      old_mp = self.mp          mog_battle_hud_regenerate_hp      check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)  end  #--------------------------------------------------------------------------  # ● Regenerate MP  #--------------------------------------------------------------------------  alias mog_battle_hud_regenerate_mp regenerate_mp  def regenerate_mp      old_hp = self.hp      old_mp = self.mp          mog_battle_hud_regenerate_mp      check_face_effect(old_hp,old_mp) if can_check_face_effect?(old_hp,old_mp)  end    #--------------------------------------------------------------------------  # ● Can Check Face Effect  #--------------------------------------------------------------------------                    def can_check_face_effect?(old_hp,old_mp)      return false if self.is_a?(Game_Enemy)      return true if old_hp != self.hp      return true if old_mp != self.mp      return false  end  end#==============================================================================# ■ Scene_Battle#==============================================================================class Scene_Battle < Scene_Base    #--------------------------------------------------------------------------  # ● Invoke Counter Attack  #--------------------------------------------------------------------------          alias mog_battle_hud_invoke_counter_attack invoke_counter_attack  def invoke_counter_attack(target, item)      mog_battle_hud_invoke_counter_attack(target, item)      if target.is_a?(Game_Actor) and target.battler_face[0] != 2                 target.battler_face = [2,3,50]      end    end      #--------------------------------------------------------------------------  # ● Invoke Magic Reflection  #--------------------------------------------------------------------------          alias mog_battle_hud_invoke_magic_reflection invoke_magic_reflection  def invoke_magic_reflection(target, item)      mog_battle_hud_invoke_magic_reflection(target, item)      if target.is_a?(Game_Actor) and target.battler_face[0] != 2                 target.battler_face = [2,3,50]      end    end      end#==============================================================================# ■ Scene Battle#==============================================================================  class Scene_Battle < Scene_Base    #--------------------------------------------------------------------------  # ● select_enemy_selection  #--------------------------------------------------------------------------  alias mog_battle_cursor_select_enemy_selection select_enemy_selection  def select_enemy_selection      mog_battle_cursor_select_enemy_selection      if $mog_rgss3_battle_cursor != nil          @enemy_window.visible = false         @info_viewport.rect.width = 0      end     end    #--------------------------------------------------------------------------  # ● select_enemy_selection  #--------------------------------------------------------------------------  alias mog_battle_cursor_select_actor_selection select_actor_selection  def select_actor_selection      mog_battle_cursor_select_actor_selection      if $mog_rgss3_battle_cursor != nil         @actor_window.visible = false         @info_viewport.rect.width = 0      end     end  end  $mog_rgss3_battle_hud = true
 
Last edited by a moderator:

Kyutaru

Software Engineer & Ninja
Veteran
Joined
Jan 17, 2014
Messages
156
Reaction score
56
First Language
English
Primarily Uses
Okay, modifying the existing script is a whole lot easier than trying to make Fomar's script compatible with THAT piece of customization.....
 
So here's your new script.  Tell me if it works, I only change the variables so it theoretically should.  I also added Haste, Slow, and Stop as functionality.  You can find instructions for how to use them in the header module of the script.  They are currently set to be states 10, 11, and 12 so just by having those states on a character, they will receive speed adjustments.

#==============================================================================
# +++ MOG - AT System  (v0.7 Beta) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de batalha de turnos em tempo real.
#==============================================================================

#==============================================================================

# +++ MOG - AT System  (v0.7 Beta) +++

#==============================================================================

# By Moghunter

# http://www.atelier-rgss.com/

#==============================================================================

# 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 = 2

  # Code injection, Fomar's ATB state buffs
  STAMINA_STATES = []
  # Default colour
  STAMINA_STATES[0] = 1
  # in the form
  # STAMINA_STATES[sTATE_ID] = MULTIPLIER
  # e.g. Haste
  STAMINA_STATES[10] = 2
  # e.g. Stop  
  STAMINA_STATES[11] = 0
  # e.g. Slow  
  STAMINA_STATES[12] = 0.5

  #--------------------------------------------------------------------------
  # ● New Method stamina_gain
  #--------------------------------------------------------------------------
  def self.stamina_gain(battler)
    return (200 * self.stamina_mult(battler)).to_i
  end
  #--------------------------------------------------------------------------
  # ● New Method stamina_gain
  #--------------------------------------------------------------------------
  def self.stamina_mult(battler)
    mult = STAMINA_STATES[0]
    for state in battler.states
      unless STAMINA_STATES[state.id].nil?
        mult *= STAMINA_STATES[state.id]
      end
    end
    return mult
  end
  #--------------------------------------------------------------------------
  # ● New Method stamina_start
  #--------------------------------------------------------------------------
  def self.stamina_start(battler)
    return ($game_system.at_max * battler.agi / 500).to_i
  end
end



#==============================================================================

# ■ 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

   end

end   

 

if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW

#==============================================================================

# ■ BattleManager

#==============================================================================

class Window_BattleLog < Window_Selectable



  #--------------------------------------------------------------------------

  # ● Refresh

  #--------------------------------------------------------------------------    

  def refresh

  end  



  #--------------------------------------------------------------------------

  # ● Message Speed

  #--------------------------------------------------------------------------    

  def message_speed

      return 5

  end



end

end



#==============================================================================

# ■ 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 = self.stamina_start(battler)

          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 += self.stamina_gain(battler)

          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?:) B)

         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
 

Kyutaru

Software Engineer & Ninja
Veteran
Joined
Jan 17, 2014
Messages
156
Reaction score
56
First Language
English
Primarily Uses
double post, ignore
 
Last edited by a moderator:

Hibiro

Veteran
Veteran
Joined
Aug 17, 2013
Messages
30
Reaction score
1
First Language
English
I get an error when it launches battle.

Script 'MOG_AT_System' line 783: NoMethodError occurred.

undefined method 'stamina_start' for #<Scene_Battle0x94be9e4>
 
Joined
Apr 30, 2012
Messages
216
Reaction score
35
First Language
Spanish
Primarily Uses
You can use Cwinter ATB,it has a few bugs,but less than Yami and Fomar0153.

It is a very advanced and powerfull script,it is in Japanese but is not that hard to use.

http://ccwinter.blog.fc2.com/blog-entry-89.html

Excuse me for my bad English and greetings from Argentina.
 
Last edited by a moderator:

Kyutaru

Software Engineer & Ninja
Veteran
Joined
Jan 17, 2014
Messages
156
Reaction score
56
First Language
English
Primarily Uses
I get an error when it launches battle.

Script 'MOG_AT_System' line 783: NoMethodError occurred.

undefined method 'stamina_start' for #<Scene_Battle0x94be9e4>
I moved the methods into the class, try now.

Stick with me and we'll get it working, I can definitely make it do whatever you want it to.

#==============================================================================

# +++ MOG - AT System  (v0.7 Beta) +++

#==============================================================================

# By Moghunter

# http://www.atelier-rgss.com/

#==============================================================================

# Sistema de batalha de turnos em tempo real.

#==============================================================================

#==============================================================================

# +++ MOG - AT System  (v0.7 Beta) +++

#==============================================================================

# By Moghunter

# http://www.atelier-rgss.com/

#==============================================================================

# 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 = 2

  # Code injection, Fomar's ATB state buffs

  STAMINA_STATES = []

  # Default colour

  STAMINA_STATES[0] = 1

  # in the form

  # STAMINA_STATES[sTATE_ID] = MULTIPLIER

  # e.g. Haste

  STAMINA_STATES[10] = 2

  # e.g. Stop  

  STAMINA_STATES[11] = 0

  # e.g. Slow  

  STAMINA_STATES[12] = 0.5

end

#==============================================================================

# ■ 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

   end

end   

if !MOG_AT_SYSTEM::WAIT_LOG_WINDOW

#==============================================================================

# ■ BattleManager

#==============================================================================

class Window_BattleLog < Window_Selectable

  #--------------------------------------------------------------------------

  # ● Refresh

  #--------------------------------------------------------------------------    

  def refresh

  end  

  #--------------------------------------------------------------------------

  # ● Message Speed

  #--------------------------------------------------------------------------    

  def message_speed

      return 5

  end

end

end

#==============================================================================

# ■ Scene Battle

#==============================================================================

class Scene_Battle < Scene_Base

  include MOG_AT_SYSTEM

  #--------------------------------------------------------------------------

  # ● New Method stamina_gain

  #--------------------------------------------------------------------------

  def stamina_gain(battler)

    return (200 * self.stamina_mult(battler)).to_i

  end

  #--------------------------------------------------------------------------

  # ● New Method stamina_gain

  #--------------------------------------------------------------------------

  def stamina_mult(battler)

    mult = MOG_AT_SYSTEM::STAMINA_STATES[0]

    for state in battler.states

      unless MOG_AT_SYSTEM::STAMINA_STATES[state.id].nil?

        mult *= MOG_AT_SYSTEM::STAMINA_STATES[state.id]

      end

    end

    return mult

  end

  #--------------------------------------------------------------------------

  # ● New Method stamina_start

  #--------------------------------------------------------------------------

  def stamina_start(battler)

    return ($game_system.at_max * battler.agi / 500).to_i

  end

  #--------------------------------------------------------------------------

  # ● 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 = self.stamina_start(battler)

          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 += self.stamina_gain(battler)

          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?:) B)

         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
 
Last edited by a moderator:

Hibiro

Veteran
Veteran
Joined
Aug 17, 2013
Messages
30
Reaction score
1
First Language
English
Hahah. That works well, thanks so much.

Now I just got a couple other scripts to work out, and I'll be satisfied with how my game plays.
 

Shyno19

Villager
Member
Joined
Dec 12, 2016
Messages
16
Reaction score
0
First Language
fr
Primarily Uses
I can't open you're spoiler, its bug, can you repost this plz ? 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top