Issues with Yami's PCTB

salutations! ^^ i'm still rather new to using VX Ace and i'm in the process of attempting to cobble a battle system together perhaps maybe vaguely resembling Yanfly's Standard Turn Battle for MV.
one of my leads currently is Yami's Predicted Charge Turn Battle script because it might have the increased customization options (and mechanical clarity, nobody EVER told me what the hell is a clocktick, sob) i need.
...except this horrible error is ruining my perfectly good night!
Screenshot 2026-06-06 014146.png

i rifled through the ruby documentation for a bit and while I did learn useful terminology it wasn't very much help in terms of trying to fix this myself because of my lack of experience. forgive me if this is a common error haha
Spoiler
Screenshot 2026-06-06 015732.png
here's my scriptlist in case there's something i'm missing (or just screwing up.) it was difficult hunting the PCTB script down so if there's an updated version I'm not aware of please do enlighten me!
I hold onto my small shining beacon of hope that what i'm trying to achieve is possible without needing to switch RPGMaker versions because of THIS one-off thread post.
Spoiler
Screenshot 2026-06-06 010937.png
they don't have any linked socials i could dredge up from a quick glance at their profile so I can't reach out to them for their patched version of the PCTB script. guidance concerning the error (or how to deal with CTB scripts in general) would be greatly appreciated, and thank you for your time qwq
I'd like to help, but I'm confused by your scripts.

Is it Yami CATB script? I don't know of a Yami CTB script.
YSA Battle System: Classical ATB

Yami CTB Order Gauge should be YSA Battle Add-On: Order Battlers

So I just want you to be specific on what scripts you have so that I can reproduce the issue.
Unless you want to send me a PM with a demo.
sorry for the confusion regarding the scripts i'm using. I had a feeling something like this would happen ahaha
i'm a complete noob so your input considering the authorship is more credible than mine. these are just the names i think i found them under.

i wonder if "Yami Engine Symphony" and "YSA Battle System" are interchangable because the 'Yami PCTB' script is a YSA Battle System script but was under the Yami name.
as for sending you a demo I would love to if you would indulge me. the problem is that if there is a PM function on this website i.. haven't been able to find it so please do tell how. sob. i hope my ineptitude isn't an issue and thank you for the response

Spoiler: "Yami CTB"
#==============================================================================
#
# ▼ Yami Engine Symphony - Battle Mechanism
# -- Type: Charge Turn Battle
# -- Last Updated: 2012.11.01
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YES-BattleCTB"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.11.01 - Bugfix for Instant-abusing.
# 2012.07.30 - Bugfix for Large Party.
# 2012.07.04 - Finished Script.
# 2012.06.22 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides battle mechanism Charge Turn Battle (CT😎. CTB is a
# version of ATB, which we don't have to wait time to fill up ATB Gauge.
#
#==============================================================================
# ▼ 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.
#
# To change Battle Mechanism to CTB, use have to change DEFAULT_BATTLE_TYPE
# in Battle Control to :ctb or use script call ingame:
# BattleControl.change_btype🙂ctb)
#
#==============================================================================
# ▼ 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.
# This script may not be compatible with other battle scripts. It is highly
# recommended putting this script above all other battle scripts, except YEA -
# Ace Battle Engine and other scripts that Author recommends putting above this.
#
#==============================================================================

module YES
module CTB

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Mechanism Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the threshold mechanism which related
# to battlers' actions and turn counting.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
THRESHOLD_SETTINGS = { # Start.
:dynamic => false, # Enable Dynamic Threshold.
😮ffset => 400, # Default Threshold.
# End here if :dynamic is set to false.
:agi_multiplier => 1, # Add multiply of Agility to Threshold.
} # End.

TURN_SETTING = { # Start.
:type => :actions, # :tick for clockticks turn counting.
# :action for actions turn counting.
# Manage turn length.
:turn_ctr => 32, # Clockticks per turn.
:turn_action => 1, # Actions per turn.
# Common Events Options.
:end_turn => 12, # Common Event run when Turn End.
:end_action => 13, # Common Event run when End Action.
} # End.

