YSA Battle Add-On: Order Battlers bug

Status
Not open for further replies.

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,310
Reaction score
812
First Language
English
Hello! So, I am trying to use the "charge turn battle" order script, which shows you the turn order for characters and enemies. The problem is, there seems to be some kind of icon overlap? I attached a screenshot to show you what I mean.

I don't want that little diamond or mushroom thingy there, just the icons below them. I've done nothing but add the script to my script list, so I don't know what to do to fix it. (Ex: I haven't used any of the class/character note tags, and even when I do, the problem persists.

waaaaah.png

#==============================================================================
#
# ¥ YSA Battle Add-On: Order Battlers
# -- Last Updated: 2012.01.27
# -- Level: Easy
# -- Requires:
# + Yanfly Engine Ace - Ace Core Engine
# + Yanfly Engine Ace - Ace Battle Engine
#
#==============================================================================

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

#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.27 - Compatible with: Yami's CTB.
# 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/‘fÞ but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actor notebox in the database.
# -----------------------------------------------------------------------------
# <battler icon: x>
# Change actor's icon into x.
#
# <icon hue: x>
# Change icon hue.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemy notebox in the database.
# -----------------------------------------------------------------------------
# <battler icon: x>
# Change enemy's icon into x.
#
# <icon hue: 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 => [ 528, 532, ],
:enemy => [ 529, 533, ],
} # 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 = 24

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

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

if $imported["YEA-CoreEngine"] && $imported["YEA-BattleEngine"]

#==============================================================================
# ¡ Regular Expression
#==============================================================================

module YSA
module REGEXP
module ACTOR

BATTLER_ICON = /<(?:BATTLER_ICON|battler icon):[ ](\d+)?>/i
ICON_HUE = /<(?:ICON_HUE|icon hue):[ ](\d+)?>/i

end # ACTOR
module ENEMY

BATTLER_ICON = /<(?:BATTLER_ICON|battler icon):[ ](\d+)?>/i
ICON_HUE = /<(?:ICON_HUE|icon hue):[ ](\d+)?>/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
#--------------------------------------------------------------------------
class <<self
def make_ctb_battler_order
ctb_battlers_dummy = $game_party.members + $game_troop.members
active_battlers_dummy = self.action_list_ctb
ctb_battlers_dummy -= active_battlers_dummy
ctb_battlers_dummy.sort! { |a,b|
if a.yctb_remaining_tick != b.yctb_remaining_tick
a.yctb_remaining_tick <=> b.yctb_remaining_tick
elsif a.agi != b.agi
b.agi <=> a.agi
else
a.name <=> b.name
end
}
active_battlers_dummy.sort! { |a,b|
if a.yctb_value != b.yctb_value
b.yctb_value <=> a.yctb_value
elsif a.agi != b.agi
b.agi <=> a.agi
else
a.name <=> b.name
end
}
@ctb_battlers = active_battlers_dummy + ctb_battlers_dummy
end
end

#--------------------------------------------------------------------------
# alias method: make_action_orders
#--------------------------------------------------------------------------
def self.make_action_orders
order_gauge_make_action_orders
make_ctb_battler_order if btype?:)yctb)
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 < Sprite_Base

#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(viewport, battler, battle = :dtb)
super(viewport)
@battler = battler
@battle = battle
@move_rate_x = 1
@move_rate_y = 1
@move_x = nil
@move_y = nil
@first_time = true
@update_wait = 0
@show_dead = YSA::oRDER_GAUGE::SHOW_DEATH
create_battler_bitmap
end

#--------------------------------------------------------------------------
# create_battler_bitmap
#--------------------------------------------------------------------------
def create_battler_bitmap
create_dtb_style if @battle == :dtb || @battle == :yctb
end

#--------------------------------------------------------------------------
# create_dtb_style
#--------------------------------------------------------------------------
def create_dtb_style
bitmap = Bitmap.new(24, 24)
icon_bitmap = $game_temp.iconset
#--- Create Battler Background ---
icon_index = @battler.actor? ? YSA::oRDER_GAUGE::BATTLER_ICON_BORDERS[:actor][0] : YSA::oRDER_GAUGE::BATTLER_ICON_BORDERS[:enemy][0]
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
bitmap.blt(0, 0, icon_bitmap, rect)
#--- Create Battler Icon ---
icon_index = @battler.battler_icon
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
temp_bitmap = Bitmap.new(24, 24)
temp_bitmap.blt(0, 0, icon_bitmap, rect)
temp_bitmap.hue_change(@battler.battler_icon_hue) if @battler.battler_icon_hue
bitmap.blt(0, 0, temp_bitmap, Rect.new(0, 0, 24, 24))
temp_bitmap.dispose
#--- Create Battler Border ---
icon_index = @battler.actor? ? YSA::oRDER_GAUGE::BATTLER_ICON_BORDERS[:actor][1] : YSA::oRDER_GAUGE::BATTLER_ICON_BORDERS[:enemy][1]
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
bitmap.blt(0, 0, icon_bitmap, rect)
#---
self.bitmap.dispose if self.bitmap != nil
self.bitmap = bitmap
return if @created_icon
@created_icon = true
self.ox = 12; self.oy = 12
self.x = 24
self.y = 24
self.z = 8000
end

