Jump to content
Fomar0153

Ace Battle Engine Add-On - ATB/Stamina System

Recommended Posts

Ok I'll have another go tracking that error down, thanks for letting me know.

Are you using the trial or the full version out of curiosity?

Edited by Fomar0153

Share this post


Link to post
Share on other sites

I very much doubt the order gauge script is compatible. Where would you want the enemies bars?

On then or in a window for example the target window?

Funnily enough it does work well with it ^^ But if you are good enough to put the enemy gauges in I think under the enemy battlers is best (although please don't make it reliant on the HP pop-up if possible as I for one don't use it).

Share this post


Link to post
Share on other sites

Ok I'll have another go tracking that error down, thanks for letting me know.

Are you using the trial or the full version out of curiosity?

 

 

 

Full.

 

I've narrowed it down for you, you can replicate the error if the map you are using has no enemies. I presume it's linked to this part of the script:

 

 


 #--------------------------------------------------------------------------
 # â— Rewrote setup
 #--------------------------------------------------------------------------
 def self.setup(troop_id, can_escape = true, can_lose = false)
		    init_members
		    $game_troop.setup(troop_id)
		    @can_escape = can_escape
		    @can_lose = can_lose
		    make_escape_ratio
		    @escaping = false
		    @turn_counter = 0
		    @actions_per_turn = $game_party.members.size + $game_troop.members.size
		    ($game_party.members + $game_troop.members).each do |battler|
			  if battler.is_a?(Game_Enemy) or CBS::RESET_STAMINA
						    CBS.stamina_start(battler)
			  end
		    end
 end

 

 

That's as far as my coding knowledge goes

Share this post


Link to post
Share on other sites

I encountered the game-troop error once too, yet I have been unable to reproduce it ...

 

I have also noticed guard lasts only a split second, and also paralyze (and perhaps other similar states) seem to last forever.

 

 

edit: fixed second issue, forgot to set to 2~2

 

I encounter it when i walk on the map. No fight involved.

Share this post


Link to post
Share on other sites

The bug has finally been found I think, would someone who could produce the bug test this for me:

 

=begin
YanFly Compatible Customisable ATB/Stamina Based Battle System Script
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
Requires Yanfly Engine Ace - Ace Battle Engine
Customises the battle system to be similar to
ATB or Stamina based battle systems.
----------------------
Instructions
----------------------
Edit variables in CBS to suit your needs.
The guard status should be set to 2~2 turns.
----------------------
Known bugs
----------------------
None
=end
module CBS

 MAX_STAMINA = 1000
 RESET_STAMINA = true
 SAMINA_GAUGE_NAME = "ATB"

 # Set the colours of the STAMINA bars
 COLOR1 = 31
 COLOR2 = 32

 ESCAPE_COST = 500
 # If reset stamina is set to true then all characters
 # will start with a random amount of stamina capped at
 # the percentage you set.
 # If reset stamina is set to false then this just
 # affects enemies.
 STAMINA_START_PERCENT = 20

 # Default skill cost
 # If you want to customise skill costs do it like this
 # SKILL_COST[skill_id] = cost
 SKILL_COST = []
 SKILL_COST[0] = 1000
 # Attack
 SKILL_COST[1] = 1000
 # Guard
 SKILL_COST[2] = 500
 ITEM_COST = 1000


 #--------------------------------------------------------------------------
 # â— New Method stamina_gain
 #--------------------------------------------------------------------------
 def self.stamina_gain(battler)
                               return 2 + [0, battler.agi / 10].max
 end
 #--------------------------------------------------------------------------
 # â— New Method stamina_start
 #--------------------------------------------------------------------------
 def self.stamina_start(battler)
                               battler.stamina = rand(MAX_STAMINA * STAMINA_START_PERCENT / 100)
 end
end