START_SETTING = { # Start.
😛reemptive => 0.5, # Clockticks filled if preemptive.
:surprise => 0.0, # Clockticks filled if surprise.
:normal => 0.2, # Clockticks filled normal.
} # End.

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Skills Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the skills which related to Agility and
# Turn Counting.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SKILLS_SETTING = { # Start.
:max_speed_fix => 1000000, # Max Speed fix for Skills.
:min_speed_fix => -100000, # Min Speed fix for Skills.
:limit_instant => 1, # After X instant actions, Clockticks of
# that battler will be reset.
} # End.

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

#==============================================================================
# ■ BattleControl
#==============================================================================

module BattleControl

#--------------------------------------------------------------------------
# CTB Clockticks
#--------------------------------------------------------------------------
@ctb_ct = Hash.new()
@ctb_limit_instant = Hash.new()
@ctb_temp_ct = Hash.new()

#--------------------------------------------------------------------------
# alias method: setup_battle
#--------------------------------------------------------------------------
class <<self; alias ctb_setup_battle setup_battle; end
def self.setup_battle
ctb_setup_battle
setup_ctb if battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: turn_end?
#--------------------------------------------------------------------------
class <<self; alias ctb_turn_end? turn_end?; end
def self.turn_end?
return ctb_turn_end? unless battle_type == :ctb
return turn_end_ctb? if battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
class <<self; alias ctb_turn_end turn_end; end
def self.turn_end
ctb_turn_end unless battle_type == :ctb
turn_end_ctb if battle_type == :ctb
end

#--------------------------------------------------------------------------
# new method: turn_end_ctb?
#--------------------------------------------------------------------------
def self.turn_end_ctb?
case YES::CTB::TURN_SETTING[:type]
when :tick
@counting >= YES::CTB::TURN_SETTING[:turn_ctr]
when :action
@counting >= YES::CTB::TURN_SETTING[:turn_action]
end
end

#--------------------------------------------------------------------------
# new method: turn_end_ctb?
#--------------------------------------------------------------------------
def self.turn_end_ctb
case YES::CTB::TURN_SETTING[:type]
when :tick
@counting -= YES::CTB::TURN_SETTING[:turn_ctr]
when :action
@counting -= YES::CTB::TURN_SETTING[:turn_action]
end
#---
common_event_id = YES::CTB::TURN_SETTING[:end_turn]
return if $data_common_events[common_event_id].nil?
$game_temp.reserve_common_event(common_event_id)
end

#--------------------------------------------------------------------------
# new method: setup_ctb
#--------------------------------------------------------------------------
def self.setup_ctb
@ctb_ct.clear
@ctb_temp_ct.clear
@ctb_limit_instant.clear
#---
@threshold = 0
@counting = 0
#---
ctb_init_threshold
ctb_init_ct
end

#--------------------------------------------------------------------------
# new method: ctb_init_threshold
#--------------------------------------------------------------------------
def self.ctb_init_threshold
@threshold = YES::CTB::THRESHOLD_SETTINGS[😮ffset]
return unless YES::CTB::THRESHOLD_SETTINGS[:dynamic]
rate = YES::CTB::THRESHOLD_SETTINGS[:agi_multiplier]
@battlers.each { |battler| @threshold += battler.agi * rate }
end

#--------------------------------------------------------------------------
# new method: ctb_init_ct
#--------------------------------------------------------------------------
def self.ctb_init_ct
@battlers.each { |battler|
rate = YES::CTB::START_SETTING[:normal]
case BattleManager.encounter_flag
when 1
rate = YES::CTB::START_SETTING[😛reemptive] if battler.actor?
when 2
rate = YES::CTB::START_SETTING[:surprise] if battler.actor?
end
@ctb_ct[battler.name] = rate * @threshold
}
end

#--------------------------------------------------------------------------
# new method: ctb_temp_evaluate
#--------------------------------------------------------------------------
def self.ctb_temp_evaluate(battler, skill)
@ctb_temp_ct[battler.name] = ctb_evaluate_ct(battler, skill)
end

