[SOLVED] Yami Order Battlers Strange Escape Bug + Vertical Gauge?

Status
Not open for further replies.

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,124
Reaction score
1,107
First Language
English
Primarily Uses
RMVXA
Got the top 8 showing. Now to just figure out why the order doesn't match
Almost had it. in your clean project it is a bit off.

Inspecting the order glitch - I see that the original script is not correct.
I removed everything I made and it still does not show the correct icon when selecting the enemy.
So it's not me. The script does not align the correct battler to the icon shown.
*tested PCTB option and it worked fine.
 
Last edited:

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
Got the top 8 showing. Now to just figure out why the order doesn't match
Almost had it. in your clean project it is a bit off.

Inspecting the order glitch - I see that the original script is not correct.
I removed everything I made and it still does not show the correct icon when selecting the enemy.
So it's not me. The script does not align the correct battler to the icon shown.
*tested PCTB option and it worked fine.

What do you mean PCTB order?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,124
Reaction score
1,107
First Language
English
Primarily Uses
RMVXA
Its the one you didn't want right from the start.
That's why I wrote the extra scripts. You don't want PCTB you want DTB.
When I tested the PCTB in default horizontal mode, it work perfectly.
When I tested DTB in horizontal it did not. Probably a fault in the script since PCTB tells you who is next and you do the action for that actor. It doesn't move the icons for selecting the enemy.
But the DTB does move the icons, and it's not aligning.

What I'm seeing is that the attack order right now in my test is correct for the icons, but the enemy selection is not correct. When you choose to attack the bat, the icon for the slime move out. When you select the rat the bat move out. The enemy window is not getting passed to the battle order to tell it what icon to highlight when selecting the enemy (or actor).

I would like to figure this out as much as you, but it's making me go in circles looking for where the data is not correct.
 

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
Its the one you didn't want right from the start.
That's why I wrote the extra scripts. You don't want PCTB you want DTB.
When I tested the PCTB in default horizontal mode, it work perfectly.
When I tested DTB in horizontal it did not. Probably a fault in the script since PCTB tells you who is next and you do the action for that actor. It doesn't move the icons for selecting the enemy.
But the DTB does move the icons, and it's not aligning.

What I'm seeing is that the attack order right now in my test is correct for the icons, but the enemy selection is not correct. When you choose to attack the bat, the icon for the slime move out. When you select the rat the bat move out. The enemy window is not getting passed to the battle order to tell it what icon to highlight when selecting the enemy (or actor).

I would like to figure this out as much as you, but it's making me go in circles looking for where the data is not correct.

Well after some inspection it's not that the icons are wrong. It's just that it's displaying the icons we can't see past the border.

They're still counted even when they're invisible, because killing 3 bats to lower the icon count back to 8 makes it display normally.

(For reference this is with my code and not your I > 7 array code)
 
Last edited:

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
I... have come up with a way to turn it on and off!

if self.y > 27 && $game_switches[980] == false
self.opacity = 255 unless @battler.hidden? || (!@show_dead && @battler.dead?)
@first_time = true
else
self.opacity = -255
@update_ordergauge = true
end

-

next if i <= 2 unless $game_switches[980] == true
next if i > 7 unless $game_switches[980] == false

So what this is:

If this switch is on, it will cut the extra icons if there are more than 8 battlers, leaving only the top eight visible since reversing the original array did that for some reason.

If it's off, then it will display like normal for fights with less than 8 battlers.

Tweaking my code is proving that it is possible for 8+ battlers to properly work, but I haven't gotten it down pat. The icons work at turn 0 and they update when the turn actually starts, but they stay glitched and weird when you choose actions. Likely because they just stack on each other and don't actually move forward.
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,124
Reaction score
1,107
First Language
English
Primarily Uses
RMVXA
I took part of what you did and combined it with mine.

I got the selecting the correct icons working, but now I actual realize that the order is incorrect.
Working on it.

Do you have the icons showing the correct order?

I've tried putting this into my project and only had to make one small adjustment.
I was surprised. I use Victor Sant Animated Battlers and it still worked.
Now to decide if I want to use it.
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,124
Reaction score
1,107
First Language
English
Primarily Uses
RMVXA
@RCXDan
Thy these in your project.
Ruby:
# if you get an error under Order Battlers Line 677 put a # there

# if @actor_command_window.current_symbol == :attack #&& !BattleManager.actor.input.attack?
# Order patch by Roninator2

module R2_Turn_Gauge_Display
  SWITCH = 10
end

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Enemy Appear
  #--------------------------------------------------------------------------
  def command_335
    iterate_enemy_index(@params[0]) do |enemy|
      enemy.appear
      $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
      $game_troop.make_unique_names
    end
  end
  #--------------------------------------------------------------------------
  # * Enemy Transform
  #--------------------------------------------------------------------------
  def command_336
    iterate_enemy_index(@params[0]) do |enemy|
      enemy.transform(@params[1])
      $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
      $game_troop.make_unique_names
    end
  end