class Game_BattlerBase
 #--------------------------------------------------------------------------
 # â— New attr_accessor
 #--------------------------------------------------------------------------
 attr_accessor :stamina
 #--------------------------------------------------------------------------
 # â— Aliases initialize
 #--------------------------------------------------------------------------
 alias yf_fomar_cbs_initialize initialize
 def initialize
                               yf_fomar_cbs_initialize
                               @stamina = 0
 end
 #--------------------------------------------------------------------------
 # â— New Method stamina_rate
 #--------------------------------------------------------------------------
 def stamina_rate
                               @stamina.to_f / CBS::MAX_STAMINA
 end
 #--------------------------------------------------------------------------
 # â— New Method stamina_rate
 #--------------------------------------------------------------------------
 def stamina_gain
                               return if not movable?
                               @stamina = [CBS::MAX_STAMINA, @stamina + CBS.stamina_gain(self)].min
 end
end

class Scene_Battle < Scene_Base
 #--------------------------------------------------------------------------
 # â— Rewrote update
 #--------------------------------------------------------------------------
 def update
               super
               if BattleManager.in_turn? and !inputting?
                 process_stamina
                 process_event
                 process_action
               end
               BattleManager.judge_win_loss
 end
 #--------------------------------------------------------------------------
 # â— Rewrote Method update_info_viewport
 #--------------------------------------------------------------------------
 def update_info_viewport
               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? and !inputting?
 end
 #--------------------------------------------------------------------------
 # â— New Method inputting?
 #--------------------------------------------------------------------------
 def inputting?
                               return @actor_command_window.active || @skill_window.active ||
                                 @item_window.active || @actor_window.active || @enemy_window.active
 end
 #--------------------------------------------------------------------------
 # â— New Method process_stamina
 #--------------------------------------------------------------------------
 def process_stamina
               @actor_command_window.close
               return if @subject
               all_battle_members.each do |battler|
                 battler.stamina_gain
               end
               @status_window.refresh_stamina
               if @status_window.close?
                 @status_window.open
               end
               if BattleManager.escaping?
                 $game_party.battle_members.each do |battler|
                               if battler.stamina < CBS::MAX_STAMINA
                                 $game_troop.members.each do |enemy|
                                               if enemy.stamina == CBS::MAX_STAMINA
                                                 enemy.make_actions
                                                 @subject = enemy
                                               end
                                 end
                                 return
                               end
                 end
                 unless BattleManager.process_escape
                               $game_party.battle_members.each do |actor|
                                 actor.stamina -= CBS::ESCAPE_COST
                               end
                 end
               end
               all_battle_members.each do |battler|
                 if battler.stamina == CBS::MAX_STAMINA
                               battler.make_actions
                               @subject = battler
                               if @subject.inputable? and battler.is_a?(Game_Actor)
                                 @actor_command_window.setup(@subject)
                                 @status_window.index = @subject.index
                                 BattleManager.set_actor(battler)
                               end
                               return
                 end
               end
 end
 #--------------------------------------------------------------------------
 # â— Rewrote start_party_command_selection Yanfly version
 #--------------------------------------------------------------------------
 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
 #--------------------------------------------------------------------------
 # â— Rewrote start_actor_command_selection
 #--------------------------------------------------------------------------
 def start_actor_command_selection
               @party_command_window.close
               BattleManager.set_escaping(false)
               turn_start
 end
 #--------------------------------------------------------------------------
 # â— Rewrote prior_command Yanfly version
 #--------------------------------------------------------------------------
 def prior_command
               redraw_current_status
               start_party_command_selection
 end
 #--------------------------------------------------------------------------
 # â— Rewrote process_action
 #--------------------------------------------------------------------------
 def process_action
               return if scene_changing?
               if !@subject || !@subject.current_action
                 @subject = BattleManager.next_subject
               end
               if Input.trigger?(: and (@subject == nil)
                 start_party_command_selection
               end
               return 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
                 refresh_status
                 @log_window.display_auto_affected_status(@subject)
                 @log_window.wait_and_clear
               end
               process_action_end unless @subject.current_action
 end
 #--------------------------------------------------------------------------
 # â— Aliases use_item
 #--------------------------------------------------------------------------
 alias cbs_use_item use_item
 def use_item
               cbs_use_item
               @subject.on_turn_end
 end
 #--------------------------------------------------------------------------
 # â— Rewrote turn_end
 #--------------------------------------------------------------------------
 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
 #--------------------------------------------------------------------------
 # â— Rewrote command_fight
 #--------------------------------------------------------------------------
 def command_fight
               BattleManager.next_command
               start_actor_command_selection
 end
 #--------------------------------------------------------------------------
 # â— Rewrote command_escape
 #--------------------------------------------------------------------------
 def command_escape
               @party_command_window.close
               BattleManager.set_escaping(true)
               turn_start
 end
 #--------------------------------------------------------------------------
 # â— Destroyed next_command
 #--------------------------------------------------------------------------
 def next_command
               @status_window.show
               @actor_command_window.show
               @status_aid_window.hide
 end
end




module BattleManager
 #--------------------------------------------------------------------------
 # â— Rewrote setup
 #--------------------------------------------------------------------------
 def self.setup(troop_id, can_escape = true, can_lose = false)
               init_members
               $game_troop.setup(troop_id)
               @can_escape = can_escape
               @can_lose = can_lose
               make_escape_ratio
               @escaping = false

               @turn_counter = 0
               @actions_per_turn = $game_party.members.size + $game_troop.members.size
               ($game_party.members + $game_troop.members).each do |battler|
                 if battler.is_a?(Game_Enemy) or CBS::RESET_STAMINA
                               CBS.stamina_start(battler)
                 end
               end
 end
 #--------------------------------------------------------------------------
 # â— New Method set_escaping
 #--------------------------------------------------------------------------
 def self.set_escaping(escaping)
                               @escaping = escaping
 end
 #--------------------------------------------------------------------------
 # â— New Method escaping?
 #--------------------------------------------------------------------------
 def self.escaping?
                               return @escaping
 end
 #--------------------------------------------------------------------------
 # â— Rewrote turn_start Yanfly version
 #--------------------------------------------------------------------------
 def self.turn_start
               @phase = :turn
               clear_actor
               @performed_battlers = []
 end
 #--------------------------------------------------------------------------
 # â— New Method set_actor
 #--------------------------------------------------------------------------
 def self.set_actor(actor)
                               @actor_index = actor.index
 end
 #--------------------------------------------------------------------------
 # â— New Increase action counter
 #--------------------------------------------------------------------------
 def self.add_action
   return if @actions_per_turn.nil?
   @turn_counter += 1
   if @turn_counter == @actions_per_turn
     $game_troop.increase_turn
     @turn_counter = 0
   end
 end
end

class Game_Battler < Game_BattlerBase
 #--------------------------------------------------------------------------
 # â— Rewrote on_turn_end
 #--------------------------------------------------------------------------
 def on_turn_end
                               @result.clear
                               regenerate_all
                               update_state_turns
                               update_buff_turns
                               remove_states_auto(2)
                               if self.actor?
                                 @stamina -= input.stamina_cost
                               else
                                 @stamina -= @actions[0].stamina_cost
                               end
                               BattleManager.add_action
 end
end

class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # â— Rewrote input
 #--------------------------------------------------------------------------
 def input
                               if @actions[@action_input_index] == nil
                                 @actions[@action_input_index] = Game_Action.new(self)
                               end
                               return @actions[@action_input_index]
 end
end

class Game_Action
 #--------------------------------------------------------------------------
 # â— New Method stamina_cost
 #--------------------------------------------------------------------------
 def stamina_cost
                               if @item.is_skill?
                                 return CBS::SKILL_COST[item.id] if CBS::SKILL_COST[item.id]
                                 return CBS::SKILL_COST[0]
                               end
                               return CBS::ITEM_COST if @item.is_item?
                               return CBS::MAX_STAMINA
 end
end

class Window_BattleStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # overwrite method: draw_item yanfly version
 #--------------------------------------------------------------------------
 def draw_item(index)
               return if index.nil?
               clear_item(index)
               actor = battle_members[index]
               rect = item_rect(index)
               return if actor.nil?
               draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
               draw_actor_name(actor, rect.x, rect.y, rect.width-8)
               draw_actor_action(actor, rect.x, rect.y)
               draw_actor_icons(actor, rect.x, line_height*1, rect.width)
               gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
               contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
               draw_actor_hp(actor, rect.x+2, line_height*2, rect.width-4)
               if draw_tp?(actor) && draw_mp?(actor)
                 dw = rect.width/2-2
                 dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
                 draw_actor_tp(actor, rect.x+2, line_height*2+gx, dw)
                 dw = rect.width - rect.width/2 - 2
                 draw_actor_mp(actor, rect.x+rect.width/2, line_height*2+gx, dw)
               elsif draw_tp?(actor) && !draw_mp?(actor)
                 draw_actor_tp(actor, rect.x+2, line_height*2+gx, rect.width-4)
               else
                 draw_actor_mp(actor, rect.x+2, line_height*2+gx, rect.width-4)
               end
               draw_actor_stamina(actor, rect.x+2, line_height*3, rect.width-4)
 end
 #--------------------------------------------------------------------------
 # overwrite method: draw_item yanfly version
 #--------------------------------------------------------------------------
 def draw_item_stamina(index)
               return if index.nil?
               actor = battle_members[index]
               rect = item_rect(index)
               return if actor.nil?
               gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
               contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
               draw_actor_stamina(actor, rect.x+2, line_height*3, rect.width-4)
 end
 #--------------------------------------------------------------------------
 # new method: refresh_stamina
 #--------------------------------------------------------------------------
 def refresh_stamina
               item_max.times {|i| draw_item_stamina(i) }
 end
 #--------------------------------------------------------------------------
 # new method: draw_actor_stamina
 #--------------------------------------------------------------------------
 def draw_actor_stamina(actor, dx, dy, width = 124)
               draw_gauge(dx, dy, width, actor.stamina_rate, stamina_gauge_color, stamina_gauge_color2)
               change_color(system_color)
               cy = (Font.default_size - contents.font.size) / 2 + 1
               draw_text(dx+2, dy+cy, 30, line_height, CBS::SAMINA_GAUGE_NAME)
 end
 #--------------------------------------------------------------------------
 # â— New Colour Definitions
 #--------------------------------------------------------------------------
 def stamina_gauge_color;   text_color(CBS::COLOR1);  end;
 def stamina_gauge_color2;        text_color(CBS::COLOR2);  end;
end

 

Share this post


Link to post
Share on other sites

Bug is gone now, but when I enter battle and make my actor attack the enemy, i get another error in the Scene_Battle, line 408 undefined method 'move_x' for nil class

 

EDIT: my bad, was an incompatibility with Jet's sideview.

It works just fine without sideview.

Edited by pinka

Share this post


Link to post
Share on other sites

Yep, that bug is gone. The only one I have left now is a problem with Skill Fusion where all the attacks go through their animation twice, sometimes crashing the game with this:

 

Script 'Ace Battle Engine 1.15' line 2937: NoMethodError occurred

undefined method 'atk_animation_id2' for nil:NilClass

 

But yeah, haven't found a problem with anything else yet :)

Share this post


Link to post
Share on other sites

I'll test the updated scipt within the next two hours.

 

In regards to the skill fusion script. I had the double anomation issue, I simply fixed it by commenting out the animation line in that script. No issues after.

 

Edit: had only double animation, not script error. May be different on this updated atb. test inc soon.

Edited by Ascen

Share this post


Link to post
Share on other sites

The game-troop error is gone for me now. The 'end of turn' paralyze bug is still there though, I guess you simply haven't got around to that one though.

 

One other bug I found was with Yanfly's Active Chain Skills (http://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/active-chain-skills/), I assume the first ability brings your stamina to 0 then any chained skills reduce this further into negative figures, causes the bar to show as 0 for a while before it builds up again.

 

 

And the Skill Fusion script, the line I was referring to was like 155:

show_animation(targets, item.animation_id)

Just put a # before it.

Share this post


Link to post
Share on other sites

Ah, thanks! That fixed the double animation issue. And I found out what my problem was, I still had the confirm window set to 'true' :S This is what was causing the error. Another note is that Yami's order gauge causes the enemies to have first swing every time (although because you are already adding enemy gauges that doesn't matter).

 