#--------------------------------------------------------------------------
# new method: ctb_clear_temp
#--------------------------------------------------------------------------
def self.ctb_clear_temp(battler)
@ctb_temp_ct.delete(battler.name)
end

#--------------------------------------------------------------------------
# new method: ctb_check_temp
#--------------------------------------------------------------------------
def self.ctb_check_temp(battler, check)
return @ctb_temp_ct[battler.name] == check
end

#--------------------------------------------------------------------------
# new method: ctb_evaluate_ct
#--------------------------------------------------------------------------
def self.ctb_evaluate_ct(battler, skill)
return @threshold if skill.nil?
limit = YES::CTB::SKILLS_SETTING[:limit_instant]
count_limit = @ctb_limit_instant[battler.name]
return @threshold if !count_limit.nil? && count_limit >= limit
evaluate = @threshold
max = YES::CTB::SKILLS_SETTING[:max_speed_fix]
min = YES::CTB::SKILLS_SETTING[:min_speed_fix]
rate = skill.speed >= 0 ? [skill.speed, max].min : [skill.speed, min].max
rate = 100 - rate
evaluate = evaluate * rate.to_f / 100
evaluate.round
end

#--------------------------------------------------------------------------
# new method: ctb_evaluate_action
#--------------------------------------------------------------------------
def self.ctb_evaluate_action(battler, skill)
evaluate = ctb_evaluate_ct(battler, skill)
#---
@ctb_limit_instant[battler.name] ||= 0
limit = YES::CTB::SKILLS_SETTING[:limit_instant]
if @ctb_limit_instant[battler.name] >= limit
evaluate = ctb_evaluate_ct(battler, nil)
@ctb_limit_instant[battler.name] = 0
end
if evaluate <= 0
@ctb_limit_instant[battler.name] += 1
else
# Fix Instant-abuse
#@ctb_limit_instant[battler.name] = 0
end
#---
@ctb_ct[battler.name] -= evaluate
#---
ctb_clear_temp(battler)
if YES::CTB::TURN_SETTING[:type] == :action; @counting += 1; end
#---
common_event_id = YES::CTB::TURN_SETTING[:end_action]
return if $data_common_events[common_event_id].nil?
$game_temp.reserve_common_event(common_event_id)
end

#--------------------------------------------------------------------------
# new method: ctb_add_ct
#--------------------------------------------------------------------------
def self.ctb_add_ct
while ctb_active_battlers.size == 0
@battlers.each { |battler|
next unless battler.movable?
@ctb_ct[battler.name] ||= 0
@ctb_ct[battler.name] += battler.agi
}
if YES::CTB::TURN_SETTING[:type] == :tick; @counting += 1; end
end
end

#--------------------------------------------------------------------------
# new method: ctb_active_battlers
#--------------------------------------------------------------------------
def self.ctb_active_battlers
result = []
@battlers.each { |battler|
next unless battler.movable?
result.push(battler) if @ctb_ct[battler.name] >= @threshold
}
result.sort! { |a, b|
if @ctb_ct[b.name] != @ctb_ct[a.name]
@ctb_ct[b.name] <=> @ctb_ct[a.name]
else
a.screen_x <=> b.screen_x
end
}
end

#--------------------------------------------------------------------------
# new method: counting
#--------------------------------------------------------------------------
def self.counting
@counting
end

#--------------------------------------------------------------------------
# new method: ctb_fix_ct
#--------------------------------------------------------------------------
def self.ctb_fix_ct
($game_party.battle_members + $game_troop.members).each { |battler|
@ctb_ct[battler.name] ||= 0 }
end

#--------------------------------------------------------------------------
# new method: ctb_reset_limit
#--------------------------------------------------------------------------
def self.ctb_reset_limit(battler)
@ctb_limit_instant[battler.name] = 0
end

end # BattleControl

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

module BattleManager