end
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # new method: update spriteset
  #--------------------------------------------------------------------------
  def update_spriteset_order
    @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: update
  #--------------------------------------------------------------------------
  alias update_order_guage update
  def update
    update_spriteset_order if $game_switches[R2_Turn_Gauge_Display::SWITCH] == true
    $game_switches[R2_Turn_Gauge_Display::SWITCH] = false
    update_order_guage
  end
end
class Game_Battler < Game_BattlerBase
  alias r2_enemy_revive_order_gauge   revive
  def revive
    r2_enemy_revive_order_gauge
    $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
  end
end
*updated
Ruby:
class Sprite_OrderBattler < Sprite_Base
  def update_dtb_style
    #---
    actor_window = SceneManager.scene.actor_window
    enemy_window = SceneManager.scene.enemy_window
    if actor_window.active
      battler = actor_window.actor
      if battler == @battler
        @move_x = 36
      else
        @move_x = 24
      end
    end
    if enemy_window.active
      battler = enemy_window.enemy
      if battler == @battler
        @move_x = 36
      else
        @move_x = 24
      end
    end
    if !actor_window.active && !enemy_window.active
      @move_x = 24
    end
    #---
    return if !@move_x && !@move_y
    if @battler.hidden? || (!@show_dead && @battler.dead?)
      self.opacity = -20
    end
    if self.y != @move_y && @move_y
      if @move_y > self.y
        @move_x = 16
      elsif @move_y < self.y
        @move_x = 34
      else
        @move_x = 20
      end
      self.z = (@move_y < self.y) ? 7500 : 8500
      if @move_y >= self.y
        self.y += [@move_rate_y, @move_y - self.y].min
      else
        self.y -= [@move_rate_y, - @move_y + self.y].min
      end
    end
    if self.x != @move_x && @move_x
      self.x += (self.x > @move_x) ? -@move_rate_x : @move_rate_x
    end
    if self.y == @move_y && @move_y
      @first_time = false if @first_time
      @move_y = nil
    end
    if self.x == @move_x && @move_x
      @move_x = nil
    end
  end
 
  alias r2_update_opacity update
  def update
    r2_update_opacity
    self.opacity = 0 if self.y < 0
    self.opacity = 255 if self.y >= 0
  end
 
  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
    #---
    limit = result.size
    move_limit = limit - 7
    index = result.index(@battler).to_i
    index = index - move_limit if limit > 8
    index = -4 if @battler.dead?
    index = -4 if @battler.hidden?
    @move_y = 24 + index * 24
    if BattleManager.in_turn?
      @move_y += 6 if action.include?(@battler)
      @move_y += 6 if (index + 1 == result.size) and action.size > 1
    end
    den = @first_time ? 12 : 24
    @move_rate_y = [((@move_y - self.y)/den).abs, 1].max
  end
 
end
class Scene_Battle < Scene_Base
  alias order_gauge_party_update update
  def update
    order_gauge_party_update
    if @party_command_window.active
      @update_ordergauge = true
    end
  end
end
 
Last edited:

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
@RCXDan
Thy these in your project.
Ruby:
# if you get an error under Order Battlers Line 677 put a # there

# if @actor_command_window.current_symbol == :attack #&& !BattleManager.actor.input.attack?
# Order patch by Roninator2

module R2_Turn_Gauge_Display
  SWITCH = 10
end

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Enemy Appear
  #--------------------------------------------------------------------------
  def command_335
    iterate_enemy_index(@params[0]) do |enemy|
      enemy.appear
      $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
      $game_troop.make_unique_names
    end
  end
  #--------------------------------------------------------------------------
  # * Enemy Transform
  #--------------------------------------------------------------------------
  def command_336
    iterate_enemy_index(@params[0]) do |enemy|
      enemy.transform(@params[1])
      $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
      $game_troop.make_unique_names
    end
  end
end
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # new method: update spriteset
  #--------------------------------------------------------------------------
  def update_spriteset_order
    @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: update
  #--------------------------------------------------------------------------
  alias update_order_guage update
  def update
    update_spriteset_order if $game_switches[R2_Turn_Gauge_Display::SWITCH] == true
    $game_switches[R2_Turn_Gauge_Display::SWITCH] = false
    update_order_guage
  end
end
class Game_Battler < Game_BattlerBase
  alias r2_enemy_revive_order_gauge   revive
  def revive
    r2_enemy_revive_order_gauge
    $game_switches[R2_Turn_Gauge_Display::SWITCH] = true
  end