Well that's all my bugs ironed out :) The one design suggestion I would give is to make the stamina gauges much thinner and maybe put them above the headshot? They are just looking a bit cramped right now and you don't need to fit a number in the stamina gauge so not much reason to have it that thick.

 

EDIT: One other idea, is it possible to make the gauge change colours with the application of different states (haste/slow)? It would save on cramming up the state images and better accentuate the effect.

Edited by Tobyej

Share this post


Link to post
Share on other sites

I am wondering if the download link is fixed to the latest bug free version? If so I want to get it and finally use YEA too.

 

I was wondering if the download already had Yanfly Engine Ace in it. I hate downloading all those scripts separably and would eat up my daily download allowance fast.

I would like to request a download link with it already in there so I have less chance of bugs cause of self errors.

 

Now if had a sideview it would be great. (someone make a sideview script!)

Edited by ShinGamix

Share this post


Link to post
Share on other sites

Glad to hear you've dealt with your conflict issues.

Expect an update in the next few days with:

+ States expire after time rather than actions

+ Customisable Stamina Bars Appearance

+ Alter Stamina Colour based on states

 

ShinGamix - the link below contains the two scripts combined in one, paste it above main and below the default scripts and everything should be ok.

http://pastebin.com/raw.php?i=N4uK3cYh