#--------------------------------------------------------------------------
# alias method: turn_start
#--------------------------------------------------------------------------
class <<self; alias ctb_turn_start turn_start; end
def self.turn_start
ctb_turn_start unless BattleControl.battle_type == :ctb
turn_start_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
class <<self; alias ctb_turn_end turn_end; end
def self.turn_end
ctb_turn_end unless BattleControl.battle_type == :ctb
turn_end_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: on_encounter
#--------------------------------------------------------------------------
class <<self; alias ctb_on_encounter on_encounter; end
def self.on_encounter
ctb_on_encounter
BattleControl.ctb_init_ct if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# new method: turn_start_ctb
#--------------------------------------------------------------------------
def self.turn_start_ctb
@phase = :turn
clear_actor
end

#--------------------------------------------------------------------------
# new method: turn_end_ctb
#--------------------------------------------------------------------------
def self.turn_end_ctb
@phase = :turn_end
@preemptive = false
@surprise = false
$game_troop.increase_turn
end

end # BattleManager

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

#--------------------------------------------------------------------------
# alias method: input
#--------------------------------------------------------------------------
alias ctb_input input
def input
if BattleControl.battle_type == :ctb
if @actions[@action_input_index] == nil
@actions[@action_input_index] = Game_Action.new(self)
end
end
return ctb_input
end

end # Game_Actor

#==============================================================================
# ■ Window_ActorCommand
#==============================================================================

class Window_ActorCommand < Window_Command

#--------------------------------------------------------------------------
# alias method: process_dir6
#--------------------------------------------------------------------------
if $imported["YEA-BattleEngine"]
alias ctb_process_dir6 process_dir6
def process_dir6
return if BattleControl.battle_type == :ctb
ctb_process_dir6
end
end

end # Window_ActorCommand

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

class Scene_Battle < Scene_Base

#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias ctb_create_all_windows create_all_windows
def create_all_windows
create_ctb_order_gauge if $imported["YES-CTBOrderGauge"]
create_ctb_debug if $imported["YES-CTBDebug"]
ctb_create_all_windows
end

#--------------------------------------------------------------------------
# new method: create_ctb_order_gauge
#--------------------------------------------------------------------------
def create_ctb_order_gauge
return unless BattleControl.battle_type == :ctb
@ctb_order_gauge = Window_OrderCTB.new
end

#--------------------------------------------------------------------------
# new method: create_ctb_debug
#--------------------------------------------------------------------------
def create_ctb_debug
return unless BattleControl.battle_type == :ctb
return unless $TEST
@ctb_debug_window = Window_CTBDebug.new()
end

#--------------------------------------------------------------------------
# alias method: process_condition
#--------------------------------------------------------------------------
alias ctb_process_condition process_condition
def process_condition
return ctb_process_condition unless BattleControl.battle_type == :ctb
return process_condition_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: process_in_turn
#--------------------------------------------------------------------------
alias ctb_process_in_turn process_in_turn
def process_in_turn
ctb_process_in_turn unless BattleControl.battle_type == :ctb
process_in_turn_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: update_info_viewport
#--------------------------------------------------------------------------
alias ctb_update_info_viewport update_info_viewport
def update_info_viewport
ctb_update_info_viewport unless BattleControl.battle_type == :ctb
update_info_viewport_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: next_command
#--------------------------------------------------------------------------
alias ctb_next_command next_command
def next_command
ctb_next_command unless BattleControl.battle_type == :ctb
next_command_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: prior_command
#--------------------------------------------------------------------------
alias ctb_prior_command prior_command
def prior_command
ctb_prior_command unless BattleControl.battle_type == :ctb
prior_command_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: command_fight
#--------------------------------------------------------------------------
alias ctb_command_fight command_fight
def command_fight
ctb_command_fight unless BattleControl.battle_type == :ctb
command_fight_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# alias method: execute_action
#--------------------------------------------------------------------------
alias ctb_execute_action execute_action
def execute_action
BattleControl.ctb_evaluate_action(@subject, @subject.current_action.item) if BattleControl.battle_type == :ctb
ctb_execute_action
end