end
*updated
Ruby:
class Sprite_OrderBattler < Sprite_Base
  def update_dtb_style
    #---
    actor_window = SceneManager.scene.actor_window
    enemy_window = SceneManager.scene.enemy_window
    if actor_window.active
      battler = actor_window.actor
      if battler == @battler
        @move_x = 36
      else
        @move_x = 24
      end
    end
    if enemy_window.active
      battler = enemy_window.enemy
      if battler == @battler
        @move_x = 36
      else
        @move_x = 24
      end
    end
    if !actor_window.active && !enemy_window.active
      @move_x = 24
    end
    #---
    return if !@move_x && !@move_y
    if @battler.hidden? || (!@show_dead && @battler.dead?)
      self.opacity = -20
    end
    if self.y != @move_y && @move_y
      if @move_y > self.y
        @move_x = 16
      elsif @move_y < self.y
        @move_x = 34
      else
        @move_x = 20
      end
      self.z = (@move_y < self.y) ? 7500 : 8500
      if @move_y >= self.y
        self.y += [@move_rate_y, @move_y - self.y].min
      else
        self.y -= [@move_rate_y, - @move_y + self.y].min
      end
    end
    if self.x != @move_x && @move_x
      self.x += (self.x > @move_x) ? -@move_rate_x : @move_rate_x
    end
    if self.y == @move_y && @move_y
      @first_time = false if @first_time
      @move_y = nil
    end
    if self.x == @move_x && @move_x
      @move_x = nil
    end
  end
 
  alias r2_update_opacity update
  def update
    r2_update_opacity
    self.opacity = 0 if self.y < 0
    self.opacity = 255 if self.y >= 0
  end
 
  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
    #---
    limit = result.size
    move_limit = limit - 7
    index = result.index(@battler).to_i
    index = index - move_limit if limit > 8
    index = -4 if @battler.dead?
    index = -4 if @battler.hidden?
    @move_y = 24 + index * 24
    if BattleManager.in_turn?
      @move_y += 6 if action.include?(@battler)
      @move_y += 6 if (index + 1 == result.size) and action.size > 1
    end
    den = @first_time ? 12 : 24
    @move_rate_y = [((@move_y - self.y)/den).abs, 1].max
  end
 
end
class Scene_Battle < Scene_Base
  alias order_gauge_party_update update
  def update
    order_gauge_party_update
    if @party_command_window.active
      @update_ordergauge = true
    end
  end
end

Holy hell I think we've finally cracked it. Testing proves that it does in fact work!

@Roninator2 I can't really thank you enough for this. This was pretty much all I needed.. I'm sorry for putting you through the wringer though, like yikes. :kaoswt2:

I'll definitely keep you (and Trihan for something else) in mind for when my games go commercial or something similarly momentous since you guys have pulled me out of some terrible spots.
 

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
I'm bringing this thread back up because of something important. It is not anything bug-related - Roninator's script has worked perfectly fine since that last post, and has served me well.

What I'm trying to work out is if I could attach:

2BMDvRG.png


This vertical bar visual I made to the Order Battlers script, as well as being able to customize its X and Y screen coordinates and attaching its visibility to the same switch that turns on/off the icons. I've tried to do it myself, but nothing's really hashed out.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,124
Reaction score
1,107
First Language
English
Primarily Uses
RMVXA
Ruby:
module R2_SideBar_Gauge_Image
  POS_X = 0
  POS_Y = 50
  Graphic = "Sidebar"
end
class Scene_Battle < Scene_Base

  alias r2_order_gauge_create_graphic create_all_windows
  def create_all_windows
    r2_order_gauge_create_graphic
    @sidebar_gauge = Sprite.new
    @sidebar_gauge.bitmap = Cache.system(R2_SideBar_Gauge_Image::Graphic)
    @sidebar_gauge.opacity = 0
    @sidebar_gauge.x = R2_SideBar_Gauge_Image::POS_X
    @sidebar_gauge.y = R2_SideBar_Gauge_Image::POS_Y
    @sidebar_gauge.z = 100
    if $game_switches[YSA::ORDER_GAUGE::SHOW_SWITCH] == true
      @sidebar_gauge.opacity = 255
    end
  end
  alias r2_order_gauge_graphics_update update
  def update
    r2_order_gauge_graphics_update
    if $game_switches[YSA::ORDER_GAUGE::SHOW_SWITCH] == true
      @sidebar_gauge.opacity = 255
    else
      @sidebar_gauge.opacity = 0
    end
  end
  alias r2_order_gauge_dispose_all dispose_spriteset
  def dispose_spriteset
    for order in @spriteset_order
      order.bitmap.dispose
      order.dispose
    end
    @sidebar_gauge.bitmap.dispose
    @sidebar_gauge.dispose
    r2_order_gauge_dispose_all
  end
end
 
Last edited:

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
@Roninator2 Thanks so much. :kaoluv:

That should be it regarding anything I want from this script, so I feel we can safely say this thread is solved.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,694
Reaction score
6,161
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!

Forum statistics

Threads
123,021
Messages
1,153,445
Members
161,363
Latest member
jereDev
Top