YSA Battle Add-on – Order Gauge

I see who will act first!

Last update: 28/12/2011 (DD/MM/YYYY)

Version: 1.01

Download here: Script & IconSet

This will create an order gauge to see the actions order of battlers. Recreate from Melody.

This script requires YEA – Core Script and YEA – Battle Engine. Get them from Yanfly Channel.

Notetags I wrote in script.

That’s all :3

I think there are some bugs in this script, please help me find out :D.

International News:

YSA’s Update:

26 comments on “YSA Battle Add-on – Order Gauge

  1. Pingback: YEA – Lunatic Objects | Yanfly Channel

  2. Awesome. I always like showing the order of actions. This makes a combat more tactical.
    By the way, just a quick review though, the gauge somewhat blocked the popup of the leftmost actor, if you have 4 in your party.
    My suggestion is to make the gauge a layer below…?

  3. I am not sure if this is complicated in scripting, but I think if this could be achieved, then the whole thing will become more tactical:
    As you know we always set speed fix for a spell, so that if an actor casts a spell, it will probably take action later in a turn. However, it seems that the gauge does not respond to this speed fix simultaneously. The order changed suddenly as I execute all actions in a turn, which is fairly odd and somehow weaken the tactics as the player can’t predict the order anymore.

  4. Pingback: VE – Custom Collapse « . Victor Scripts .

    • Oh, I found a little bug after loading it up on a clean project. The order icons get “stuck” going back and forth when you open up an empty skill list.

  5. The order gauge is initially confusing. Is there some way to make the order of attacks to go from left to right?

  6. Not sure if you still give support on this, but I found a bug where pre-emptive strikes (and presumably surprise ambushes as well) bug out the beginning. All the monster icons stay in one spot and they end up overlapping with the party icons.

  7. I think there’s broken compatibility with yanfly’s victory screen, for some reason for me the order bar stays stuck in front of it when it appears. Anyone else getting this bug?

  8. I was using this script with Yanfly Battle System, and your CTB System, and Ramiro’s battle system. Worked on it a little then tested it a few times, and everything was great. When I had everything finished I tried to test it the final time, for some reason the order gauge wasn’t in a line like the video, the pictures are stacked, but once a person takes a turn it moves to the “bottom” of the stack. If I am not making any sense, I will post a picture. The other scripts are working just fine, no bugs or anything just the order gauge.

    Great script btw! adds an amazing element to games!

    • Edit: Before the pictures stack on each other, the pictures are “invisible” until the players turn is ready… then the picture shows up on top of the other pictures.

      • Edit: How do I get the turns to be more… random? example, there is partymember a, partymember b, partymember c, enemy a, enemy b. the first battle order is:

        enemy b, pm c, enemy a, pm b, pm a

        So then pm a’s turn starts, attack is chosen, they attack, then moves to the back of the order, like so:

        pm a, enemby b, pm c, enemy a, pm b

        But let’s say pm a is a little bit faster than enemy b is there a way for it to change from:

        enemy b, pm c, enemy a, pm b, pm a

        to

        enemy b, pm a, pm c, enemy a, pm b.

        What I mean by random is so that the battle order isn’t always the same through out the battle as shown above.

        Second is their a way to change the gauge to a circle that spins either counter clock wise, or clockwise (clockwise preferably), with the next character’s turn at “12 o’clock”? If I am not making sense, please let me know.

  9. I’m so sad 😦 I really want to use this script but I can’t add Yanfly’s scripts to my game because it crashes with the other battle script I have + I can’t replace my icon set because I’ve already got one that has like 4000 entries. Ahh The sadness.

  10. The Order Gauge seems to be breaking my game. If I go to Guard, it crashes with: “Script ‘Order Gauge’ line 646: NoMethodError occurred. undefined method ‘restore_speed’ for nil:NilClass”

    The scripts I have installed in order are:
    VXAce_SP1
    Victor Engine – Basic
    Victor Engine – Toggle Target
    Yanfly Ace Engine – Ace Battle Engine 1.22
    YSA Battle System: Predicted Charge Turn Battle
    YSA Battle Add-On: Order Battlers
    Victor Engine – Animated Battle
    Victor Engine – Actor Battlers

    Though even with the last 2 disabled, this error still occurs, so I’m sure it’s nothing below the script causing it.

  11. I would really love this script (tried the CBT and ATB scripts but they don’t really fit what I’m going for) but every time I try to go download it the dropbox is still down. I couldn’t find it on the github site by name either. Any other way I can get this script? Please?

    • #==============================================================================
      #
      # ▼ YSA Battle Add-On: Order Battlers
      # — Last Updated: 2012.02.20
      # — Level: Easy
      # — Requires: n/a
      #
      #==============================================================================

      $imported = {} if $imported.nil?
      $imported[“YSA-OrderBattler”] = true

      #==============================================================================
      # ▼ Updates
      # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      # 2012.02.20 – Reduced lag a little.
      # – Hide Gauge when victory.
      # 2012.02.16 – Compatible with: Yami’s PCTB.
      # 2012.01.01 – Bug fixed: No-skill/item issue.
      # 2011.12.28 – Bug fixed: Speed Fix issue.
      # – Groundwork is also made to support future battle system types.
      # – Can show/hide by a switch.
      # 2011.12.27 – Started Script and Finished.
      #
      #==============================================================================
      # ▼ Instructions
      # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      # To install this script, open up your script editor and copy/paste this script
      # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
      #
      # —————————————————————————–
      # Actor Notetags – These notetags go in the actor notebox in the database.
      # —————————————————————————–
      #
      # Change actor’s icon into x.
      #
      #
      # Change icon hue.
      #
      # —————————————————————————–
      # Enemy Notetags – These notetags go in the enemy notebox in the database.
      # —————————————————————————–
      #
      # Change enemy’s icon into x.
      #
      #
      # Change icon hue.
      #
      #==============================================================================
      # ▼ Compatibility
      # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
      # it will run with RPG Maker VX without adjusting.
      #
      #==============================================================================

      module YSA
      module ORDER_GAUGE

      # Default Icon for actor and enemy
      DEFAULT_ENEMY_ICON = 339
      DEFAULT_ACTOR_ICON = 189

      # Order Sprite Visual. Decide Order’s Background and Border.
      BATTLER_ICON_BORDERS = { # Do not remove this.
      # Type => [Back, Border, ],
      :actor => [ 529, 532, ],
      :enemy => [ 536, 537, ],
      } # Do not remove this.

      # Turn this to true if you want to show death battlers.
      # SHOW_DEATH = false

      # Coordinate-X of order gauge
      GAUGE_X = 0
      # Coordinate-Y of order gauge
      GAUGE_Y = 255

      # Show Switch. Turn this switch on to show it. If you want to disable, set this
      # to 0.
      SHOW_SWITCH = 24

      end
      end

      #==============================================================================
      # ▼ Editting anything past this point may potentially result in causing
      # computer damage, incontinence, explosion of user’s head, coma, death, and/or
      # halitosis so edit at your own risk.
      #==============================================================================

      #==============================================================================
      # ■ Regular Expression
      #==============================================================================

      module YSA
      module REGEXP
      module ACTOR

      BATTLER_ICON = //i
      ICON_HUE = //i

      end # ACTOR
      module ENEMY

      BATTLER_ICON = //i
      ICON_HUE = //i

      end # ENEMY
      end # REGEXP
      end # YSA

      #==============================================================================
      # ■ DataManager
      #==============================================================================

      module DataManager

      #————————————————————————–
      # alias method: load_database
      #————————————————————————–
      class <<self; alias load_database_orbt load_database; end
      def self.load_database
      load_database_orbt
      load_notetags_orbt
      end

      #————————————————————————–
      # new method: load_notetags_orbt
      #————————————————————————–
      def self.load_notetags_orbt
      groups = [$data_enemies + $data_actors]
      for group in groups
      for obj in group
      next if obj.nil?
      obj.load_notetags_orbt
      end
      end
      end

      end # DataManager

      #==============================================================================
      # ■ BattleManager
      #==============================================================================

      module BattleManager

      #————————————————————————–
      # public instance variables
      #————————————————————————–
      class <<self
      attr_accessor :action_battlers
      attr_accessor :performed_battlers
      attr_accessor :ctb_battlers
      alias order_gauge_make_action_orders make_action_orders
      end

      #————————————————————————–
      # new method: make_ctb_battler_order
      #————————————————————————–
      def self.make_ctb_battler_order
      @ctb_battlers = []
      if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 2
      battlers = self.sort_battlers
      battlers.each { |battler|
      battler.pctb_speed_cache = battler.pctb_speed
      }
      number = YSA::PCTB::CTB_MECHANIC[:pre_turns]
      i = 0
      while i < number do
      c = add_ctb_battler_order(i)
      i += 1 if c
      end
      return
      end
      ctb_battlers_dummy = self.sort_battlers
      ctb_battlers_dummy.each { |battler|
      @ctb_battlers.push(battler) unless battler.dead?
      }
      end

      #————————————————————————–
      # new method: add_ctb_battler_order
      #————————————————————————–
      def self.add_ctb_battler_order(i)
      battlers = self.sort_battlers(true)
      first_battler = battlers[0]
      tick = first_battler.pctb_ctr(true)
      battlers.each { |battler|
      battler.pctb_speed_cache += tick * battler.real_gain_pctb
      }
      first_battler.reset_pctb_speed(true) if i == 0
      first_battler.pctb_speed_cache -= self.pctb_threshold if i != 0
      return false if first_battler.hidden?
      @ctb_battlers.push(first_battler)
      return true
      end

      #————————————————————————–
      # alias method: make_action_orders
      #————————————————————————–
      def self.make_action_orders
      return if btype?(:pctb)
      order_gauge_make_action_orders
      end

      end # BattleManager

      #==============================================================================
      # ■ RPG::Actor
      #==============================================================================

      class RPG::Actor < RPG::BaseItem

      #————————————————————————–
      # public instance variables
      #————————————————————————–
      attr_accessor :battler_icon
      attr_accessor :icon_hue

      #————————————————————————–
      # common cache: load_notetags_orbt
      #————————————————————————–
      def load_notetags_orbt
      @battler_icon = YSA::ORDER_GAUGE::DEFAULT_ACTOR_ICON
      #—
      self.note.split(/[\r\n]+/).each { |line|
      case line
      #—
      when YSA::REGEXP::ACTOR::BATTLER_ICON
      @battler_icon = $1.to_i
      when YSA::REGEXP::ACTOR::ICON_HUE
      @icon_hue = $1.to_i
      end
      } # self.note.split
      #—
      end

      end # RPG::Actor

      #==============================================================================
      # ■ RPG::Enemy
      #==============================================================================

      class RPG::Enemy < RPG::BaseItem

      #————————————————————————–
      # public instance variables
      #————————————————————————–
      attr_accessor :battler_icon
      attr_accessor :icon_hue

      #————————————————————————–
      # common cache: load_notetags_orbt
      #————————————————————————–
      def load_notetags_orbt
      @battler_icon = YSA::ORDER_GAUGE::DEFAULT_ENEMY_ICON
      #—
      self.note.split(/[\r\n]+/).each { |line|
      case line
      #—
      when YSA::REGEXP::ENEMY::BATTLER_ICON
      @battler_icon = $1.to_i
      when YSA::REGEXP::ENEMY::ICON_HUE
      @icon_hue = $1.to_i
      end
      } # self.note.split
      #—
      end

      end # RPG::Enemy

      #==============================================================================
      # ■ Game_Battler
      #==============================================================================

      class Game_Battler < Game_BattlerBase

      #————————————————————————–
      # new method: battler_icon
      #————————————————————————–
      def battler_icon
      actor? ? actor.battler_icon : enemy.battler_icon
      end

      #————————————————————————–
      # new method: battler_icon_hue
      #————————————————————————–
      def battler_icon_hue
      actor? ? actor.icon_hue : enemy.icon_hue
      end

      end # Game_Battler

      #==============================================================================
      # ■ Sprite_OrderBattler
      #==============================================================================

      class Sprite_OrderBattler self.x
      @move_y = 30
      elsif @move_x < self.x
      @move_y = 16
      else
      @move_y = 20
      end
      self.z = (@move_x = self.x
      self.x += [@move_rate_x, @move_x – self.x].min
      else
      self.x -= [@move_rate_x, – @move_x + self.x].min
      end
      end
      if self.y != @move_y && @move_y
      self.y += (self.y > @move_y) ? -@move_rate_y : @move_rate_y
      end
      if self.x == @move_x && @move_x
      @first_time = false if @first_time
      @move_x = nil
      end
      if self.y == @move_y && @move_y
      @move_y = nil
      end
      end

      #————————————————————————–
      # make_destination
      #————————————————————————–
      def make_destination
      make_dtb_destination if @battle == :dtb
      make_pctb_destination if @battle == :pctb
      make_pctb2_image if @battle == :pctb3
      end

      #————————————————————————–
      # make_dtb_destination
      #————————————————————————–
      def make_dtb_destination
      #—
      BattleManager.performed_battlers = [] if !BattleManager.performed_battlers
      array = BattleManager.performed_battlers.reverse
      action = BattleManager.action_battlers.reverse – BattleManager.performed_battlers.reverse
      array += action
      action.uniq!
      array.uniq!
      #—
      result = []
      for member in array
      next if member.hidden?
      result.push(member) unless member.dead?
      action.delete(member) if member.dead? and !@show_dead
      end
      if @show_dead
      for member in array
      next if member.hidden?
      result.push(member) if member.dead?
      end
      end
      #—
      index = result.index(@battler).to_i
      @move_x = 24 + index * 24
      if BattleManager.in_turn?
      @move_x += 6 if action.include?(@battler)
      @move_x += 6 if (index + 1 == result.size) and action.size > 1
      end
      den = @first_time ? 12 : 24
      @move_rate_x = [((@move_x – self.x)/den).abs, 1].max
      end

      #————————————————————————–
      # make_pctb_destination
      #————————————————————————–
      def make_pctb_destination
      return unless BattleManager.ctb_battlers
      #—
      array = BattleManager.ctb_battlers.reverse
      #—
      result = []
      for member in array
      next if member.hidden?
      result.push(member) unless member.dead?
      end
      if @show_dead
      for member in array
      next if member.hidden?
      result.push(member) if member.dead?
      end
      end
      #—
      index = result.index(@battler).to_i
      @move_x = 24 + index * 24
      den = @first_time ? 12 : 24
      @move_rate_x = [((@move_x – self.x)/den).abs, 1].max
      end

      #————————————————————————–
      # make_pctb2_image
      #————————————————————————–
      def make_pctb2_image
      return unless BattleManager.ctb_battlers
      num = YSA::PCTB::CTB_MECHANIC[:pre_turns] – 1
      array = BattleManager.ctb_battlers
      self.battler = array[@number]
      self.x = 24 + (num – @number) * 24
      end

      end # Sprite_OrderBattler

      #==============================================================================
      # ■ Spriteset_Battle
      #==============================================================================

      class Spriteset_Battle

      #————————————————————————–
      # public instance variables
      #————————————————————————–
      attr_accessor :viewportOrder

      #————————————————————————–
      # alias method: create_viewports
      #————————————————————————–
      alias order_gauge_create_viewports create_viewports
      def create_viewports
      order_gauge_create_viewports
      @viewportOrder = Viewport.new
      @viewportOrder.z = 1000
      if YSA::ORDER_GAUGE::SHOW_SWITCH == 0 || $game_switches[YSA::ORDER_GAUGE::SHOW_SWITCH]
      @viewportOrder.ox = -YSA::ORDER_GAUGE::GAUGE_X
      @viewportOrder.oy = -YSA::ORDER_GAUGE::GAUGE_Y
      else
      @viewportOrder.ox = Graphics.width
      @viewportOrder.oy = Graphics.height
      end
      end

      end # Spriteset_Battle

      #==============================================================================
      # ■ Scene_Battle
      #==============================================================================

      class Scene_Battle < Scene_Base

      #————————————————————————–
      # public instance variables
      #————————————————————————–
      attr_accessor :actor_window
      attr_accessor :enemy_window

      #————————————————————————–
      # alias method: create_all_windows
      #————————————————————————–
      alias order_gauge_create_all_windows create_all_windows
      def create_all_windows
      order_gauge_create_all_windows
      @spriteset_order = []
      if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 1
      @active_order_sprite = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb2)
      end
      if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 2
      num = YSA::PCTB::CTB_MECHANIC[:pre_turns]
      i = 0
      num.times {
      order = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb3, i)
      @spriteset_order.push(order)
      i += 1
      }
      return
      end
      for battler in $game_party.members + $game_troop.members
      battle_type = :dtb
      battle_type = :pctb if BattleManager.btype?(:pctb)
      battle_type = :catb if BattleManager.btype?(:catb)
      order = Sprite_OrderBattler.new(@spriteset.viewportOrder, battler, battle_type)
      @spriteset_order.push(order)
      end
      end

      #————————————————————————–
      # alias method: battle_start
      #————————————————————————–
      alias order_gauge_battle_start battle_start
      def battle_start
      order_gauge_battle_start
      unless BattleManager.btype?(:pctb)
      BattleManager.make_action_orders
      for order in @spriteset_order
      order.make_destination
      end
      end
      end

      #————————————————————————–
      # alias method: dispose_spriteset
      #————————————————————————–
      alias order_gauge_dispose_spriteset dispose_spriteset
      def dispose_spriteset
      for order in @spriteset_order
      order.bitmap.dispose
      order.dispose
      end
      order_gauge_dispose_spriteset
      end

      #————————————————————————–
      # alias method: update_basic
      #————————————————————————–
      alias order_gauge_update_basic update_basic
      def update_basic
      order_gauge_update_basic
      for order in @spriteset_order
      order.update
      end
      @active_order_sprite.update if @active_order_sprite
      if $imported["YSA-PCTB"]
      type = YSA::PCTB::CTB_MECHANIC[:predict]
      end
      if @update_ordergauge
      if type && type == 1
      BattleManager.actor.restore_speed
      BattleManager.actor.storage_speed
      BattleManager.actor.reset_pctb_speed
      end
      BattleManager.make_action_orders
      BattleManager.make_ctb_battler_order if BattleManager.btype?(:pctb)
      for order in @spriteset_order
      order.make_destination
      end
      @update_ordergauge = false
      end
      if YSA::ORDER_GAUGE::SHOW_SWITCH == 0 || $game_switches[YSA::ORDER_GAUGE::SHOW_SWITCH]
      @spriteset.viewportOrder.ox = -YSA::ORDER_GAUGE::GAUGE_X if @spriteset.viewportOrder.ox != -YSA::ORDER_GAUGE::GAUGE_X
      @spriteset.viewportOrder.oy = -YSA::ORDER_GAUGE::GAUGE_Y if @spriteset.viewportOrder.oy != -YSA::ORDER_GAUGE::GAUGE_Y
      else
      @spriteset.viewportOrder.ox = Graphics.height if @spriteset.viewportOrder.ox != Graphics.width
      @spriteset.viewportOrder.oy = Graphics.width if @spriteset.viewportOrder.oy != Graphics.height
      end
      if $game_party.all_dead? || $game_troop.all_dead?
      @spriteset.viewportOrder.ox = Graphics.height if @spriteset.viewportOrder.ox != Graphics.width
      @spriteset.viewportOrder.oy = Graphics.width if @spriteset.viewportOrder.oy != Graphics.height
      end
      end

      #————————————————————————–
      # alias method: update
      #————————————————————————–
      alias order_gauge_update update
      def update
      order_gauge_update
      #return if YSA::PCTB::CTB_MECHANIC[:predict] == 2
      if @actor_command_window.active
      if @actor_command_window.current_symbol == :attack && !BattleManager.actor.input.attack?
      BattleManager.actor.input.set_attack if BattleManager.actor.usable?($data_skills[BattleManager.actor.attack_skill_id])
      @update_ordergauge = true
      end
      if @actor_command_window.current_symbol == :guard && BattleManager.actor.input.item != $data_skills[BattleManager.actor.guard_skill_id]
      BattleManager.actor.input.set_guard if BattleManager.actor.usable?($data_skills[BattleManager.actor.guard_skill_id])
      @update_ordergauge = true
      end
      if $imported["YEA-BattleCommandList"]
      if @actor_command_window.current_symbol == :use_skill && BattleManager.actor.input.item != $data_skills[@actor_command_window.current_ext]
      BattleManager.actor.input.set_skill(@actor_command_window.current_ext) if BattleManager.actor.usable?($data_skills[@actor_command_window.current_ext])
      @update_ordergauge = true
      end
      end
      end
      if @skill_window.active && BattleManager.actor && BattleManager.actor.input.item != @skill_window.item && @skill_window.current_item_enabled?
      BattleManager.actor.input.set_skill(@skill_window.item.id) if BattleManager.actor.usable?(@skill_window.item)
      @update_ordergauge = true
      end
      if @item_window.active && BattleManager.actor && BattleManager.actor.input.item != @item_window.item && @item_window.current_item_enabled?
      BattleManager.actor.input.set_item(@item_window.item.id) if BattleManager.actor.usable?(@item_window.item)
      @update_ordergauge = true
      end
      end

      #————————————————————————–
      # alias method: on_skill_cancel
      #————————————————————————–
      alias order_gauge_on_skill_cancel on_skill_cancel
      def on_skill_cancel
      order_gauge_on_skill_cancel
      BattleManager.actor.input.clear
      @update_ordergauge = true
      end

      #————————————————————————–
      # alias method: on_item_cancel
      #————————————————————————–
      alias order_gauge_on_item_cancel on_item_cancel
      def on_item_cancel
      order_gauge_on_item_cancel
      BattleManager.actor.input.clear
      @update_ordergauge = true
      end

      #————————————————————————–
      # alias method: turn_start
      #————————————————————————–
      alias order_gauge_turn_start turn_start
      def turn_start
      order_gauge_turn_start
      for order in @spriteset_order
      order.make_destination
      end
      end

      #————————————————————————–
      # alias method: process_action_end
      #————————————————————————–
      alias order_gauge_process_action_end process_action_end
      def process_action_end
      order_gauge_process_action_end
      for order in @spriteset_order
      order.make_destination
      end
      end

      end # Scene_Battle

      #==============================================================================
      #
      # ▼ End of File
      #
      #==============================================================================

Leave a comment