#--------------------------------------------------------------------------
# alias method: command_escape
#--------------------------------------------------------------------------
alias ctb_command_escape command_escape
def command_escape
ctb_command_escape unless BattleControl.battle_type == :ctb
command_escape_ctb if BattleControl.battle_type == :ctb
end

#--------------------------------------------------------------------------
# new method: process_condition_ctb
#--------------------------------------------------------------------------
def process_condition_ctb
inputting = @actor_command_window.active || @skill_window.active ||
@item_window.active || @actor_window.active || @enemy_window.active
inputting = inputting || @summon_window.active if $imported["YES-GuardianSummon"]
return !inputting
end

#--------------------------------------------------------------------------
# new method: process_in_turn_ctb
#--------------------------------------------------------------------------
def process_in_turn_ctb
BattleControl.filter_battlers
if @status_window.close?
@status_window.open
end
@actor_command_window.close
@status_window.unselect
return if @subject
BattleControl.ctb_add_ct
#---
battler = BattleControl.ctb_active_battlers[0]
battler.make_actions
#--- Fix Instant-abuse ---
if battler != @subject && @subject
BattleControl.ctb_reset_limit(@subject)
end
#---
@subject = battler
#---
BattleControl.ctb_temp_evaluate(battler, nil)
@ctb_order_gauge.refresh if $imported["YES-CTBOrderGauge"]
#@ctb_debug_window.refresh if $imported["YES-CTBDebug"]
#---
if @subject.inputable? and battler.is_a?(Game_Actor)
@actor_command_window.setup(@subject)
BattleManager.set_actor(battler)
@status_window.select(BattleManager.actor.index)
end
end

#--------------------------------------------------------------------------
# new method: update_info_viewport_ctb
#--------------------------------------------------------------------------
def update_info_viewport_ctb
move_info_viewport(0) if @party_command_window.active
move_info_viewport(128) if @actor_command_window.active
move_info_viewport(64) if BattleManager.in_turn? && process_condition
end

#--------------------------------------------------------------------------
# new method: next_command_ctb
#--------------------------------------------------------------------------
def next_command_ctb
@status_window.show
@actor_command_window.show
@status_aid_window.hide if $imported["YEA-BattleEngine"]
end

#--------------------------------------------------------------------------
# new method: prior_command_ctb
#--------------------------------------------------------------------------
def prior_command_ctb
$imported["YEA-BattleEngine"] ? redraw_current_status : @status_window.refresh
start_party_command_selection
end

#--------------------------------------------------------------------------
# new method: command_fight_ctb
#--------------------------------------------------------------------------
def command_fight_ctb
turn_start
end

#--------------------------------------------------------------------------
# new method: command_escape_ctb
#--------------------------------------------------------------------------
def command_escape_ctb
unless BattleManager.process_escape
BattleControl.ctb_evaluate_action(@subject, nil)
turn_start
end
end

#--------------------------------------------------------------------------
# alias method: turn_end
#--------------------------------------------------------------------------
alias ctb_turn_end turn_end
def turn_end
ctb_turn_end
return unless BattleControl.battle_type == :ctb
@party_command_window.deactivate
end

end # Scene_Battle

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

Spoiler: "Yami CTB Order Gauge"
#==============================================================================
#
# ▼ Yami Engine Symphony - Charge Turn Battle Add-on
# -- Script: Order Gauge
# -- Last Updated: 2012.07.04
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YES-CTBOrderGauge"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.04 - Started and Finished Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a visual for Turn Order of CTB.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below YES - Battle CTB but above ▼ Main. Remember to save.
#
#==============================================================================
# ▼ 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.
# This script only works with YES - Battle CTB.
#
#==============================================================================

module YES
module CTB

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Order Gauge Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the Order Gauge of CTB.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ORDER_GAUGE = { # Start.
😛ending => 8, # Number of Pending Turns on Order Gauge.
# Order Gauge Position.
:x => 0,
:y => 0,
# Order Gauge Type.
:type => :horizontal, # :horizontal for horizontal Gauge.
# :vertical for vertical Gauge.
} # End.

end # CTB
end # YES

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