Share this post


Link to post
Share on other sites

I'm having a problem with multiple damage skills, the animation is being repeated for each one hit;

Any solution?

 

anyway thank you for your script, it is great!

Share this post


Link to post
Share on other sites

I'm having a problem with multiple damage skills, the animation is being repeated for each one hit;

Any solution?

 

anyway thank you for your script, it is great!

 

If you are using Kread-EX's skill fusion, that is the problem and Ascen found the solution:

 

"And the Skill Fusion script, the line I was referring to was like 155:

show_animation(targets, item.animation_id)

Just put a # before it."

Share this post


Link to post
Share on other sites

I'm not using skill fusion script, only the core engine and ATB + Battle Engine

Another change that I noticed is that elemental damage does not appear with different colors anymore ...

If you can help me, since my battle system is highly based on elemental damage and multiple hits ...

 

I appreciate any help!

 

thank you

Edited by Eduardo

Share this post


Link to post
Share on other sites

Sorry mate, no idea. I have 101 scripts now, including a large amount of Yanfly's and I can't recreate either of those problems. All I can tell you is it isn't any of YF's core scripts, or this one, causing the problem.

Share this post


Link to post
Share on other sites

I finally got a chance to look at the code for this. And I must say, I'm very impressed and greatly appreciative that you decided to keep all of the core functions referring back to the default Scene_Battle methods. Other ATB scripts that were made in VX vanilla didn't do so and caused a ton of compatibility problems with other scripts that modified the default battle scene. You've saved yourself a huge headache in the future. Kudos a lot for that!

Share this post


Link to post
Share on other sites

Melody required a team to make and it was a month long process. VX Ace isn't even out in full for English yet, meaning I won't have a reliable team. Please stop asking.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×