Found another interesting stuff: The turn_end triggers when an battler has executed an action, and the next 1-2 frames has no battlers executing an action, causing it to sometimes be triggered every infrequently(when all battlers have almost the same and/or extremely high agi) or frequently(when 1 battler has much, much higher agi than all the others), leading possibly erratic update_state_turns and battle event behaviors.
I've traced the code and found these:
Spoiler
def call_update_atb_bar return if (!@actor_atb_array.empty? && !Input.press?(Akea_Active_Battle::Flee_Input)) || BattleManager.has_action? $game_troop.alive_members.each{|member| member.atb = increment_atb(member) if member.atb >= 1000 @enemy_atb_array = $game_troop.members.index(member) BattleManager.add_enemy_order(@enemy_atb_array) Akea_Active_Battle.atb_formula(member) BattleManager.input_start turn_start return end } return unless @actor_atb_array.empty? $game_party.alive_members.each{|member| member.atb = increment_atb(member) if member.atb >= 1000 @actor_atb_array << $game_party.members.index(member) @status_window.refresh_atb start_party_command_selection return end } @status_window.refresh_atb end
Code:
def start_party_command_selection unless scene_changing? refresh_status @status_window.unselect @status_window.open if BattleManager.input_start @actor_command_window.close @party_command_window.setup else @party_command_window.deactivate turn_start end end end
Code:
def start_actor_command_selection return turn_start if BattleManager.has_action? akea_atb_start_actor_command_selection end
Code:
def turn_start @party_command_window.close @actor_command_window.close @status_window.unselect @subject = nil BattleManager.turn_start @log_window.wait @log_window.clear end
Code:
def self.turn_start @phase = :turn clear_actor $game_troop.increase_turn make_action_orders end
Code:
def update super if BattleManager.in_turn? process_event process_action end BattleManager.judge_win_loss end
Code:
def process_action return if scene_changing? if !@subject || [email protected]_action @subject = BattleManager.next_subject end return turn_end unless @subject if @subject.current_action @subject.current_action.prepare if @subject.current_action.valid? @status_window.open execute_action end @subject.remove_current_action end process_action_end unless @subject.current_action end
Code:
def self.next_subject loop do battler = @action_battlers.shift return nil unless battler next unless battler.index && battler.alive? return battler end end
Code:
def turn_end if !@actor_atb_array.empty? && $game_party.members[@actor_atb_array.first].dead? @actor_atb_array.shift @back_flee_atb.opacity = 0 @bar_flee_atb.opacity = 0 @start_flee = true end akea_atb_turn_end end
Code:
def turn_end all_battle_members.each do |battler| battler.on_turn_end refresh_status @log_window.display_auto_affected_status(battler) @log_window.wait_and_clear end BattleManager.turn_end process_event start_party_command_selection end
Code:
def on_turn_end @result.clear regenerate_all update_state_turns update_buff_turns remove_states_auto(2) end
Code:
def self.turn_end @phase = :turn_end @preemptive = false @surprise = false end
Right before a battler executes actions, turn_start will always be called, setting @phase as :turn, thus causing BattleManager.in_turn? to return true.
When process_action is called, it'll execute actions of @subject if @action_battlers has an alive battler, or call turn_end otherwise.
@action_battlers will have an alive battler right before that battler executes actions, and it'll have nothing right after so.
After a battler has executed actions, the battle will proceed to the next frame.
process_action will still be called unless another or the same battler can act, causing turn_end to be called as now @action_battlers contains nothing, causing BattleManager.next_subject to return nil.
When on_turn_end is called, update_state_turns and update_buff_turns are also called, causing possibly erratic behavior on state and/or buff/debuff turns.(It also causes battle events triggered on turn/turn end to have possibly erratic behavior)
If that's not intended, then maybe setting @phase as something new(like :turn_exec) right after executing all actions of @subject, and using a separate counter to count how many frames/executed actions in the same turn triggers the turn end, can help, although it might cause new compatibility issues. I think fixing this one while preserving this script's compatibility won't be easy nor simple(while not minding breaking compatibility will make the fix a cakewalk lol)
😀
For example:
Spoiler
## ADDED TO SET @phase AS SOMETHING NEW def self.set_turn_exec @phase = :turn_exec end ## def start ## ADDED TO INITIALIZE THE TURN COUNT @turn_count = 0 ## akea_initialize_atb_variables akea_initialize_atb_states akea_atb_start end alias :akea_atb_execute_action :execute_action def execute_action akea_atb_execute_action ## ADDED TO INCREASE THE TURN COUNT RIGHT AFTER EXECUTING AN ACTION @turn_count += 1 ## end alias :akea_atb_process_action_end 😛rocess_action_end def process_action_end ## ADDED TO TRIGGER TURN END WHEN THE TURN COUNT REACHES IT MAX @turn_count >= MAX_TURN_COUNT ? turn_end : BattleManager.set_turn_exec ## akea_atb_process_action_end end def turn_end ## ADDED TO RESET THE TURN COUNT AT THE NEXT TURN @turn_count = 0 ## if !@actor_atb_array.empty? && $game_party.members[@actor_atb_array.first].dead? @actor_atb_array.shift @back_flee_atb.opacity = 0 @bar_flee_atb.opacity = 0 @start_flee = true end akea_atb_turn_end end
The problem with most atb in my opinion are the WAYS they are make...like it's almost like you need to overwrite everything'S when you can just define it in a new ways who make the system compatible :/
I was lucky on this shot with tankentai a script who everyone say : aWWWW tankentai suck he bugs with all the atbs and blabla
bullsh*t in my opinion. (tankentai will be the highlest compatible system you will have with your scripts xD (the ace version!)
I love your atb because you not using the battleManager module for create your system! you use the default turn_start ...and turn_end who make tankentai works like a charm with your system!
I have to admit your script is a jewel comparred to some scrapped ATB I saw on the internet...atb who are bad designed or just simply not worth the shot to make change for your system !
Yes, after reading this script several times more, I realized Raizen tried to put as many codes(even quite some battler logic) into Scene_Battle as possible. Among all atb system script I know so far, that's an extreme(but it also works like a charm in some cases). If Sixth's suggestions on drawing ATB bars are used(putting their sprites in Scene_Battle directly), this script will use Scene_Battle even more heavily(again, it can be both good and bad, depending on actual situations)
🙂
The other extreme is like what you said - Putting tons of codes into BattleManager, even those that are clearly not BattleManager logic.
There are also atb system scripts trying to put as many BattleManager logic into BattleManager, as many Game_Battler logic into Game_Battler, and as many Scene_Battle logic into Scene_Battle. Those scripts clearly define what each of those classes do, and those definitions mostly conform to the default ones. Some even tried to implement some design patterns, such as MVC.