#==============================================================================
# ■ Cache
#==============================================================================

module Cache

#--------------------------------------------------------------------------
# new method: ctb
#--------------------------------------------------------------------------
def self.ctb(filename)
begin
load_bitmap("Graphics/CTB/", filename)
rescue
empty_bitmap
end
end

end # Cache

#==============================================================================
# ■ YES::CTB
#==============================================================================

module YES
module CTB
SPRITE_WIDTH = Cache.ctb("BGActor").width
SPRITE_HEIGHT = Cache.ctb("BGEnemy").height
RECT = Rect.new(0, 0, SPRITE_WIDTH, SPRITE_HEIGHT)
end
end

#==============================================================================
# ■ BattleControl
#==============================================================================

module BattleControl

#--------------------------------------------------------------------------
# new method: ctb_ct
#--------------------------------------------------------------------------
def self.ctb_ct
result = @ctb_ct.dup
result
end

#--------------------------------------------------------------------------
# new method: ctb_temp_ct
#--------------------------------------------------------------------------
def self.ctb_temp_ct
result = @ctb_temp_ct.dup
result
end

#--------------------------------------------------------------------------
# new method: ctb_time
#--------------------------------------------------------------------------
def self.ctb_time(battler, real_ct)
return 0 if real_ct >= @threshold
return ((@threshold - real_ct) / battler.agi).ceil
end

end # BattleControl

#==============================================================================
# ■ Window_OrderCTB
#==============================================================================

class Window_OrderCTB < Window_Base

#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
x = YES::CTB:😮RDER_GAUGE[:x]
y = YES::CTB:😮RDER_GAUGE[:y]
super(x, y, Graphics.width, Graphics.height)
self.opacity = 0
@Data = []
@battlers = []
end

#--------------------------------------------------------------------------
# item_rect
#--------------------------------------------------------------------------
def item_rect(index)
width = YES::CTB::SPRITE_WIDTH
height = YES::CTB::SPRITE_HEIGHT
x = YES::CTB:😮RDER_GAUGE[:type] == :horizontal ? (YES::CTB:😮RDER_GAUGE[😛ending] - index - 1) * width : 0
y = YES::CTB:😮RDER_GAUGE[:type] == :vertical ? index * height : 0
x += (width.to_f / 4).floor if index == 0
rect = Rect.new(x, y, width, height)
rect
end

#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
filter_battlers
get_data
contents.clear
#---
for i in 0...YES::CTB:😮RDER_GAUGE[😛ending]
draw_item(i)
end
end

#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
contents.font.size = 18
contents.font.color.set(Color.new(255,255,255))
contents.font.out_color = Color.new(0,0,0)
data = @Data[index]
rect = item_rect(index)
#---
border = data[0].actor? ? "BorderActor" : "BorderEnemy"
#---
if data[0].actor?
bg = "BGActor"
letter = ""
else
bg = "BGEnemy"
letter = data[0].letter
end
#---
face = data[0].actor? ? data[0].name : data[0].enemy.name
#---
contents.blt(rect.x, rect.y, Cache.ctb(bg), YES::CTB::RECT)
contents.blt(rect.x, rect.y, Cache.ctb(face), YES::CTB::RECT)
contents.blt(rect.x, rect.y, Cache.ctb(border), YES::CTB::RECT)
#---
rect.y += 12
draw_text(rect, letter, 2)
end

#--------------------------------------------------------------------------
# filter_battlers
#--------------------------------------------------------------------------
def filter_battlers
BattleControl.ctb_fix_ct
@battlers.clear
($game_party.battle_members + $game_troop.members).each { |battler|
next unless battler.movable?
@battlers.push(battler)
}
end