#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
return unless SceneManager.scene_is?(Scene_Battle)
#---
update_dtb_style if @battle == :dtb || @battle == :yctb
self.opacity = 0 if @battle == :catb
end

#--------------------------------------------------------------------------
# update_dtb_style
#--------------------------------------------------------------------------
def update_dtb_style
#---
actor_window = SceneManager.scene.actor_window
enemy_window = SceneManager.scene.enemy_window
if actor_window.active
if $game_party.members[actor_window.index] == @battler
@move_y = 12
else
@move_y = 24
end
end
if enemy_window.active
if $game_troop.members[enemy_window.index] == @battler
@move_y = 12
else
@move_y = 24
end
end
if !actor_window.active && !enemy_window.active
@move_y = 24
end
#---
return if !@move_x && !@move_y
if @battler.hidden? || (!@show_dead && @battler.dead?)
@move_x = -24 if self.x > -24
@move_rate_x = 12
end
if self.x != @move_x && @move_x
if @move_x > self.x
@move_y = 30
elsif @move_x < self.x
@move_y = 16
else
@move_y = 20
end
self.z = (@move_x < self.x) ? 7500 : 8500
if @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_yctb_destination if @battle == :yctb
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_yctb_destination
#--------------------------------------------------------------------------
def make_yctb_destination
BattleManager.make_ctb_battler_order
#---
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

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 = []
for battler in $game_party.members + $game_troop.members
battle_type = :dtb
battle_type = :yctb if BattleManager.btype?:)yctb)
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
BattleManager.make_action_orders
for order in @spriteset_order
order.make_destination
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
if @update_ordergauge
BattleManager.make_action_orders
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
if @spriteset.viewportOrder.oy <= @help_window.y + @help_window.height
@spriteset.viewportOrder.oy = -(@help_window.y + @help_window.height) if @help_window.visible
end
else
@spriteset.viewportOrder.ox = Graphics.height if @spriteset.viewportOrder.ox != Graphics.width
@spriteset.viewportOrder.oy = Graphics.width if @spriteset.viewportOrder.oy != Graphics.height
end
@spriteset.viewportOrder.oy = Graphics.height if $game_troop.all_dead? || $game_party.all_dead?
end

#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias order_gauge_update update
def update
order_gauge_update
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 # $imported

#==============================================================================
#
# ¥ End of File
#
#==============================================================================
 

lemongreen

Veteran
Veteran
Joined
Jul 16, 2013
Messages
230
Reaction score
258
First Language
English
Primarily Uses
Okay, first of all, did you remember to change the default icons? (it should be around line numbers 59-61 in the editor since you said you didn't change anything) These are controlled by your iconsheet, so that might be why it's messing up if you haven't (since I believe yami supplies an iconsheet so it can work unless a person wants to use their own) 

You have to remember, not every script is going to work by just pasting it in; most are left up to be customized before you use them.
 
Last edited by a moderator:

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,310
Reaction score
812
First Language
English
Yeah, I tried changing those around a bit to see what would happen, and though they would change appropriately, that top layer of icons would stay there regardless. D:
 

lemongreen

Veteran
Veteran
Joined
Jul 16, 2013
Messages
230
Reaction score
258
First Language
English
Primarily Uses
Are you sure it's not the border layer of the batter icons? (just so you know, I've been messing around with it a bit myself for the past few minutes and I could see how something like that could be forgotten; it's the second row of icon IDs listed between line numbers 63-68; just change it to a blank ID and it should be fine)
 

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,310
Reaction score
812
First Language
English
You were absolutely right, it was those blasted borders lol...thank you!
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
14,709
Reaction score
14,547
First Language
Filipino
Primarily Uses
VNM
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.

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

Latest Threads

Latest Profile Posts

As for the Coronavirus? Well: "People that spend their life avoiding death are already dead (they're also rich, and I like to spend my life with their money.)"
- R. Sanchez, "Edge of Tomorty: Rick, Die, Repeat"
making pierogi and corrupting my game files wbu
Trying to regain my will to work on maps T_T
I miss working in rpgmaker but I can only do one thing at a time. Maybe after drawing lessons I can come back.
Ever have a day like... you play minesweeper and your very first click is always a mine?

Forum statistics

Threads
94,340
Messages
920,073
Members
124,100
Latest member
Vulgourso
Top