#--------------------------------------------------------------------------
# filter_battlers
#--------------------------------------------------------------------------
def sort_battlers
@battlers.sort! { |a, b|
if BattleControl.ctb_time(a, @ct[a.name]) != BattleControl.ctb_time(b, @ct[b.name])
BattleControl.ctb_time(a, @ct[a.name]) <=> BattleControl.ctb_time(b, @ct[b.name])
elsif (@ct[a.name] + BattleControl.ctb_time(a, @ct[a.name]) * a.agi) != (@ct[b.name] + BattleControl.ctb_time(b, @ct[b.name]) * b.agi)
(@ct[b.name] + BattleControl.ctb_time(b, @ct[b.name]) * b.agi) <=> (@ct[a.name] + BattleControl.ctb_time(a, @ct[a.name]) * a.agi)
else
a.screen_x <=> b.screen_x
end
}
end

#--------------------------------------------------------------------------
# get_data
#--------------------------------------------------------------------------
def get_data
@ct = BattleControl.ctb_ct
@temp_ct = BattleControl.ctb_temp_ct
@data.clear
#---
active_battler = BattleControl.ctb_active_battlers[0]
if active_battler
@data.push([active_battler, @ct[active_battler.name]])
if @temp_ct.has_key?(active_battler.name)
@ct[active_battler.name] -= @temp_ct[active_battler.name]
else
@ct[active_battler.name] -= BattleControl.ctb_evaluate_ct(active_battler, nil)
end
end
#---
while @data.size < YES::CTB:😮RDER_GAUGE[😛ending]
sort_battlers
battler = @battlers[0]
@data.push([battler, @ct[battler.name]])
@ct[battler.name] -= BattleControl.ctb_evaluate_ct(battler, nil)
end
end

end # Window_OrderCTB

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

class Scene_Battle < Scene_Base

#--------------------------------------------------------------------------
# alias method: update_basic
#--------------------------------------------------------------------------
alias order_ctb_update_basic update_basic
def update_basic
order_ctb_update_basic
return unless BattleControl.battle_type == :ctb
if $game_party.all_dead? || $game_troop.all_dead?
@ctb_order_gauge.contents_opacity -= 25
end
end

#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias order_ctb_update update
def update
order_ctb_update
#---
return unless BattleControl.battle_type == :ctb
return unless @subject
return unless @subject.actor?
if @actor_command_window.active
if @actor_command_window.current_symbol == :attack
skill = $data_skills[1]
end
if @actor_command_window.current_symbol == :guard
skill = $data_skills[2]
end
if $imported["YEA-BattleCommandList"]
if @actor_command_window.current_symbol == :use_skill
skill = $data_skills[@actor_command_window.current_ext]
end
end
end
if @skill_window.active && BattleManager.actor
skill = @skill_window.item
end
if @item_window.active && BattleManager.actor
skill = @item_window.item
end
#---
temp_ct = BattleControl.ctb_evaluate_ct(@subject, skill)
unless BattleControl.ctb_check_temp((@subject), temp_ct)
BattleControl.ctb_temp_evaluate(@subject, skill)
@ctb_order_gauge.refresh
end
end

end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
Code:
[/spoiler]
I'd like to help, but I'm confused by your scripts.

Is it Yami CATB script? I don't know of a Yami CTB script.
YSA Battle System: Classical ATB

Yami CTB Order Gauge should be YSA Battle Add-On: Order Battlers

So I just want you to be specific on what scripts you have so that I can reproduce the issue.
Unless you want to send me a PM with a demo.

forgot to use the reply function on my last post so in case that doesn't send you a notification ( or whatnot...) i'll write this here
forgot to use the reply function on my last post so in case that doesn't send you a notification ( or whatnot...) i'll write this here
Thanks.
You are right on the script 'a bit', it is Charge Turn Battle, but it's the battle mechanism script.
It's defined in the script as
$imported["YES-BattleCTB"] = true
with the name -
# ▼ Yami Engine Symphony - Battle Mechanism
# -- Type: Charge Turn Battle

I could maybe rebuild a system to test, but your demo would be much faster.
I'll start a conversation.
Just make a zip file of you project folder and share it.
If it is large then use an online file sharing option and send me the link.
I'll take a look at the issue and see if I can find a solution or the reason for the issue.

Original thread: https://forums.rpgmakerweb.com/threads/issues-with-yamis-pctb.183929/