ACBS - Atoa Custom Battle System 3.2

Atoa wrote:
And what do you mean by "animate more than one character at once"?


Well, when using Union skills I've noticed you can only animate the character casting the skill. For example, if skill 'x' requires actors 1 through 4, and the settings are as follows, Skill_Settings[x] = ["MOVETYPE/STEPFOWARD"], only the character casting the skill will move forward and the other three actors will do nothing.

Is there a way to simultaneously animate actors?
@Juan J. Sánchez
No, you can animate all character, but you must notice that the "casting" is done only by the first actor, so you need to make you combination an sequence, like the Union Skill of the demo.
You can't put all the settings on the union skill itself, but on the skills cast aftewards.
Okay, I tried that and it still doesn't work. It might be an issue with the Chrono Trigger add-on, since it seems to work fine on your demo, or I might be doing something wrong.

Here's my code so far.

  1. Skill_Settings[81] = ["MOVETYPE/STEPFOWARD"]
  2. Skill_Settings[82] = ["MOVETYPE/STEPFOWARD"]
  3.  
  4. Combination_Skill['Union'] =  {
  5.   ['Actor', 27] => {5 => [81], 6 => [82]}
  6. }
Expand to see the code.


EDIT: So went ahead and made new skills and it seems to work fine now. I have no idea what I was doing wrong.

Anyhow, I also tried the ATB/Union glitch in your demo, and I lament to say it's still there. :(
I checked the code, but still can't find what's wrong.
Since i've got some free time, and i'm in need of an extra cash. I'm open to paid submissions. Any one interested, send an PM.
I might be interested. Can you PM about the prices?
The prices depends on what will be asked, so we can negotiate. In general, i charge 20~30 U$ for "simple" systems, 40~60 U$ for "medium" systems, 60~100 U$ for "hard" systems, and 100 U$+ for "very hard" systems.
By "easy" or "hard" i mean not only the dicult to make the system works, but the estimated time. So an simple mechanic that would take a lot of time to be done, would be classified as "medium" or "hard". But well, everything is negotiable x]

So just send an PM with the request.
Sounds reasonable. Which is your preferred method of payment?
I wanted to ask what i would have to do to make a script work with your battle system, i'm using a custom battle results script, and for some reason the players do not do their Victory animation, they simple keep doing their standing position... so i was wondering if their was something special i might have to adjust to make a different battle results script work with your system.

This the script i'm trying to use, it basically is a retro battle results script, it displays battle results much like they were displayed in older RPGs on the SNES, namedly Final Fantasy 4 5 and 6.
Someone made it when i requested, i thought it would work perfectly, but it's not
  1. #==============================================================================
  2. # Retro-Styled Battle Result Window
  3. # By gerkrt/gerrtunk
  4. # Version: 1.1
  5. # License: GPL, credits
  6. # Date: 22/08/2011
  7. # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
  8. # script check here: http://usuarios.multimania.es/kisap/english_list.html
  9. #==============================================================================
  10.  
  11. =begin
  12.  
  13. --------Introduction-----------
  14.  
  15. This scripts lets you use a retro styled battle result window, like FFVI for
  16. example, where a small window on the top shows line per line the information.
  17.  
  18. But i expanded that. You can configure what you want to show or not and how it will
  19. be shown, grouped or not, and what number of lines will have the window.
  20.  
  21. Finally you can use a wait key mode or a wait time one.
  22.  
  23. ------Instructions-------------
  24.  
  25. First you have to select what you want to see. To do that use the option
  26. Things_to_show. This is a list of codes so if the code is here that option
  27. will be shown. The codes are:
  28.  
  29. :level_up, :gain_skill, :win_phrase, :gold, :exp, :treasures
  30.  
  31. Later you can configure the number of lines of the window in Lines_to_show.
  32. The retro games used 1, but you can add more lines to the window so the
  33. messages are shown faster.
  34.  
  35. Show_levels_in_one_line = true
  36.  
  37. These options define if for example it says , actor level up! actor level up!
  38. or actor level up!(2). true/false, active and inactive.
  39.  
  40. ------Vocabulary-----
  41.  
  42. The last options are the words the system show in the window. You can changue
  43. that.
  44.  
  45. Also you can configure battle wins phrases for each enemy troop.
  46.  
  47.   Battle_wins_phrases = {
  48.     2=>'Wep winned again2',
  49.     3=>'Wep winned again3',
  50.   }
  51. Where X=> is the troop id number and 'text' is th eprharse, respect the syntax.
  52. Note that exist a default option for the ones that dont have a entry here.
  53.  
  54. -----Compatibility----
  55.  
  56. You can desactivate the modification of the battle status windows, thats the one
  57. used for draw character info in battle.
  58.  
  59. Modify_window_battle_status = false
  60.  
  61. =end
  62.  
  63. module Wep
  64.   Show_levels_in_one_line = true
  65.   Lines_to_show = 1
  66.   Things_to_show = [:level_up, :gain_skill, :win_phrase, :gold, :exp, :treasures]
  67.   Modify_window_battle_status = true
  68.   Gain_level_phrase = ' level up'
  69.   Gain_skill_phrase = ' learned'
  70.   Gain_gold_phrase = ' gained.'
  71.   Treasure_gain_phrase = ' gained.'
  72.   Gain_exp_phrase = ' Exp gained.'
  73.   Battle_win_default_phrase = 'Wep! You win!.'
  74.   Battle_wins_phrases = {
  75.     2=>'Wep winned again2',
  76.     3=>'Wep winned again3',
  77.   }
  78.  
  79. end
  80.  
  81.  
  82. if Wep::Modify_window_battle_status
  83. #==============================================================================
  84. # ** Window_BattleStatus
  85. #------------------------------------------------------------------------------
  86. #  This window displays the status of all party members on the battle screen.
  87. #==============================================================================
  88.  
  89. class Window_BattleStatus < Window_Base
  90.    #--------------------------------------------------------------------------
  91.   # * Refresh
  92.   #--------------------------------------------------------------------------
  93.   def refresh
  94.     self.contents.clear
  95.     @item_max = $game_party.actors.size
  96.     for i in 0...$game_party.actors.size
  97.       actor = $game_party.actors[i]
  98.       actor_x = i * 160 + 4
  99.       draw_actor_name(actor, actor_x, 0)
  100.       draw_actor_hp(actor, actor_x, 32, 120)
  101.       draw_actor_sp(actor, actor_x, 64, 120)
  102.       if @level_up_flags[i]
  103.         #self.contents.font.color = normal_color
  104.         #self.contents.draw_text(actor_x, 96, 120, 32, "¡Sube Nivel!")
  105.       else
  106.         draw_actor_state(actor, actor_x, 96)
  107.       end
  108.     end
  109.   end
  110. end
  111.  
  112. end
  113.  
  114.  
  115. #==============================================================================
  116. # ** Window_BattleResult
  117. #------------------------------------------------------------------------------
  118. #  This window displays amount of gold and EXP acquired at the end of a battle.
  119. #==============================================================================
  120.  
  121.  
  122. class Window_BattleResult < Window_Base
  123.   attr_reader   :messages_max
  124.   attr_reader   :messages_index
  125.  
  126.   #--------------------------------------------------------------------------
  127.   # * Object Initialization
  128.   #     exp       : EXP
  129.   #     gold      : amount of gold
  130.   #     treasures : treasures
  131.   #--------------------------------------------------------------------------
  132.   def initialize(br)
  133.     @br = br # get battle result
  134.     @messages_index = 0 # shows the actual mesage of the window
  135.     @messages = [] # array of mesages: exp, gold,e tc
  136.     super(0, 0, 640,  (Wep::Lines_to_show * 32) + 32)
  137.     self.contents = Bitmap.new(width - 32, height - 32)
  138.     self.y = 0
  139.     self.back_opacity = 160
  140.     self.visible = false
  141.     generate_messages
  142.     refresh
  143.   end
  144.  
  145.   #--------------------------------------------------------------------------
  146.   # * Generate messages
  147.   # This extracts all the information of the battle result and push it in the
  148.   # messages list as phrases
  149.   #--------------------------------------------------------------------------
  150.   def generate_messages
  151.     i = 0
  152.    
  153.     # Win phrase
  154.     if Wep::Things_to_show.include? :win_phrase
  155.       if Wep::Battle_wins_phrases[$game_temp.battle_troop_id] != nil
  156.         @messages.push Wep::Battle_wins_phrases[$game_temp.battle_troop_id]
  157.       else
  158.         @messages.push Wep::Battle_win_default_phrase
  159.       end
  160.     end
  161.    
  162.     # Gold & exp
  163.     @messages.push @br.exp.to_s + Wep::Gain_exp_phrase if Wep::Things_to_show.include? :exp
  164.     @messages.push @br.gold.to_s + ' ' + $data_system.words.gold + Wep::Gain_gold_phrase  if Wep::Things_to_show.include? :gold
  165.    
  166.     # Actors iteration
  167.     for br_actor in @br.actors_data
  168.      
  169.         # Check diff so can gain levels or exp
  170.         if br_actor.gained_levels > 0
  171.          
  172.           # LEVEL UP. If actived to show levelup, use configurated method
  173.           if Wep::Things_to_show.include? :level_up
  174.             if Wep::Show_levels_in_one_line
  175.               @messages.push (br_actor.actor.name + ' ' + Wep::Gain_level_phrase +
  176.               "(#{br_actor.gained_levels}).")
  177.             else
  178.               for lv in 0...br_actor.gained_levels
  179.                 @messages.push (br_actor.actor.name + ' ' + Wep::Gain_level_phrase)
  180.               end
  181.             end
  182.           end
  183.          
  184.          
  185.           # SKILL GAIN UP. If actived to show skill learn, use configurated method
  186.           if Wep::Things_to_show.include? :gain_skill
  187.              for skill_id in br_actor.gained_skills
  188.                 @messages.push (br_actor.actor.name + ' ' + Wep::Gain_skill_phrase + ' ' +
  189.                    $data_skills[skill_id].name + '.')
  190.               end
  191.      
  192.           end
  193.        
  194.         end
  195.        
  196.       i += 1
  197.     end
  198.  
  199.     # Tesoros
  200.     if Wep::Things_to_show.include? :treasures
  201.       b = Hash.new(0) # use this hash to count duplicates
  202.      
  203.       # iterate over the array, counting duplicate entries
  204.       @br.treasures.each do |v|
  205.         b[v] += 1
  206.       end
  207.      
  208.       b.each do |k, v|
  209.         @messages.push k.name + '(' + v.to_s + ')' + Wep::Treasure_gain_phrase
  210.       end
  211.     end
  212.  
  213.   end
  214.  
  215.   #--------------------------------------------------------------------------
  216.   # * Refresh
  217.   # Refresh with new messages each time.
  218.   #--------------------------------------------------------------------------
  219.   def refresh
  220.     self.contents.clear
  221.     if @messages[@messages_index] != nil
  222.       # Use lines configuration
  223.       if Wep::Lines_to_show == 1
  224.          self.contents.draw_text(0, 0, 640, 32, @messages[@messages_index])
  225.       else
  226.          for i in 0...Wep::Lines_to_show
  227.            # It adds the line count to message index to show more lines
  228.            if @messages[@messages_index + i] != nil
  229.              self.contents.draw_text(0, i * 32, 640, 32, @messages[@messages_index + i])
  230.            end
  231.          end
  232.       end
  233.       @messages_index += Wep::Lines_to_show
  234.     end
  235.     # When false, it will end battle
  236.     if @messages_index >= @messages.size - 1
  237.       return false
  238.     else
  239.       return true
  240.     end
  241.   end
  242.  
  243. end
  244.  
  245.  
  246. module Wep
  247.   Scripts_list = [] unless defined? Scripts_list
  248.   Scripts_list.push ('Retro-Styled Battle Result Window')
  249. end
  250.  
  251.  
  252. #==============================================================================
  253. # Battle Result
  254. # By gerkrt/gerrtunk
  255. # Version: 1.0
  256. # License: GPL, credits
  257. # Date: 22/08/2011
  258. # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
  259. # script check here: http://usuarios.multimania.es/kisap/english_list.html
  260. #==============================================================================
  261.  
  262. =begin
  263.  
  264. --------Introduction-----------
  265.  
  266. I created this class so anyone can easily create a custom or more advanced
  267. battle result window. This object gives you all the information need in a simplier
  268. way and without a lot of trouble. It creates a array of party actors with:
  269.  
  270. -Array of learned skills ids of each actor
  271. -Gained levels
  272. -Actor referen ce
  273. -Origin and ending exp and levels
  274. -All the default info(gold,etc)
  275.  
  276. ------Instructions-------------
  277.  
  278. You just need to give to it the initial levels of the party. For that, i put
  279. here the sample code i use in scene battle start_phase5
  280.  
  281.     initial_levels = []
  282.     for ac in $game_party.actors
  283.       initial_levels.push (ac.level)
  284.     end
  285.    
  286.     You only have to pass that array.
  287.    
  288.    
  289. =end
  290.  
  291.  
  292.  
  293. ResultActor = Struct.new( :actor, :origin_level,  :gained_skills,
  294.   :gained_levels)
  295.  
  296. class Battle_Result
  297.  
  298.   attr_reader :actors_data
  299.   attr_reader :exp
  300.   attr_reader :gold
  301.   attr_reader :treasures
  302.  
  303.   #--------------------------------------------------------------------------
  304.   # * Initialize
  305.   #--------------------------------------------------------------------------
  306.   def initialize(initial_levels, exp, gold, treasures)
  307.     @actors_initals_levels = initial_levels
  308.     @exp = exp
  309.     @gold = gold
  310.     @treasures = treasures
  311.     @actors_data = []
  312.     generate_data(initial_levels)
  313.  
  314.     #p @messages
  315.   end
  316.  
  317.  
  318.   #--------------------------------------------------------------------------
  319.   # * Generate data
  320.   # This method generates the object data.
  321.   #--------------------------------------------------------------------------
  322.   def generate_data(initial_levels)
  323.     i = 0
  324.     # Actors gain level
  325.     for actor in $game_party.actors
  326.       @actors_data.push (ResultActor.new(actor, initial_levels[i],  
  327.       [], 0))
  328.       count = 0
  329.       # Valid actor?
  330.       if actor.cant_get_exp? == false
  331.         difference = actor.level - @actors_initals_levels[i]
  332.         # Check diff so can gain levels or exp
  333.         if difference > 0
  334.          
  335.           # LEVEL UP.
  336.           @actors_data.last.gained_levels = difference
  337.          
  338.           # SKILL GAIN UP.
  339.           for lv in 0...difference
  340.             # If it have skills learning
  341.             for lea in $data_classes[actor.class_id].learnings
  342.               if lea.level ==  @actors_initals_levels[i] + lv
  343.                 @actors_data.last.gained_skills.push (lea.skill_id)
  344.               end
  345.             end
  346.           end
  347.         end
  348.       end
  349.       i += 1
  350.     end
  351.   end
  352.  
  353. end
  354.  
  355.  
  356.  
  357. module Wep
  358.   Scripts_list = [] unless defined? Scripts_list
  359.   Scripts_list.push ('Battle Result')
  360. end
  361.  
  362.  
  363.  
  364. #==============================================================================
  365. # ** Scene_Battle (part 1)
  366. #------------------------------------------------------------------------------
  367. #  This class performs battle screen processing.
  368. #==============================================================================
  369.  
  370. class Scene_Battle
  371.   #--------------------------------------------------------------------------
  372.   # * Main Processing
  373.   #--------------------------------------------------------------------------
  374.   alias wep_rbr_sb_main main
  375.   def main
  376.     @br_mark_end = false
  377.     wep_rbr_sb_main
  378.   end
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # * Start After Battle Phase
  382.   # moded to extract initial levels and call battle result
  383.   #--------------------------------------------------------------------------
  384.   def start_phase5
  385.     # Obtain extra info for battle result object
  386.     initial_levels = []
  387.     for ac in $game_party.actors
  388.       initial_levels.push (ac.level)
  389.     end
  390.     # Shift to phase 5
  391.     @phase = 5
  392.     # Play battle end ME
  393.     $game_system.me_play($game_system.battle_end_me)
  394.     # Return to BGM before battle started
  395.     $game_system.bgm_play($game_temp.map_bgm)
  396.     # Initialize EXP, amount of gold, and treasure
  397.     exp = 0
  398.     gold = 0
  399.     treasures = []
  400.     # Loop
  401.     for enemy in $game_troop.enemies
  402.       # If enemy is not hidden
  403.       unless enemy.hidden
  404.         # Add EXP and amount of gold obtained
  405.         exp += enemy.exp
  406.         gold += enemy.gold
  407.         # Determine if treasure appears
  408.         if rand(100) < enemy.treasure_prob
  409.           if enemy.item_id > 0
  410.             treasures.push($data_items[enemy.item_id])
  411.           end
  412.           if enemy.weapon_id > 0
  413.             treasures.push($data_weapons[enemy.weapon_id])
  414.           end
  415.           if enemy.armor_id > 0
  416.             treasures.push($data_armors[enemy.armor_id])
  417.           end
  418.         end
  419.       end
  420.     end
  421.     # Treasure is limited to a maximum of 6 items
  422.     treasures = treasures[0..5]
  423.     # Obtaining EXP
  424.     for i in 0...$game_party.actors.size
  425.       actor = $game_party.actors[i]
  426.       if actor.cant_get_exp? == false
  427.         last_level = actor.level
  428.         actor.exp += exp
  429.         if actor.level > last_level
  430.           @status_window.level_up(i)
  431.         end
  432.       end
  433.     end
  434.     # Obtaining gold
  435.     $game_party.gain_gold(gold)
  436.     # Obtaining treasure
  437.     for item in treasures
  438.       case item
  439.       when RPG::Item
  440.         $game_party.gain_item(item.id, 1)
  441.       when RPG::Weapon
  442.         $game_party.gain_weapon(item.id, 1)
  443.       when RPG::Armor
  444.         $game_party.gain_armor(item.id, 1)
  445.       end
  446.     end
  447.     # Make battle result
  448.     br = Battle_Result.new(initial_levels, exp, gold, treasures)
  449.     @result_window = Window_BattleResult.new(br)
  450.     # Set wait count
  451.     @phase5_wait_count = 100
  452.   end
  453.  
  454.   #--------------------------------------------------------------------------
  455.   # * Frame Update (after battle phase)
  456.   # moded so refresh battle result each time until it ends
  457.   #--------------------------------------------------------------------------
  458.   def update_phase5
  459.     # If wait count is larger than 0
  460.     if @phase5_wait_count > 0
  461.       # Decrease wait count
  462.       @phase5_wait_count -= 1
  463.       # If wait count reaches 0
  464.       if @phase5_wait_count == 0
  465.         # Show result window
  466.         @result_window.visible = true
  467.         # Clear main phase flag
  468.         $game_temp.battle_main_phase = false
  469.         # Refresh status window
  470.         @status_window.refresh
  471.       end
  472.       return
  473.     end
  474.    
  475.    
  476.  
  477.     # If C button was pressed advance battleresutl info
  478.     if Input.trigger?(Input::C)
  479.  
  480.      # Battle end only if +1 refresh of the window,so, the last have to
  481.      # be pressed
  482.      if @br_mark_end
  483.        battle_end(0)
  484.      end
  485.      
  486.      if not @result_window.refresh
  487.        @br_mark_end = true
  488.      end
  489.      
  490.     end
  491.    
  492.   end
  493. end
Expand to see the code.
@Mikepjr
You must study both scripts, and seach for the methods that each one change. There's no "magic solution" for this, you must look into both scripts, and make the fixes by yourself.
Who said anything about magic solutions?
I figure you might take interest considering it would add a much needed type of battle result style that your battle system seriously lacks considering that each style possible in your battle system is reminiscent of classic battle types in older games IE Chrono Trigger and final fantasy.. i was basically asking for help with this, seeing as how i'm not a scripter...
I'm not working on compatibility issues. For now i'm only working on the comissioned works and on the update of the system.
Alright... :sad:
Hi atoa! :kiss: quick question sir of the CT battle script:

On the Pose Animation section.... I created this:

Pose_Animation['test'] = {7 => {1 => [601, false]}, 15 => {1 => [602, false]}}

The pose animation works at the same time with animation ID... now how can i determine or change the same animation ID to make that animation ID flip or use another animation ID when using the same pose at a mirrored battle pose? for example:

"ANIMDIRECTIONPOSITION/10,12,14,16"

this uses different animations when in different direction of position... now how can i add that to the Pose_Animation so that way it knows which animation ID to use depending on the direction of position?
@susanM
Currently, there's no option for that, maybe i can add an option for that later.
ok thanks
for what im trying to do, i dont think its a good idea to use Pose_Animation because the animation ID when indicating a target, it targets the player so when setting a target flash color to the enemy, it flashes the target instead which is the player... so heres what i tried to use instead of pose_animation:

Weapon_Settings[23] =["MOVETYPE/MOVETOTARGET","ANIMDIRECTIONPOSITION/10,12,14,16"]

i tried this so that when a player equips certain weapon and that player attacks, it uses different animation ID when facing different position in battle... only problem to this is that i have a 15 frames attack pose and the animation ID doesnt appear until the attack pose is done. what my intentions were for the animation ID to appear on attack pose frame 1... so heres what i tried adding to the script line:


Weapon_Settings[23] =["MOVETYPE/MOVETOTARGET","ANIMDIRECTIONPOSITION/10,12,14,16","TIMEBEFOREANIM/10"]

only problem with this is that when i used "TIMEBEFOREANIM/01" the animation ID appears to target but does not show my attack pose frames. it only shows the first or up to second frame out of 15 frames of attack pose. So what i tried is to increase "TIMEBEFOREANIM/30". It showed the full attack pose frame but only problem is that the animation ID appears to target after the attack pose which makes it look like a lag... any possible way to have animation ID to appear to target right when the attack pose frame starts? and also i set Critical_Pose = 15. so when player does critical damage it uses pose 15... along with critical pose how can i assign an animation ID for the critical pose and make different animation ID for different direction of position in battle?
I got another question Atoa... at the Atoa ATB script:
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# SETTINGS OF ACTIONS THAT CHANGE THE ATB
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Actions that may cause changes on the target ATB

# Chance that all actions have to cancel skill cast of the target.
# This value is used for all actions that don't have individual definition.

Base_Cast_Cancel = 0


# Set here the chance that each action have of canceling the cast of target
#
# Cast_Cancel[Action_Type] = {Action_ID => Rate}
# Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
# Action_ID = ID of the skill, item or weapon
# Rate = chance of calceling cast, increases with damage caused.
#
# Important: if tha action is an physical skill, the weapon cancel chance is
# also applied (the values aren't added, each one are calculated separatedely)


I tried doing this to make Action_ID 82 (steal) to stop casting when hit and doesnt seem to work after following the instructions:
instructions:
Cast_Cancel[Action_Type] = {Action_ID => Rate}

Heres the edited lines:
Base_Cast_Cancel = 0
Cast_Cancel['Skill'] = {82 => 100}

I tried that and it didnt work, is the lines wrong?
Quote:
Weapon_Settings[23] =["MOVETYPE/MOVETOTARGET","ANIMDIRECTIONPOSITION/10,12,14,16","TIMEBEFOREANIM/10"]

only problem with this is that when i used "TIMEBEFOREANIM/01" the animation ID appears to target but does not show my attack pose frames. it only shows the first or up to second frame out of 15 frames of attack pose. So what i tried is to increase "TIMEBEFOREANIM/30". It showed the full attack pose frame but only problem is that the animation ID appears to target after the attack pose which makes it look like a lag...
The only way to solve this is trial and error, and find an wait value that suits the animation you planning, setting the time 0 will make the animation shows before the pose, and if the pose is too long, it may be skiped. Try values between 10~20.

Quote:
along with critical pose how can i assign an animation ID for the critical pose and make different animation ID for different direction of position in battle?
currently not possible, animations are based on the action, and for basic attacks it's based on the weapon.

About cast cancel, it works only for skills that deals damage. So, no damage, no cancel, i may review this later.
Just so you know, I'm still interested in hiring you. In fact, I've got the money. However, I need to send you my game archives, and I can't upload them since my Internet connection sucks.
@Juan J. Sánchez
Just send me all the info and everything needed via PM when you can.
thanks for clarification atoa!
"About cast cancel, it works only for skills that deals damage. So, no damage, no cancel, i may review this later."
That doesnt sound right cuz i tested it with damage and critical damage it still doesnt stop my casting when hit with or without critical.... i even tried skills that does damage such as Cast_Cancel['Skill'] = {57 => 100} .... 57 is cross cut skill that does damage...
for some reason it doesnt stop the caster with hit or critical damage... im I writing it wrong or Im I missing a word in the script?
@susanM
It's odd... i just tested the demo here and works fine.
are you adding more than one skill?

Something like this won't work:
Cast_Cancel['Skill'] = {57 => 100}
Cast_Cancel['Skill'] = {69 => 100}

since the second will replace the first
you need something like:
Cast_Cancel['Skill'] = {57 => 100, 69 => 100}
im only using one line... i cut and pasted Cast_Cancel['Skill'] = {57 => 100, 69 => 100} and used that line only and still doesnt work on the demo... the only scripts i used is Atoa ATB and Chrono Trigger Battle. Maybe I need to delete the Base_Cast_Cancel = 10


edit: Nope cant delete Base_Cast_Cancel = 10 It caused an error when deleted.... well heres my script line looks like...

  1. #==============================================================================
  2. # Atoa's Active Time Battle Version
  3. # By Atoa
  4. #==============================================================================
  5. # This Script adds a time bar system to the game
  6. # The configurations are explained below
  7. #==============================================================================
  8.  
  9. module Atoa  
  10.   # Do not remove or change these lines
  11.   Cast_Time = {}
  12.   Cast_Cancel = {}
  13.   ATB_Freeze = {}
  14.   ATB_Delay = {}
  15.   # Do not remove or change these lines
  16.  
  17.   # Waiting Mode
  18.   Wait_Mode = 0
  19.   # 0 = On Hold Battle: the bar stops to select actions, skills and itens
  20.   # 1 = Semi On Hold Battle: the bar stop to select itens and skills.
  21.   # 2 = 100% Active Battle: the bar will never stop.
  22.  
  23.   # Pause the bar when a battler is executing an action?
  24.   Wait_Act_End = true
  25.  
  26.   # Stop time bar during damage animation?
  27.   Pause_if_Damaged = true
  28.  
  29.   # Show individual time bars for the battlers?
  30.   Meters = true
  31.   # Hide individual meters toghter with the status screen?
  32.   Hide_Meters = true
  33.  
  34.   # Show a single bar that indicates the battler's action order?
  35.   Bars = true
  36.   # Hide singe bar toghter with the status screen?
  37.   Hide_Bars = false
  38.   # Time Bar Division
  39.   Dual_Bars = 50
  40.   # if lower than 0, the bar will not be divided, and actions with chanting
  41.   # will restart from the begin. If higher than 0, the value will show the %
  42.   # of the bar that will be reserved for casting (Like Grandia)
  43.  
  44.   # Battle Speed
  45.   Atb_Speed = 10.0
  46.  
  47.   # Initial bar value modifier
  48.   Atb_Initial_Value = 0
  49.  
  50.   # Multiplication rate of the initial bar value
  51.   Atb_Initial_Rate  = 1.0
  52.  
  53.   # ATB's maximum value, only change if you know what you doing.
  54.   Max_Atb = 500
  55.  
  56.   # Agility Modifier, The higher this value, the lower is the diference between
  57.   # battlers with different agility
  58.   Atb_Agi_Modifier = 50
  59.    
  60.   # Makes the bar gorws faster if no actor is active
  61.   Faster_if_inactive = false
  62.  
  63.   # Definition of turn shifting.
  64.   # This definition must be used for the duration of effects and
  65.   # battle event conditions
  66.   # This value does not count to enemies actions conditions
  67.   Custom_Turn_Count = 0
  68.   # 0 = By number of fighters
  69.   # 1 = By number of executed actions
  70.   # 2 = By time (in frames)
  71.  
  72.   # If 'Custom_Turn_Count = 1', define how many actions are equal to 1 turn
  73.   Action_Turn_Count = 10
  74.  
  75.   # If 'Custom_Turn_Count = 2', define how much time (in frames) are equal to 1 turn
  76.   Time_Tunr_Count = 1200 # 20 frames is about 1 second
  77.    
  78.   # Set the escape style
  79.   Escape_Type = 0
  80.   # 0 = Escape options is shown on the character's action menu
  81.   # 1 = Keep pressed the key set in Escape_Input to escape
  82.   #     shows a message on the screen
  83.   # 2 = Keep pressed the key set in Escape_Input to escape
  84.   #     shows an escape bar
  85.  
  86.   # Key that must be pressed to escape
  87.   Escape_Input = Input::X
  88.    
  89.   # Key that must be pressed to change the input battler
  90.   Next_Input = Input::B
  91.  
  92.   # Key that must be pressed to end battler turn
  93.   Cancel_Input = Input::A
  94.  
  95.   # Remember to not leave any equal input
  96.   # Input::A  = Keyborard:Z
  97.   # Input::B  = Keyborard:X
  98.   # Input::C  = Keyborard:C
  99.   # Input::X  = Keyborard:A
  100.   # Input::Y  = Keyborard:S
  101.   # Input::Z  = Keyborard:D
  102.   # Input::L  = Keyborard:Q
  103.   # Input::R  = Keyborard:W
  104.  
  105.   # Show the name for the escape option when Escape_Type = 0
  106.   Escape_Name = 'Escape'
  107.  
  108.   # Escape message when Escape_Type = 1
  109.   Escape_Message = 'Escaping...'
  110.   Cant_Escape_Message = "Can't Escape!"
  111.  
  112.   # Time (in frames) needed to escape when Escape_Type > 0
  113.   # it is affected by the agility of characters and enemies
  114.   Escape_Time = 400
  115.  
  116.   # Name of the graphic file when Escape_Type = 2
  117.   Escape_Skin = 'ESCAPEMeter'
  118.  
  119.   # Position of the Fleeing Bar
  120.   Escape_Meter_Pos_Type = 0
  121.   # 0 = Above the characters
  122.   # 1 = Upper-Mid of the screen
  123.   # 2 = Custom position
  124.  
  125.   # Custom position of the Fleeing Bar when Escape_Meter_Pos_Type = 2
  126.   Escape_Meter_Position = [240,64]
  127.  
  128.   # Time Bar configurations
  129.   Meter_Skin  = 'ATBMeter' # Graphic file name that represents the bars
  130.                            # must be on the Graphic/Windowskins folder
  131.  
  132.   # Position of the character's Time Bars
  133.   Meter_Pos_Style = 0
  134.   # 0 = Horizontal Pattern, not centralized
  135.   # 1 = Horizontal Pattern, centralized
  136.   # 2 = Vertical Bars
  137.   # 3 = Under the characters
  138.   # 4 = Above the characters
  139.   # 5 = Custom
  140.  
  141.   # Readjust the Time Bar's position on the battle screen
  142.   X_Meter = 12  # X position of the Bars
  143.   Y_Meter = 360 # Y position of the Bars
  144.  
  145.   # Custom Time Bar position, only valid when Meter_Pos_Style = 4
  146.   Meter_Position = [[460,180],[480,210],[500,240],[520,270]]
  147.  
  148.   # Coordinate 'Z' (height) of the Meter image if Meter_Pos_Style = 4
  149.   Meter_Height = 500
  150.  
  151.   # Position of the enemie's Time Bars
  152.   Enemy_Meter = 0
  153.   # 0 = No time bars for the enemies
  154.   # 1 = Under the enemy
  155.   # 2 = Above the enemy
  156.   # 3 = Vertical list on the Side
  157.  
  158.   # Configuration of the Action Bars.
  159.   Bar_Skin = 'ATBBar' # Name of the graphic file that represents the bar, must be
  160.                       # on the Graphics/Windowskins folder
  161.   X_Bar    = 128      # X position of the Bars
  162.   Y_Bar    =  80      # Y position of the Bars
  163.  
  164.   # Name of the default graphic Icon for characters
  165.   Default_Party_Icon = '050-Skill07'
  166.   # Individual character's Icons
  167.   # Must be configured on the following way:
  168.   # Party_Icon = {'Battler file name' => 'Icon file name',...}
  169.   Party_Icon = {
  170.     'Leon' => 'Atoa-Icon',
  171.     'Zelos' => 'Kahh-Icon',
  172.     'Chelsea' => 'DarkLuar-Icon',
  173.     'Klarth' => 'Tunicoelp-Icon',
  174.   }
  175.  
  176.   # Name of the default graphic Icon for enemies
  177.   Default_Enemy_Icon = '046-Skill03'
  178.   # Individual icons for enemies
  179.   # must be configured on the following way:
  180.   # Enemy_Icon => {'Battler file name' => 'Icon file name',...}
  181.   Enemy_Icon = {}
  182.  
  183.   # Sound effect played when teh character's turn comes. nil for no sound
  184.   Command_Up_SE = '046-Book01'
  185.      
  186.   #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
  187.   # CAST SETTINGS
  188.   #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
  189.   # Chanting default pose, if nil, no pose is used.
  190.   Chanting_Pose = nil
  191.  
  192.   # To add an pose to an skill or item, add this effect to the setting of the
  193.   # skill or the item.
  194.   # 'Chanting/**'
  195.   #   ** must be the Pose ID.
  196.  
  197.   # To set an chanting pose for an specific graphic, add this to the graphic setting:
  198.   # 'Chanting' => Pose ID.
  199.  
  200.   # Set here the cast time for each item and skill
  201.   # By default all items have the cast speed = 0 (that means, no cast).
  202.   #  
  203.   #   Cast_Time[Action_Type] = {Action_ID => [Speed, status]}
  204.   #     Action_Type = 'Skill' for skills, 'Item' for items
  205.   #     Action_ID = ID of the skill or item
  206.   #     Speed = cast speed, higher value = faster cast
  207.   #       recomended values between 500-100
  208.   #     Status = The status that the cast speed is based
  209.   #       if nil, the cast will have fixed speed
  210.   #       the status can be:
  211.   #         'hp', 'sp', 'level', 'str', 'dex', 'int', 'agi'
  212.  
  213.   Cast_Time['Skill'] = {1 => [500,'int'], 2 => [400,'int'], 3 => [300,'int'],
  214.     7 => [500,'int'], 8 => [400,'int'], 9 => [300,'int'], 10 => [500,'int'],
  215.     11 => [400,'int'], 12 => [300,'int'], 13 => [500,'int'], 14 => [400,'int'],
  216.     15 => [300,'int'], 16 => [500,'int'], 17 => [400,'int'], 18 => [300,'int'],
  217.     19 => [500,'int'], 20 => [400,'int'], 21 => [300,'int'], 22 => [500,'int'],
  218.     23 => [400,'int'], 24 => [300,'int'], 25 => [500,'int'], 26 => [400,'int'],
  219.     27 => [300,'int'], 28 => [500,'int'], 69 => [100,'int'], 57 => [100,nil]}
  220.  
  221.   Cast_Time['Item'] = {1 => [500,'int'], 2 => [500,'int'], 3 => [500,'int'],
  222.     7 => [500,'int'], 8 => [500,'int'], 9 => [500,'int'], 10 => [500,'int'],
  223.     11 => [500,'int'], 12 => [500,'int']}
  224.    
  225.   #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
  226.   # SETTINGS OF ACTIONS THAT CHANGE THE ATB
  227.   #¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
  228.   # Actions that may cause changes on the target ATB
  229.  
  230.   # Chance that all actions have to cancel skill cast of the target.
  231.   # This value is used for all actions that don't have individual definition.
  232.  
  233.   Base_Cast_Cancel = 10
  234.  
  235.   Cast_Cancel['Skill'] = {57 => 100, 69 => 100}
  236.  
  237.   # Set here the chance that each action have of canceling the cast of target
  238.   #  
  239.   #   Cast_Cancel[Action_Type] = {Action_ID => Rate}
  240.   #     Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
  241.   #     Action_ID = ID of the skill, item or weapon
  242.   #     Rate = chance of calceling cast, increases with damage caused.
  243.   #
  244.   # Important: if tha action is an physical skill, the weapon cancel chance is
  245.   #  also applied (the values aren't added, each one are calculated separatedely)
  246.  
  247.   #--------------------------------------------------------------------------
  248.   # Pause on the ATB bar when recive damage
  249.   # This value is used for all actions that don't have individual definition.
  250.   # Time in frames that the ATB bar will be stoped, increases with damage caused.
  251.   Base_ATB_Freeze = 0
  252.    
  253.   # Set here the actions that will cause ATB pause
  254.   #  
  255.   #   Cast_Cancel[Action_Type] = {Action_ID => Pause}
  256.   #     Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
  257.   #     Action_ID = ID of the skill, item or weapon
  258.   #     Pause = ATB pause time, increases with damage caused.
  259.   #
  260.   # Important: if tha action is an physical skill, the weapon pause is also calculated
  261.    
  262.   #--------------------------------------------------------------------------
  263.   # Delay on the ATB bar when recive damage
  264.   # This value is used for all actions that don't have individual definition.
  265.   Base_ATB_Delay = 0
  266.  
  267.   # Set here the actions that will cause ATB delay
  268.   #  
  269.   #   Cast_Cancel[Action_Type] = {Action_ID => Delay}
  270.   #     Action_Type = 'Skill' for skills, 'Item' for items, 'Weapon' for weapons
  271.   #     Action_ID = ID of the skill, item or weapon
  272.   #     Delay = ATB delay value, increases with damage caused.
  273.   #
  274.   # Important: if tha action is an physical skill, the weapon delay is also calculated
  275.  
  276. end
  277.  
  278. #==============================================================================
  279. # ** Atoa Module
  280. #==============================================================================
  281. $atoa_script = {} if $atoa_script.nil?
  282. $atoa_script['Atoa ATB'] = true
  283.  
  284. #==============================================================================
  285. # ** RPG::Skill
  286. #------------------------------------------------------------------------------
  287. # Class that manage skills
  288. #==============================================================================
  289.  
  290. class RPG::Skill
  291.   #----------------------------------------------------------------------------
  292.   # * Set action cast speed
  293.   #     battler : battler
  294.   #----------------------------------------------------------------------------
  295.   def cast_speed(battler)
  296.     if Cast_Time != nil and Cast_Time['Skill'] != nil and Cast_Time['Skill'][@id] != nil
  297.       cast1 = Cast_Time['Skill'][@id][0]
  298.       if Cast_Time['Skill'][@id][1].nil?
  299.         cast2 = 200
  300.       else
  301.         if Cast_Time['Skill'][@id][1] == 'level'
  302.           cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") * 2) + 100
  303.         elsif Cast_Time['Skill'][@id][1] == 'hp' or Cast_Time['Skill'][@id][1] == 'sp'
  304.           cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") / 50) + 100
  305.         else
  306.           cast2 = (eval("battler.#{Cast_Time['Skill'][@id][1]}") / 5) + 100
  307.         end
  308.       end
  309.       return (cast1 * cast2).to_i
  310.     end
  311.     return 0
  312.   end
  313. end
  314.  
  315. #==============================================================================
  316. # ** RPG::Item
  317. #------------------------------------------------------------------------------
  318. # Class that manage items
  319. #==============================================================================
  320.  
  321. class RPG::Item
  322.   #----------------------------------------------------------------------------
  323.   # * Set action cast speed
  324.   #     battler : battler
  325.   #----------------------------------------------------------------------------
  326.   def cast_speed(battler)
  327.     if Cast_Time != nil and Cast_Time['Item'] != nil and Cast_Time['Item'][@id] != nil
  328.       cast1 = Cast_Time['Item'][@id][0]
  329.       if Cast_Time['Item'][@id][1].nil?
  330.         cast2 = 200
  331.       else
  332.         if Cast_Time['Item'][@id][1] == 'level'
  333.           cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") * 2) + 100
  334.         elsif Cast_Time['Item'][@id][1] == 'hp' or Cast_Time['Item'][@id][1] == 'sp'
  335.           cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") / 50) + 100
  336.         else
  337.           cast2 = (eval("battler.#{Cast_Time['Item'][@id][1]}") / 5) + 100
  338.         end
  339.       end
  340.       return cast1 * cast2
  341.     end
  342.     return 0
  343.   end
  344. end
  345.  
  346. #==============================================================================
  347. # ** Game_Temp
  348. #------------------------------------------------------------------------------
  349. #  This class handles temporary data that is not included with save data.
  350. #  Refer to "$game_temp" for the instance of this class.
  351. #==============================================================================
  352.  
  353. class Game_Temp
  354.   #--------------------------------------------------------------------------
  355.   # * Public Instance Variables
  356.   #--------------------------------------------------------------------------
  357.   attr_accessor :max_escape_count
  358.   attr_accessor :escape_count
  359.   attr_accessor :hide_meters
  360.   attr_accessor :no_active_battler
  361.   #--------------------------------------------------------------------------
  362.   # * Object Initialization
  363.   #--------------------------------------------------------------------------
  364.   alias initialize_atb initialize
  365.   def initialize
  366.     initialize_atb
  367.     @max_escape_count = 0
  368.     @escape_count = 0
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # * Get escape line type
  372.   #--------------------------------------------------------------------------
  373.   def escape_atb_linetype
  374.     return 2 unless @battle_can_escape
  375.     return 1 if @battle_can_escape
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # * Get escap bar value
  379.   #--------------------------------------------------------------------------
  380.   def escape_atb_lineamount
  381.     return 100 * @escape_count / @max_escape_count if @battle_can_escape
  382.     return 100 unless @battle_can_escape
  383.   end
  384. end
  385.  
  386. #==============================================================================
  387. # ** Game_System
  388. #------------------------------------------------------------------------------
  389. #  This class handles data surrounding the system. Backround music, etc.
  390. #  is managed here as well. Refer to "$game_system" for the instance of
  391. #  this class.
  392. #==============================================================================
  393.  
  394. class Game_System
  395.   #--------------------------------------------------------------------------
  396.   # * Public Instance Variables
  397.   #--------------------------------------------------------------------------
  398.   attr_accessor :wait_mode
  399.   attr_accessor :action_wait
  400.   #--------------------------------------------------------------------------
  401.   # * Object Initialization
  402.   #--------------------------------------------------------------------------
  403.   alias initialize_atb initialize
  404.   def initialize
  405.     initialize_atb
  406.     @wait_mode = Wait_Mode
  407.     @action_wait = Wait_Act_End
  408.   end
  409. end
  410.  
  411. #==============================================================================
  412. # ** Sprite_Battler
  413. #------------------------------------------------------------------------------
  414. #  This sprite is used to display the battler.It observes the Game_Character
  415. #  class and automatically changes sprite conditions.
  416. #==============================================================================
  417.  
  418. class Sprite_Battler < RPG::Sprite
  419.   #--------------------------------------------------------------------------
  420.   # * Get idle pose ID
  421.   #--------------------------------------------------------------------------
  422.   alias set_idle_pose_atb set_idle_pose
  423.   def set_idle_pose
  424.     pose = set_idle_pose_atb
  425.     unless pose == Dead_Pose or pose == Victory_Pose
  426.       if battler.cast_action != nil
  427.         action = @battler.cast_action
  428.         cast_pose = set_pose_id('Chanting')
  429.         ext = check_extension(action, 'CHANTING/')
  430.         if ext != nil
  431.           ext.slice!('CHANTING/')
  432.           cast_pose = ext.to_i
  433.         end
  434.       end
  435.     end
  436.     return cast_pose.nil? ? pose : cast_pose
  437.   end
  438. end
  439.  
  440. #==============================================================================
  441. # ** Game_Battler
  442. #------------------------------------------------------------------------------
  443. #  This class deals with battlers. It's used as a superclass for the Game_Actor
  444. #  and Game_Enemy classes.
  445. #==============================================================================
  446.  
  447. class Game_Battler
  448.   #--------------------------------------------------------------------------
  449.   # * Public Instance Variables
  450.   #--------------------------------------------------------------------------
  451.   attr_accessor :atb
  452.   attr_accessor :cast_action
  453.   attr_accessor :casting
  454.   attr_accessor :cast_target
  455.   attr_accessor :turn_count
  456.   attr_accessor :guarding
  457.   attr_accessor :passed
  458.   attr_accessor :atb_delay
  459.   #--------------------------------------------------------------------------
  460.   # * Object Initialization
  461.   #--------------------------------------------------------------------------
  462.   alias initialize_atb initialize
  463.   def initialize
  464.     initialize_atb
  465.     @atb = 0
  466.     @cast_skill = 0
  467.     @turn_count = 0
  468.     @atb_delay = 0
  469.     @guarding = false
  470.     @passed = false
  471.     @casting = false
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # * Get ATB line type
  475.   #--------------------------------------------------------------------------
  476.   def atb_linetype
  477.     return 4 if self.cast_action != nil and self.atb_full?
  478.     return 3 if self.cast_action != nil
  479.     return 2 if self.atb_full?
  480.     return 1
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # * Get ATB line value
  484.   #--------------------------------------------------------------------------
  485.   def atb_lineamount
  486.     return 0 if self.dead?
  487.     return 100 * self.atb / self.max_atb
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * Casting flag
  491.   #--------------------------------------------------------------------------
  492.   def casting
  493.     return false if self.dead?
  494.     return @casting
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # * Get Max ATB
  498.   #--------------------------------------------------------------------------
  499.   def max_atb
  500.     return Max_Atb
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # * Set current ATB
  504.   #     n : new atb
  505.   #--------------------------------------------------------------------------
  506.   def atb=(n)
  507.     @atb = [[n.to_i, 0].max, self.max_atb].min
  508.   end
  509.   #--------------------------------------------------------------------------
  510.   # * ATB Preset
  511.   #--------------------------------------------------------------------------
  512.   def atb_preset
  513.     percent = self.max_atb * Atb_Initial_Rate * (rand(64) + 16) * (self.agi + Atb_Agi_Modifier) / total_agi / 1000
  514.     self.atb = Atb_Initial_Value + percent
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # * Battlers total agility
  518.   #--------------------------------------------------------------------------
  519.   def total_agi
  520.     total = 0
  521.     for battler in $game_party.actors + $game_troop.enemies
  522.       total += battler.agi
  523.     end
  524.     return total
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # * ATB full flag
  528.   #--------------------------------------------------------------------------
  529.   def atb_full?
  530.     return @atb == self.max_atb
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # * Update ATB
  534.   #--------------------------------------------------------------------------
  535.   def atb_update
  536.     if self.cast_action.nil?
  537.       self.atb += speed_adjust * 200 * (self.agi + Atb_Agi_Modifier) / total_agi / 100.0
  538.     else
  539.       cast = cast_action.cast_speed(self)
  540.       self.atb += speed_adjust * (cast + Atb_Agi_Modifier)  / total_agi / 100.0
  541.     end
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # * Speed adjust
  545.   #--------------------------------------------------------------------------
  546.   def speed_adjust
  547.     return $game_temp.no_active_battler ? Atb_Speed * 3.0 : Atb_Speed
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # * Final damage setting
  551.   #     user   : user
  552.   #     action : action
  553.   #--------------------------------------------------------------------------
  554.   alias set_damage_atb set_damage
  555.   def set_damage(user, action = nil)
  556.     set_damage_atb(user, action)
  557.     set_cast_cancel(user, action)
  558.     set_freeze_action(user, action)
  559.     set_delay_action(user, action)
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # * Set cast cancel action
  563.   #     user   : user
  564.   #     action : action
  565.   #--------------------------------------------------------------------------
  566.   def set_cast_cancel(user, action)
  567.     if action != nil and Cast_Cancel[action.type_name] != nil and
  568.        Cast_Cancel[action.type_name][action.id] != nil
  569.       cancel_cast(user, Cast_Cancel[action.type_name][action.id], action)
  570.       if action.type_name == 'Skill' and not action.magic?
  571.         for weapon in weapons
  572.           cancel_cast(user, Cast_Cancel['Weapon'][weapon.id], action)
  573.         end
  574.       end
  575.     else
  576.       cancel_cast(user, Base_Cast_Cancel, action)
  577.     end
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # * Set ATB freeze action
  581.   #     user   : user
  582.   #     action : action
  583.   #--------------------------------------------------------------------------
  584.   def set_freeze_action(user, action)
  585.     if action != nil and ATB_Freeze[action.type_name] != nil and
  586.        ATB_Freeze[action.type_name][action.id] != nil
  587.       freeze_action(user, ATB_Freeze[action.type_name][action.id], action)
  588.       if action.type_name == 'Skill' and not action.magic?
  589.         for weapon in weapons
  590.           freeze_action(user, ATB_Freeze['Weapon'][weapon.id], action)
  591.         end
  592.       end
  593.     else
  594.       freeze_action(user, Base_ATB_Freeze, action)
  595.     end
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # * Set ATB delay action
  599.   #     user   : user
  600.   #     action : action
  601.   #--------------------------------------------------------------------------
  602.   def set_delay_action(user, action)
  603.     if action != nil and ATB_Delay[action.type_name] != nil and
  604.        ATB_Delay[action.type_name][action.id] != nil
  605.       delay_action(user, ATB_Delay[action.type_name][action.id], action)
  606.       if action.type_name == 'Skill' and not action.magic?
  607.         for weapon in weapons
  608.           delay_action(user, ATB_Delay['Weapon'][weapon.id], action)
  609.         end
  610.       end
  611.     else
  612.       delay_action(user, Base_ATB_Delay, action)
  613.     end
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # * No freeze flag
  617.   #     user   : user
  618.   #     action : action
  619.   #--------------------------------------------------------------------------
  620.   def cant_cancel(user, action)
  621.     return true if check_include(action, "NODAMAGE")
  622.     return true if not user.target_damage[self].numeric?
  623.     return true if user.target_damage[self] < 0
  624.     return false
  625.   end
  626.   #--------------------------------------------------------------------------
  627.   # * Set cast cancel
  628.   #     user   : user
  629.   #     cast   : cancel chance
  630.   #     action : action
  631.   #--------------------------------------------------------------------------
  632.   def cancel_cast(user, cast, action)
  633.     return if cant_cancel(user, action)
  634.     rate =  cast + (cast * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
  635.     if rate > rand(100) and self.cast_action != nil
  636.       self.cast_action = nil
  637.       self.atb = 0
  638.     end
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # * Set ATB freeze
  642.   #     user   : user
  643.   #     delay  : delay value
  644.   #     action : action
  645.   #--------------------------------------------------------------------------
  646.   def freeze_action(user, delay, action)
  647.     return if cant_cancel(user, action)
  648.     rate =  delay + (delay * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
  649.     self.atb_delay += rate.to_i
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # * Set ATB delay
  653.   #     user   : user
  654.   #     delay  : delay value
  655.   #     action : action
  656.   #--------------------------------------------------------------------------
  657.   def delay_action(user, delay, action)
  658.     return if cant_cancel(user, action)
  659.     rate =  delay + (delay * (user.target_damage[self] * 50.0 / self.maxhp) / 100.0)
  660.     self.atb -= rate.to_i
  661.   end
  662. end
  663.  
  664. #==============================================================================
  665. # ** Game_Actor
  666. #------------------------------------------------------------------------------
  667. #  This class handles the actor. It's used within the Game_Actors class
  668. #  ($game_actors) and refers to the Game_Party class ($game_party).
  669. #==============================================================================
  670.  
  671. class Game_Actor < Game_Battler
  672.   #--------------------------------------------------------------------------
  673.   # * Decide if Command is Inputable
  674.   #--------------------------------------------------------------------------
  675.   def inputable?
  676.     return (self.atb_full? and super)
  677.   end
  678. end
  679.  
  680. #==============================================================================
  681. # ** Game_Enemy
  682. #------------------------------------------------------------------------------
  683. #  This class handles enemies. It's used within the Game_Troop class
  684. #  ($game_troop).
  685. #==============================================================================
  686.  
  687. class Game_Enemy < Game_Battler
  688.   #--------------------------------------------------------------------------
  689.   # * Decide if Action is Possible
  690.   #--------------------------------------------------------------------------
  691.   def movable?
  692.     return (self.atb_full? and super)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # * Get Battle Turn
  696.   #--------------------------------------------------------------------------
  697.   def get_battle_turn
  698.     return @turn_count
  699.   end
  700. end
  701.  
  702. #==============================================================================
  703. # ** Window_BattleStatus
  704. #------------------------------------------------------------------------------
  705. #  This window displays the status of all party members on the battle screen.
  706. #==============================================================================
  707.  
  708. class Window_BattleStatus < Window_Base
  709.   #--------------------------------------------------------------------------
  710.   # * Object Initialization
  711.   #--------------------------------------------------------------------------
  712.   alias anim_face_initialize initialize
  713.   def initialize
  714.     @atb_meters = ATB_Meters.new if Meters
  715.     @enm_meters = Enemy_Meters.new if Enemy_Meter > 0
  716.     @atb_bars = ATB_Bars.new if Bars
  717.     @alive_enemies = enemies_alive
  718.     @old_party = $game_party.actors
  719.     anim_face_initialize
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # * Refresh
  723.   #--------------------------------------------------------------------------
  724.   alias atb_battle_status_refresh refresh
  725.   def refresh
  726.     atb_battle_status_refresh
  727.     active_time_update
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # * Window visibility
  731.   #     n : opacity
  732.   #--------------------------------------------------------------------------
  733.   alias visible_atb visible=
  734.   def visible=(n)
  735.     visible_atb(n)
  736.     need_reset
  737.     @atb_meters.visible = n  if Hide_Meters and @atb_meters != nil
  738.     @atb_bars.visible = n if Hide_Bars and @atb_bars != nil
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # * Dispose
  742.   #--------------------------------------------------------------------------
  743.   alias atb_battle_status_dispose dispose
  744.   def dispose
  745.     atb_battle_status_dispose
  746.     @atb_meters.dispose if @atb_meters != nil
  747.     @enm_meters.dispose if @enm_meters != nil
  748.     @atb_bars.dispose if @atb_bars != nil
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # * Time bar update
  752.   #--------------------------------------------------------------------------
  753.   def active_time_update
  754.     need_reset
  755.     @atb_meters.refresh if @atb_meters != nil
  756.     @enm_meters.refresh if @enm_meters != nil
  757.     @atb_bars.refresh if @atb_bars != nil
  758.   end
  759.   #--------------------------------------------------------------------------
  760.   # * Check if bars need reset
  761.   #--------------------------------------------------------------------------
  762.   def need_reset
  763.     if (@alive_enemies != enemies_alive) or (@old_party != $game_party.actors)
  764.       @alive_enemies = enemies_alive
  765.       @old_party = $game_party.actors
  766.       reset_bars
  767.     end
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # * Get number of alive enemies
  771.   #--------------------------------------------------------------------------
  772.   def enemies_alive
  773.     alive = 0
  774.     for i in 0...$game_troop.enemies.size
  775.       alive += 1 unless $game_troop.enemies[i].dead?
  776.     end
  777.     return alive
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # * Reset time bars
  781.   #--------------------------------------------------------------------------
  782.   def reset_bars
  783.     @atb_meters.dispose if @atb_meters != nil
  784.     @enm_meters.dispose if @enm_meters != nil
  785.     @atb_bars.dispose if @atb_bars != nil
  786.     @atb_meters = ATB_Meters.new if Meters
  787.     @enm_meters = Enemy_Meters.new if Enemy_Meter > 0
  788.     @atb_bars = ATB_Bars.new if Bars
  789.   end
  790. end
  791.  
  792. #==============================================================================
  793. # ** ATB_Meters
  794. #------------------------------------------------------------------------------
  795. # Class that shows the time meters of actors
  796. #==============================================================================
  797.  
  798. class ATB_Meters
  799.   #--------------------------------------------------------------------------
  800.   # * Include Settings Module
  801.   #--------------------------------------------------------------------------
  802.   include Atoa
  803.   #--------------------------------------------------------------------------
  804.   # * Public Instance Variables
  805.   #--------------------------------------------------------------------------
  806.   attr_accessor :meters
  807.   #--------------------------------------------------------------------------
  808.   # * Object Initialization
  809.   #--------------------------------------------------------------------------
  810.   def initialize
  811.     @meters = []
  812.     @skin = RPG::Cache.windowskin(Meter_Skin)
  813.     i = 0
  814.     for actor in $game_party.actors
  815.       @meter = MeterSprite.new(@skin, 5)
  816.       refresh_meter(i)
  817.       i += 1
  818.     end
  819.     refresh
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # * Refresh
  823.   #--------------------------------------------------------------------------
  824.   def refresh
  825.     i = 0
  826.     for actor in $game_party.actors
  827.       @meters[i].line = actor.atb_linetype
  828.       @meters[i].amount = actor.atb_lineamount
  829.       @meters[i].refresh
  830.       @meters[i].atb_visible = true
  831.       i += 1
  832.     end
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # * Update meter
  836.   #     index : index
  837.   #--------------------------------------------------------------------------
  838.   def refresh_meter(index)
  839.     actor = $game_party.actors[index]
  840.     case Meter_Pos_Style
  841.     when 0
  842.       @meter.x = index * (624 / Max_Party) + 4 + X_Meter
  843.       @meter.y = Y_Meter
  844.       @meter.z = 1000
  845.     when 1
  846.       @meter.x = X_Meter + ((624 / Max_Party) * ((4 - $game_party.actors.size)/2.0 + index)).floor
  847.       @meter.y = Y_Meter
  848.       @meter.z = 1000
  849.     when 2
  850.       @meter.x = X_Meter
  851.       @meter.y = index * 32 + Y_Meter
  852.       @meter.z = 1000
  853.     when 3
  854.       @meter.x = actor.base_x - @skin.width / 2
  855.       @meter.y = actor.base_y - @skin.height / 5
  856.       @meter.z = 100
  857.     when 4
  858.       @meter.x = actor.base_x - @skin.width / 2
  859.       @meter.y = actor.base_y - @skin.height / 5 - 64
  860.       @meter.z = 2500
  861.     when 5
  862.       base = Meter_Position[index]
  863.       @meter.x = base[0]
  864.       @meter.y = base[1]
  865.       @meter.z = 2500
  866.     end
  867.     @meters[index] = @meter
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # * Window visibility
  871.   #     n : opacity
  872.   #--------------------------------------------------------------------------
  873.   def visible=(n)
  874.     @meters.each{|sprite| sprite.visible = n }
  875.   end
  876.   #--------------------------------------------------------------------------
  877.   # * Window opacity
  878.   #     n : opacity
  879.   #--------------------------------------------------------------------------
  880.   def opacity=(n)
  881.     @meters.each{|sprite| sprite.opacity = n }
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # * Dispose
  885.   #--------------------------------------------------------------------------
  886.   def dispose
  887.     @meters.each{|sprite| sprite.dispose }
  888.   end
  889. end
  890.  
  891. #==============================================================================
  892. # ** Enemy_Meters
  893. #------------------------------------------------------------------------------
  894. # Class that shows the time meters of enemies
  895. #==============================================================================
  896.  
  897. class Enemy_Meters
  898.   #--------------------------------------------------------------------------
  899.   # * Include Settings Module
  900.   #--------------------------------------------------------------------------
  901.   include Atoa
  902.   #--------------------------------------------------------------------------
  903.   # * Public Instance Variables
  904.   #--------------------------------------------------------------------------
  905.   attr_accessor :meters
  906.   #--------------------------------------------------------------------------
  907.   # * Object Initialization
  908.   #--------------------------------------------------------------------------
  909.   def initialize
  910.     @meters = []
  911.     @skin = RPG::Cache.windowskin(Meter_Skin)
  912.     i = 0
  913.     for enemy in $game_troop.enemies
  914.       next if enemy.dead? and not [1,2].include?(Enemy_Meter)
  915.       @meter = MeterSprite.new(@skin, 5)
  916.       refresh_meter(i)
  917.       i += 1
  918.     end
  919.     refresh
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # * Refresh
  923.   #--------------------------------------------------------------------------
  924.   def refresh
  925.     i = 0
  926.     for enemy in $game_troop.enemies
  927.       next if enemy.dead? and not [1,2].include?(Enemy_Meter)
  928.       @meters[i].line = enemy.atb_linetype
  929.       @meters[i].amount = enemy.atb_lineamount
  930.       @meters[i].refresh
  931.       @meters[i].atb_visible = (enemy.dead? and [1,2].include?(Enemy_Meter)) ? false : true
  932.       @meters[i].visible = (enemy.dead? and [1,2].include?(Enemy_Meter)) ? false : true
  933.       i += 1
  934.     end
  935.   end
  936.   #--------------------------------------------------------------------------
  937.   # * Update meter
  938.   #     index : index
  939.   #--------------------------------------------------------------------------
  940.   def refresh_meter(index)
  941.     enemy = $game_troop.enemies[index]
  942.     case Enemy_Meter
  943.     when 1
  944.       @meter.x = enemy.base_x - @skin.width / 2
  945.       @meter.y = enemy.base_y - @skin.height / 5
  946.       @meter.z = 100
  947.     when 2
  948.       @meter.x = enemy.base_x - @skin.width / 2
  949.       @meter.y = enemy.base_y - @skin.height / 5 - 64
  950.       @meter.z = 1000
  951.     when 3
  952.       @meter.x = 32
  953.       @meter.y = 80 + index * 32
  954.       @meter.z = 3000
  955.     end
  956.     @meters[index] = @meter
  957.   end
  958.   #--------------------------------------------------------------------------
  959.   # * Window visibility
  960.   #     n : opacity
  961.   #--------------------------------------------------------------------------
  962.   def visible=(n)
  963.     @meters.each{|sprite| sprite.visible = n }
  964.   end
  965.   #--------------------------------------------------------------------------
  966.   # * Window opacity
  967.   #     n : opacity
  968.   #--------------------------------------------------------------------------
  969.   def opacity=(n)
  970.     @meters.each{|sprite| sprite.opacity = n }
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # * Dispose
  974.   #--------------------------------------------------------------------------
  975.   def dispose
  976.     @meters.each{|sprite| sprite.dispose }
  977.   end
  978. end
  979.  
  980. #==============================================================================
  981. # ** Escape_Meters
  982. #------------------------------------------------------------------------------
  983. # Class that shows the escape meters
  984. #==============================================================================
  985.  
  986. class Escape_Meters
  987.   #--------------------------------------------------------------------------
  988.   # * Include Settings Module
  989.   #--------------------------------------------------------------------------
  990.   include Atoa
  991.   #--------------------------------------------------------------------------
  992.   # * Object Initialization
  993.   #--------------------------------------------------------------------------
  994.   def initialize
  995.     @skin = RPG::Cache.windowskin(Escape_Skin)
  996.     @escape_meter = MeterSprite.new(@skin, 3)
  997.     refresh_meter
  998.     refresh
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # * Refresh
  1002.   #--------------------------------------------------------------------------
  1003.   def refresh
  1004.     @escape_meter.line   = $game_temp.escape_atb_linetype
  1005.     @escape_meter.amount = $game_temp.escape_atb_lineamount
  1006.     @escape_meter.z = 5000
  1007.     @escape_meter.refresh
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # * Update meter
  1011.   #--------------------------------------------------------------------------
  1012.   def refresh_meter
  1013.     case Escape_Meter_Pos_Type
  1014.     when 0
  1015.       @escape_meter.x = 608 - @skin.width
  1016.       @escape_meter.y = 80
  1017.     when 1
  1018.       @escape_meter.x = 320 - skin.width
  1019.       @escape_meter.y = 64
  1020.     when 2
  1021.       @escape_meter.x = Escape_Meter_Position[0]
  1022.       @escape_meter.y = Escape_Meter_Position[1]
  1023.     end
  1024.     @escape_meter.z = 5000
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # * Window visibility
  1028.   #     n : opacity
  1029.   #--------------------------------------------------------------------------
  1030.   def visible=(n)
  1031.     @escape_meter.visible = n
  1032.   end
  1033.   #--------------------------------------------------------------------------
  1034.   # * Window opacity
  1035.   #     n : opacity
  1036.   #--------------------------------------------------------------------------
  1037.   def opacity=(n)
  1038.     @escape_meter.opacity = n
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # * Dispose
  1042.   #--------------------------------------------------------------------------
  1043.   def dispose
  1044.     @escape_meter.dispose
  1045.   end
  1046. end
  1047.  
  1048. #==============================================================================
  1049. # ** MeterSprite
  1050. #------------------------------------------------------------------------------
  1051. # Class that draws all bars
  1052. #==============================================================================
  1053.  
  1054. class MeterSprite < Sprite
  1055.   #--------------------------------------------------------------------------
  1056.   # * Include Settings Module
  1057.   #--------------------------------------------------------------------------
  1058.   include Atoa
  1059.   #--------------------------------------------------------------------------
  1060.   # * Public Instance Variables
  1061.   #--------------------------------------------------------------------------
  1062.   attr_accessor :line
  1063.   attr_accessor :amount
  1064.   #--------------------------------------------------------------------------
  1065.   # * Object Initialization
  1066.   #     skin        : bar bitmap
  1067.   #     line_number : line number
  1068.   #--------------------------------------------------------------------------
  1069.   def initialize(skin, line_number)
  1070.     @line_number = line_number
  1071.     @skin   = skin
  1072.     @width  = @skin.width
  1073.     @height = @skin.height / @line_number
  1074.     @line   = 1
  1075.     @amount = 0
  1076.     @atb_visible = false
  1077.     @base_sprite.dispose if @base_sprite != nil
  1078.     @base_sprite = Sprite.new
  1079.     @base_sprite.bitmap = @skin
  1080.     @base_sprite.src_rect.set(0, 0, @width, @height)
  1081.     super()
  1082.     self.bitmap = @skin
  1083.     self.line = 1
  1084.     self.opacity = 0 if @line_number == 3
  1085.   end
  1086.   #--------------------------------------------------------------------------
  1087.   # * Window visibility
  1088.   #     n : opacity
  1089.   #--------------------------------------------------------------------------
  1090.   def visible=(n)
  1091.     @base_sprite.visible = n
  1092.     super
  1093.   end
  1094.   #--------------------------------------------------------------------------
  1095.   # * Window opacity
  1096.   #     n : opacity
  1097.   #--------------------------------------------------------------------------
  1098.   def opacity=(n)
  1099.     @base_sprite.opacity = n
  1100.     super
  1101.   end
  1102.   #--------------------------------------------------------------------------
  1103.   # * ATB visibility flag
  1104.   #     n : visibility flag
  1105.   #--------------------------------------------------------------------------
  1106.   def atb_visible=(n)
  1107.     @atb_visible = n
  1108.     refresh
  1109.   end
  1110.   #--------------------------------------------------------------------------
  1111.   # * Refresh
  1112.   #--------------------------------------------------------------------------
  1113.   def refresh
  1114.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  1115.   end
  1116.   #--------------------------------------------------------------------------
  1117.   # * Sprite X coordinate
  1118.   #     n : new value
  1119.   #--------------------------------------------------------------------------
  1120.   def x=(n)
  1121.     super
  1122.     @base_sprite.x = n
  1123.   end
  1124.   #--------------------------------------------------------------------------
  1125.   # * Sprite Y coordinate
  1126.   #     n : new value
  1127.   #--------------------------------------------------------------------------
  1128.   def y=(n)
  1129.     super
  1130.     @base_sprite.y = n
  1131.   end
  1132.   #--------------------------------------------------------------------------
  1133.   # * Sprite Z coordinate
  1134.   #     n : new value
  1135.   #--------------------------------------------------------------------------
  1136.   def z=(n)
  1137.     super
  1138.     @base_sprite.z = z - 1
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # * Dispose
  1142.   #--------------------------------------------------------------------------
  1143.   def dispose
  1144.     @base_sprite.dispose
  1145.     super
  1146.   end
  1147. end
  1148.  
  1149. #==============================================================================
  1150. # ** ATB_Bars
  1151. #------------------------------------------------------------------------------
  1152. # Class that shows the bar and icons for battle flow
  1153. #==============================================================================
  1154.  
  1155. class ATB_Bars
  1156.   #--------------------------------------------------------------------------
  1157.   # * Include Settings Module
  1158.   #--------------------------------------------------------------------------
  1159.   include Atoa
  1160.   #--------------------------------------------------------------------------
  1161.   # * Public Instance Variables
  1162.   #--------------------------------------------------------------------------
  1163.   def initialize
  1164.     @base = Sprite.new
  1165.     @base.bitmap = RPG::Cache.windowskin(Bar_Skin).dup
  1166.     @base.x = X_Bar + 8
  1167.     @base.y = Y_Bar
  1168.     @base.z = 3000
  1169.     @width  = @base.bitmap.width
  1170.     @height = @base.bitmap.height
  1171.     @iconset = {}
  1172.     @base.opacity = self.opacity = 255
  1173.     refresh
  1174.   end
  1175.   #--------------------------------------------------------------------------
  1176.   # * Object Initialization
  1177.   #--------------------------------------------------------------------------
  1178.   def refresh
  1179.     return @base.opacity = self.opacity = 0 unless Bars
  1180.     need_refresh = []
  1181.     for battler in $game_party.actors + $game_troop.enemies
  1182.       update_icon = false
  1183.       update_icon |= [email protected]?(battler)
  1184.       for key in @iconset.keys
  1185.         update_icon |= @iconset[key].last != battler.battler_name
  1186.       end
  1187.       need_refresh << battler if update_icon
  1188.     end
  1189.     for battler in need_refresh
  1190.       @iconset[battler] = [Sprite.new, battler.battler_name] if @iconset[battler].nil?
  1191.       iconname = nil
  1192.       if battler.is_a?(Game_Actor)
  1193.         iconname = Party_Icon[battler.battler_name]
  1194.       else
  1195.         iconname = Enemy_Icon[battler.battler_name]
  1196.       end
  1197.       if iconname.nil?
  1198.         if battler.is_a?(Game_Actor)
  1199.           iconname = Default_Party_Icon
  1200.         else
  1201.           iconname = Default_Enemy_Icon
  1202.         end
  1203.       end
  1204.       @iconset[battler].first.bitmap = RPG::Cache.icon(iconname).dup
  1205.       @iconset[battler].first.y = Y_Bar + @height / 2 - 12
  1206.     end
  1207.     icons_update
  1208.     self.visible = $game_temp.hide_windows ? false : true
  1209.   end
  1210.   #--------------------------------------------------------------------------
  1211.   # * Update Icons
  1212.   #--------------------------------------------------------------------------
  1213.   def icons_update
  1214.     for battler in @iconset.keys
  1215.       unless ($game_party.actors + $game_troop.enemies).include?(battler)
  1216.         @iconset[battler].first.dispose
  1217.         @iconset[battler] = nil
  1218.         @iconset.delete(battler)
  1219.         next
  1220.       end
  1221.       icon = @iconset[battler]
  1222.       wid = @width - 12
  1223.       if Dual_Bars > 0
  1224.         if battler.cast_action != nil
  1225.           bar1 = (100 - Dual_Bars) * wid / 100.0
  1226.           bar2 = Dual_Bars * wid / 100.0
  1227.           icon.first.x = X_Bar + bar1 + (bar2  * battler.atb / battler.max_atb)
  1228.         else
  1229.           bar1 = (100 - Dual_Bars) * wid / 100.0
  1230.           icon.first.x =  X_Bar + (bar1 * battler.atb / battler.max_atb)
  1231.         end
  1232.       else
  1233.         icon.first.x = X_Bar + wid * battler.atb / battler.max_atb
  1234.       end
  1235.       icon.first.x = X_Bar + wid if (battler.active? or battler.action?) and
  1236.                                      battler.cast_action.nil?
  1237.       icon.first.z = 3001 + icon.first.x
  1238.       icon.first.visible = battler.exist?
  1239.       icon.first.opacity = battler.exist? ? 255 : 0
  1240.     end
  1241.   end
  1242.   #--------------------------------------------------------------------------
  1243.   # * Window visibility
  1244.   #     n : opacity
  1245.   #--------------------------------------------------------------------------
  1246.   def visible=(n)
  1247.     @base.visible = n
  1248.     for icon in @iconset.values
  1249.       icon.first.visible = n
  1250.     end
  1251.   end
  1252.   #--------------------------------------------------------------------------
  1253.   # * Window opacity
  1254.   #     n : opacity
  1255.   #--------------------------------------------------------------------------
  1256.   def opacity=(n)
  1257.     @base.opacity = n
  1258.     for icon in @iconset.values
  1259.       icon.first.opacity = n
  1260.     end
  1261.   end
  1262.   #--------------------------------------------------------------------------
  1263.   # * Dispose
  1264.   #--------------------------------------------------------------------------
  1265.   def dispose
  1266.     @base.dispose
  1267.     for icon in @iconset.values
  1268.       icon.first.dispose
  1269.     end
  1270.   end
  1271. end
  1272.  
  1273. #==============================================================================
  1274. # ** Interpreter
  1275. #------------------------------------------------------------------------------
  1276. #  This interpreter runs event commands. This class is used within the
  1277. #  Game_System class and the Game_Event class.
  1278. #==============================================================================
  1279.  
  1280. class Interpreter
  1281.   #--------------------------------------------------------------------------
  1282.   # * Force Action
  1283.   #--------------------------------------------------------------------------
  1284.   def command_339
  1285.     return true unless $game_temp.in_battle
  1286.     iterate_battler(@parameters[0], @parameters[1]) do |battler|
  1287.       if battler.exist?
  1288.         battler.current_action.kind = @parameters[2]
  1289.         if battler.current_action.kind == 0
  1290.           battler.current_action.basic = @parameters[3]
  1291.         else
  1292.           battler.current_action.skill_id = @parameters[3]
  1293.         end
  1294.         if @parameters[4] == -2
  1295.           if battler.is_a?(Game_Enemy)
  1296.             battler.current_action.decide_last_target_for_enemy
  1297.           else
  1298.             battler.current_action.decide_last_target_for_actor
  1299.           end
  1300.         elsif @parameters[4] == -1
  1301.           if battler.is_a?(Game_Enemy)
  1302.             battler.current_action.decide_random_target_for_enemy
  1303.           else
  1304.             battler.current_action.decide_random_target_for_actor
  1305.           end
  1306.         elsif @parameters[4] >= 0
  1307.           battler.current_action.target_index = @parameters[4]
  1308.         end
  1309.         battler.current_action.forcing = true
  1310.         if battler.current_action.valid? and @parameters[5] == 1
  1311.           $game_temp.forcing_battler = battler
  1312.           @index += 1
  1313.           return false
  1314.         end
  1315.       end
  1316.     end
  1317.     return true
  1318.   end
  1319. end
  1320.  
  1321. #==============================================================================
  1322. # ** Scene_Battle
  1323. #------------------------------------------------------------------------------
  1324. #  This class performs battle screen processing.
  1325. #==============================================================================
  1326.  
  1327. class Scene_Battle
  1328.   #--------------------------------------------------------------------------
  1329.   # * Public Instance Variables
  1330.   #--------------------------------------------------------------------------
  1331.   attr_accessor :no_active_battler
  1332.   #--------------------------------------------------------------------------
  1333.   # * Main Processing
  1334.   #--------------------------------------------------------------------------
  1335.   alias main_atb main
  1336.   def main
  1337.     turn_count_speed  
  1338.     $game_temp.escape_count = 0
  1339.     $game_temp.hide_meters = false
  1340.     $game_temp.no_active_battler = true
  1341.     @escape_type = Escape_Type
  1342.     @escape_name = Escape_Name
  1343.     @input_battlers = []
  1344.     @action_battlers = []
  1345.     @input_battler = nil
  1346.     @action_battler = nil
  1347.     @escaped = false
  1348.     @update_turn_end = false
  1349.     @action_phase = false
  1350.     @freeze_atb = []
  1351.     main_atb
  1352.   end
  1353.   #--------------------------------------------------------------------------
  1354.   # * Start processing
  1355.   #--------------------------------------------------------------------------
  1356.   alias start_atb start
  1357.   def start
  1358.     start_atb
  1359.     for battler in $game_party.actors + $game_troop.enemies
  1360.       battler.turn_count = 0
  1361.       battler.atb = 0
  1362.       battler.atb_preset
  1363.       battler.cast_action = nil
  1364.       battler.cast_target = nil
  1365.       battler.defense_pose = false
  1366.     end
  1367.   end
  1368.   #--------------------------------------------------------------------------
  1369.   # * Reset time bars
  1370.   #--------------------------------------------------------------------------
  1371.   def reset_bars
  1372.     @status_window.reset_bars
  1373.   end
  1374.   #--------------------------------------------------------------------------
  1375.   # * Frame Update
  1376.   #--------------------------------------------------------------------------
  1377.   alias update_atb update
  1378.   def update
  1379.     update_battle_phases
  1380.     check_active_battler
  1381.     return $scene = Scene_Gameover.new if $game_temp.gameover
  1382.     update_atb
  1383.     return update_phase5 if @phase == 5
  1384.     return if $game_system.battle_interpreter.running? and $game_temp.forcing_battler.nil?
  1385.     update_turn_ending if @update_turn_end
  1386.     update_escape
  1387.     return if @escaped
  1388.     atb_update
  1389.     input_battler_update
  1390.     action_battler_update
  1391.   end
  1392.   #--------------------------------------------------------------------------
  1393.   # * Basic Update Processing
  1394.   #--------------------------------------------------------------------------
  1395.   alias update_basic_atb update_basic
  1396.   def update_basic
  1397.     update_basic_atb
  1398.     windows_dispose if @active_battler != nil and @active_battler.hp0?
  1399.   end
  1400.   #--------------------------------------------------------------------------
  1401.   # * Battle phases update
  1402.   #--------------------------------------------------------------------------
  1403.   def update_battle_phases
  1404.     if @phase == 1
  1405.       $game_temp.battle_main_phase = true
  1406.       @actor_command_window.opacity = 0
  1407.       @phase = 0
  1408.     elsif @phase != 5
  1409.       @phase = 0
  1410.     end
  1411.   end
  1412.   #--------------------------------------------------------------------------
  1413.   # * Action battler update
  1414.   #--------------------------------------------------------------------------
  1415.   def action_battler_update
  1416.     if @action_battlers[0] != nil
  1417.       @action_battlers.flatten!
  1418.       battler = @action_battlers[0]
  1419.       battler.atb = 0 if battler.dead?
  1420.     end
  1421.     update_phase4
  1422.   end
  1423.   #--------------------------------------------------------------------------
  1424.   # * Check Active battler
  1425.   #--------------------------------------------------------------------------
  1426.   def check_active_battler
  1427.     no_active = (@action_battlers.empty? and @active_battlers.empty? and @input_battlers.empty?)
  1428.     $game_temp.no_active_battler = Faster_if_inactive ? no_active : false
  1429.   end
  1430.   #--------------------------------------------------------------------------
  1431.   # * Update battler inupt
  1432.   #--------------------------------------------------------------------------
  1433.   def input_battler_update
  1434.     check_battler_turn
  1435.     set_input_battle
  1436.     command_window_setup_update
  1437.     clear_disabled_battler
  1438.   end
  1439.   #--------------------------------------------------------------------------
  1440.   # * Check battler turn
  1441.   #--------------------------------------------------------------------------
  1442.   def check_battler_turn
  1443.     for battler in $game_party.actors + $game_troop.enemies
  1444.       if (battler.atb_full? or $game_temp.forcing_battler == battler) and not
  1445.          @action_battlers.include?(battler) and not
  1446.          @active_battlers.include?(battler) and not
  1447.          @input_battlers.include?(battler)
  1448.         battler_turn(battler)
  1449.         break
  1450.       end
  1451.     end
  1452.   end
  1453.   #--------------------------------------------------------------------------
  1454.   # * Set battler input
  1455.   #--------------------------------------------------------------------------
  1456.   def set_input_battle
  1457.     if @input_battlers[0] != nil and @input_battler.nil? and !wait_on and
  1458.        ((@active_battlers.empty? and $game_system.action_wait) or not $game_system.action_wait)
  1459.       @input_battlers.flatten!
  1460.       @input_battler = @input_battlers[0]
  1461.       if @input_battler.current_action.forcing or @input_battler.confused?
  1462.         if @input_battler.confused?
  1463.           @input_battler.current_action.kind = 0
  1464.           @input_battler.current_action.basic = 0
  1465.         end
  1466.         @input_battler.defense_pose = false
  1467.         @action_battlers << @input_battlers.shift
  1468.         @action_battlers.compact!
  1469.         @input_battler = nil
  1470.       elsif @input_battler.inputable?
  1471.         @actor_index = $game_party.actors.index(@input_battler)
  1472.         @input_battler.current_action.clear
  1473.       else
  1474.         @input_battler.atb_update
  1475.         @input_battlers.shift
  1476.         @input_battler = nil
  1477.       end
  1478.     end
  1479.   end
  1480.   #--------------------------------------------------------------------------
  1481.   # * Update command window
  1482.   #--------------------------------------------------------------------------
  1483.   def command_window_setup_update
  1484.     if @input_battler != nil
  1485.       @input_battler.defense_pose = false
  1486.       @input_battler.blink = true
  1487.       @active_battler = @input_battler
  1488.       if @actor_command_window.opacity == 0
  1489.         $game_system.se_play(RPG::AudioFile.new(Command_Up_SE)) if @active_battler.cast_action.nil? and Command_Up_SE != nil
  1490.         phase3_setup_command_window
  1491.       end
  1492.       update_phase3
  1493.     end
  1494.   end
  1495.   #--------------------------------------------------------------------------
  1496.   # * Clear disbled battlers
  1497.   #--------------------------------------------------------------------------
  1498.   def clear_disabled_battler
  1499.     for battler in $game_party.actors + $game_troop.enemies
  1500.       next if battler.exist?
  1501.       @input_battlers.delete(battler)
  1502.       @action_battlers.delete(battler)
  1503.     end
  1504.   end
  1505.   #--------------------------------------------------------------------------
  1506.   # * Escape update
  1507.   #--------------------------------------------------------------------------
  1508.   def update_escape
  1509.     if Input.press?(Escape_Input) and @escape_type > 0
  1510.       if $game_temp.battle_can_escape
  1511.         update_escape_message
  1512.       else
  1513.         update_cant_escape
  1514.       end
  1515.     elsif @escape_type > 0
  1516.       update_escape_meter
  1517.     end
  1518.   end
  1519.   #--------------------------------------------------------------------------
  1520.   # * Escape message update
  1521.   #--------------------------------------------------------------------------
  1522.   def update_escape_message
  1523.     $game_temp.max_escape_count = update_escape_rate
  1524.     $game_temp.escape_count += 2 unless wait_on
  1525.     @escaping = true
  1526.     update_escape_type_1 if !@help_window.visible and @escape_type == 1
  1527.     update_escape_type_2 if @escape_type == 2
  1528.     if $game_temp.escape_count >= $game_temp.max_escape_count
  1529.       $game_temp.escape_count = 0
  1530.       update_phase2_escape unless $game_party.all_dead?
  1531.     end
  1532.   end
  1533.   #--------------------------------------------------------------------------
  1534.   # * Update escape type 1
  1535.   #--------------------------------------------------------------------------
  1536.   def update_escape_type_1
  1537.     @help_window.set_text('')
  1538.     @help_window.set_text(Escape_Message, 1)
  1539.   end
  1540.   #--------------------------------------------------------------------------
  1541.   # * Update escape type 2
  1542.   #--------------------------------------------------------------------------
  1543.   def update_escape_type_2
  1544.     if @escape_atb_meters.nil?
  1545.       @escape_atb_meters = Escape_Meters.new
  1546.       @escape_meter_opacity = 0
  1547.       @escape_atb_meters.visible = true
  1548.     else @escape_atb_meters != nil
  1549.       @escape_atb_meters.opacity = 15 * @escape_meter_opacity
  1550.       @escape_meter_opacity = [@escape_meter_opacity + 1, 17].min
  1551.       @escape_atb_meters.refresh
  1552.     end
  1553.   end
  1554.   #--------------------------------------------------------------------------
  1555.   # * Update can't escape
  1556.   #--------------------------------------------------------------------------
  1557.   def update_cant_escape
  1558.     @help_window.set_text(Cant_Escape_Message, 1) if @escape_type == 1        
  1559.     if @escape_type == 2      
  1560.       if @escape_atb_meters.nil?
  1561.         @escape_atb_meters = Escape_Meters.new
  1562.         @escape_meter_opacity = 0
  1563.         @escape_atb_meters.visible = true
  1564.       else @escape_atb_meters != nil
  1565.         @escape_atb_meters.opacity = 15 * @escape_meter_opacity
  1566.         @escape_meter_opacity = [@escape_meter_opacity + 1, 17].min
  1567.         @escape_atb_meters.refresh
  1568.       end
  1569.     end
  1570.   end
  1571.   #--------------------------------------------------------------------------
  1572.   # * Update escape metter
  1573.   #--------------------------------------------------------------------------
  1574.   def update_escape_meter
  1575.     if @escaping
  1576.       @escaping = false
  1577.       @help_window.visible = false
  1578.     end
  1579.     $game_temp.escape_count = [$game_temp.escape_count - 1, 0].max unless wait_on
  1580.     if @escape_atb_meters != nil and $game_temp.escape_count == 0
  1581.       @escape_atb_meters.opacity = 15 * @escape_meter_opacity
  1582.       @escape_meter_opacity = [@escape_meter_opacity - 1, 0].max
  1583.       if @escape_meter_opacity == 0
  1584.         @escape_atb_meters.dispose
  1585.         @escape_atb_meters = nil
  1586.       end
  1587.     end
  1588.     @escape_atb_meters.refresh if @escape_atb_meters != nil
  1589.   end
  1590.   #--------------------------------------------------------------------------
  1591.   # * Start battler turn
  1592.   #     battler : battler
  1593.   #--------------------------------------------------------------------------
  1594.   def battler_turn(battler)
  1595.     battler.turn_count += 1
  1596.     if battler.is_a?(Game_Actor)
  1597.       if battler.inputable? and battler.cast_action.nil?
  1598.         @input_battlers << battler
  1599.         @input_battlers.compact!
  1600.       else
  1601.         if battler.confused?
  1602.           battler.current_action.kind = 0
  1603.           battler.current_action.basic = 0
  1604.         end
  1605.         battler.defense_pose = false
  1606.         @action_battlers << battler
  1607.         @action_battlers.compact!
  1608.       end
  1609.     else
  1610.       set_enemy_action(battler)
  1611.     end
  1612.   end
  1613.   #--------------------------------------------------------------------------
  1614.   # * Set enemy action
  1615.   #     battler : battler
  1616.   #--------------------------------------------------------------------------
  1617.   def set_enemy_action(battler)
  1618.     if battler.current_action.forcing or $game_temp.forcing_battler
  1619.       battler.current_action.forcing = false
  1620.       $game_temp.forcing_battler = nil
  1621.     else
  1622.       battler.make_action
  1623.     end
  1624.     @action_battlers << battler
  1625.     @action_battlers.compact!
  1626.   end
  1627.   #--------------------------------------------------------------------------
  1628.   # * Turn Ending
  1629.   #--------------------------------------------------------------------------
  1630.   def turn_ending
  1631.   end  
  1632.   #--------------------------------------------------------------------------
  1633.   # * Update Turn Ending
  1634.   #--------------------------------------------------------------------------
  1635.   def update_turn_ending
  1636.     slip_damage_all if Slip_Damage_Pop_Time == 2
  1637.     @update_turn_end = false
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # * Update ATB
  1641.   #--------------------------------------------------------------------------
  1642.   def atb_update
  1643.     update_meters
  1644.     return if wait_on
  1645.     @atb_turn_count += 1 if Custom_Turn_Count == 2
  1646.     if @atb_turn_count >= @abt_turn_speed
  1647.       for index in 0...$data_troops[@troop_id].pages.size
  1648.         page = $data_troops[@troop_id].pages[index]
  1649.         $game_temp.battle_event_flags[index] = false if page.span == 1
  1650.       end
  1651.       @update_turn_end = true if Slip_Damage_Pop_Time >= 2
  1652.       $game_temp.battle_turn += 1
  1653.       turn_count_speed
  1654.       for battler in $game_party.actors + $game_troop.enemies
  1655.         battler.remove_states_auto if battler.exist?
  1656.       end
  1657.       setup_battle_event
  1658.     end
  1659.     for battler in $game_party.actors + $game_troop.enemies
  1660.       unless battler.exist?
  1661.         battler.cast_action = nil
  1662.         battler.atb = 0
  1663.       end
  1664.       next if (@escaping and battler.actor? and @escape_type > 0)
  1665.       next if battler.restriction == 4 or @active_battlers.include?(battler)
  1666.       next unless battler.exist?
  1667.       next if Pause_if_Damaged and battler.damaged
  1668.       if battler.atb_delay > 0
  1669.         battler.atb_delay -= 1
  1670.         next
  1671.       end
  1672.       battler.atb_update
  1673.     end
  1674.   end
  1675.   #--------------------------------------------------------------------------
  1676.   # * Wait flag
  1677.   #--------------------------------------------------------------------------
  1678.   def wait_on
  1679.     return true if $game_system.wait_mode == 1 and (@skill_window != nil or @item_window != nil)
  1680.     return true if $game_system.wait_mode == 0 and @input_battler != nil
  1681.     return true if ($game_system.action_wait or not @freeze_atb.empty?) and not allow_next_action
  1682.     return true if @battle_start or @battle_ending or @phase == 5
  1683.     return false
  1684.   end
  1685.   #--------------------------------------------------------------------------
  1686.   # * Start Party Command Phase
  1687.   #--------------------------------------------------------------------------
  1688.   def start_phase2
  1689.   end
  1690.   #--------------------------------------------------------------------------
  1691.   # * Update time meterrs
  1692.   #--------------------------------------------------------------------------
  1693.   def update_meters
  1694.     @status_window.active_time_update
  1695.   end
  1696.   #--------------------------------------------------------------------------
  1697.   # * Set turn speed
  1698.   #--------------------------------------------------------------------------
  1699.   def turn_count_speed
  1700.     @atb_turn_count = @abt_turn_speed = 0
  1701.     case Custom_Turn_Count
  1702.     when 0
  1703.       for battler in $game_party.actors + $game_troop.enemies
  1704.         @abt_turn_speed += 1 if battler.exist?
  1705.       end
  1706.     when 1
  1707.       @abt_turn_speed = Action_Turn_Count
  1708.     when 2
  1709.       @abt_turn_speed = Time_Tunr_Count
  1710.     end
  1711.   end
  1712.   #--------------------------------------------------------------------------
  1713.   # * Frame Update (party command phase: escape)
  1714.   #--------------------------------------------------------------------------
  1715.   def update_phase2_escape
  1716.     windows_dispose
  1717.     update_phase2_escape_type1 if @escape_type == 0
  1718.     update_phase2_escape_type2 if @escape_type > 0
  1719.   end
  1720.   #--------------------------------------------------------------------------
  1721.   # * Frame Update (party command phase: escape type 1)
  1722.   #--------------------------------------------------------------------------
  1723.   def update_phase2_escape_type1
  1724.     if rand(100) < set_escape_rate
  1725.       command_input_cancel
  1726.       @battle_ending = true
  1727.       $game_system.se_play($data_system.escape_se)
  1728.       battle_end(1)
  1729.       play_map_bmg
  1730.     else
  1731.       @escape_ratio += 3
  1732.       phase3_next_actor
  1733.     end
  1734.   end
  1735.   #--------------------------------------------------------------------------
  1736.   # * Frame Update (party command phase: escape type 2)
  1737.   #--------------------------------------------------------------------------
  1738.   def update_phase2_escape_type2
  1739.     @escaped = true
  1740.     command_input_cancel
  1741.     @battle_ending = true
  1742.     $game_system.se_play($data_system.escape_se)
  1743.     $game_system.bgm_play($game_temp.map_bgm)
  1744.     if @escape_atb_meters != nil
  1745.       @escape_atb_meters.dispose
  1746.       @escape_atb_meters = nil
  1747.     end
  1748.     battle_end(1)
  1749.   end
  1750.   #--------------------------------------------------------------------------
  1751.   # * Escape rate update
  1752.   #--------------------------------------------------------------------------
  1753.   def update_escape_rate
  1754.     actors_agi = $game_party.avarage_stat('agi')
  1755.     enemies_agi = $game_troop.avarage_stat('agi')
  1756.     return  Escape_Time * enemies_agi / actors_agi
  1757.   end
  1758.   #--------------------------------------------------------------------------
  1759.   # * Set Defense Action
  1760.   #     battler : battler
  1761.   #--------------------------------------------------------------------------
  1762.   alias set_guard_action_atb set_guard_action
  1763.   def set_guard_action(battler)
  1764.     set_guard_action_atb(battler)
  1765.     battler.atb = 0
  1766.     battler.action_scope = 0
  1767.   end
  1768.   #--------------------------------------------------------------------------
  1769.   # * Set Escape Action
  1770.   #     battler : battler
  1771.   #--------------------------------------------------------------------------
  1772.   alias set_escape_action_atb set_escape_action
  1773.   def set_escape_action(battler)
  1774.     set_escape_action_atb(battler)
  1775.     battler.atb = 0
  1776.     battler.action_scope = 0
  1777.   end
  1778.   #--------------------------------------------------------------------------
  1779.   # * Set Skip Action
  1780.   #     battler : battler
  1781.   #--------------------------------------------------------------------------
  1782.   alias set_action_none_atb set_action_none
  1783.   def set_action_none(battler)
  1784.     set_action_none_atb(battler)
  1785.     battler.atb = 0
  1786.     battler.action_scope = 0
  1787.     battler.current_phase = 'Phase 5-1'
  1788.   end
  1789.   #--------------------------------------------------------------------------
  1790.   # * Start After Battle Phase
  1791.   #--------------------------------------------------------------------------
  1792.   alias start_phase5_atb start_phase5
  1793.   def start_phase5
  1794.     @help_window.visible = false if @help_window != nil
  1795.     @input_battler.blink = false if @input_battler != nil
  1796.     windows_dispose
  1797.     @battle_ending = true
  1798.     update_meters
  1799.     start_phase5_atb
  1800.   end
  1801.   #--------------------------------------------------------------------------
  1802.   # * Frame Update (after battle phase)
  1803.   #--------------------------------------------------------------------------
  1804.   alias update_phase5_atb update_phase5
  1805.   def update_phase5
  1806.     windows_dispose
  1807.     update_phase5_atb
  1808.   end
  1809.   #--------------------------------------------------------------------------
  1810.   # * Actor Command Window Setup
  1811.   #--------------------------------------------------------------------------
  1812.   alias phase3_setup_command_window phase3_setup_command_window
  1813.   def phase3_setup_command_window
  1814.     $game_temp.battle_start = false
  1815.     return if @escaped
  1816.     if @active_battler != nil and @active_battler.cast_action != nil
  1817.       @active_battler.blink = false
  1818.       return    
  1819.     end
  1820.     @party_command_window.active = false
  1821.     @party_command_window.visible = false
  1822.     @actor_command_window.dispose if @actor_command_window != nil
  1823.     s1 = $data_system.words.attack
  1824.     s2 = $data_system.words.skill
  1825.     s3 = $data_system.words.item
  1826.     s4 = $data_system.words.guard
  1827.     s5 = @escape_name
  1828.     if @escape_type == 0
  1829.       @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])  
  1830.     else
  1831.       @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])  
  1832.     end
  1833.     command_window_position
  1834.     @actor_command_window.back_opacity = Base_Opacity
  1835.     @actor_command_window.back_opacity = Base_Opacity
  1836.     @actor_command_window.z = 4500
  1837.     @active_battler_window.refresh(@active_battler)
  1838.     @active_battler_window.visible = Battle_Name_Window
  1839.     @active_battler_window.x = Command_Window_Custom_Position[0]
  1840.     @active_battler_window.y = Command_Window_Custom_Position[1] - 64
  1841.     @active_battler_window.z = 4500
  1842.   end
  1843.   #--------------------------------------------------------------------------
  1844.   # * Go to Command Input for Next Actor
  1845.   #--------------------------------------------------------------------------
  1846.   def phase3_next_actor
  1847.     action_battler = @input_battlers.shift
  1848.     @action_battlers << action_battler
  1849.     @action_battlers.compact!
  1850.     command_input_cancel
  1851.     @input_battler = nil
  1852.     @actor_index = nil
  1853.     @active_battler = nil
  1854.   end
  1855.   #--------------------------------------------------------------------------
  1856.   # * Go to Command Input of Previous Actor
  1857.   #--------------------------------------------------------------------------
  1858.   def phase3_switch_actor
  1859.     @input_battler.current_action.clear
  1860.     @input_battler.atb = 0 unless @input_battler.passed
  1861.     @input_battler.passed = false
  1862.     @input_battlers.delete(@input_battler)
  1863.     @action_battlers.delete(@input_battler)
  1864.     command_input_cancel
  1865.     @input_battler = nil
  1866.     @actor_index = nil
  1867.   end
  1868.   #--------------------------------------------------------------------------
  1869.   # * Frame Update (actor command phase)
  1870.   #--------------------------------------------------------------------------
  1871.   alias update_phase3_atb update_phase3
  1872.   def update_phase3
  1873.     if cancel_command?
  1874.       if can_act?
  1875.         if @input_battler.confused?
  1876.           @input_battler.current_action.kind = 0
  1877.           @input_battler.current_action.basic = 0
  1878.         end
  1879.         @action_battlers << @input_battler
  1880.         @action_battlers.compact!
  1881.       end
  1882.       command_input_cancel
  1883.       return
  1884.     end
  1885.     update_phase3_atb
  1886.   end
  1887.   #--------------------------------------------------------------------------
  1888.   # * Command cancel flag
  1889.   #--------------------------------------------------------------------------  
  1890.   def cancel_command?
  1891.     return false if @input_battler.nil?
  1892.     return true if @input_battler.current_action.forcing
  1893.     return true if @input_battler.confused?
  1894.     return true if @input_battler.restriction == 4
  1895.     return true if not $game_party.actors.include?(@input_battler)
  1896.     return false
  1897.   end
  1898.   #--------------------------------------------------------------------------
  1899.   # * Can't act flag
  1900.   #--------------------------------------------------------------------------  
  1901.   def can_act?
  1902.     return true if @input_battler.current_action.forcing
  1903.     return true if @input_battler.confused?
  1904.     return false
  1905.   end
  1906.   #--------------------------------------------------------------------------
  1907.   # * Frame Update (actor command phase : basic command)
  1908.   #--------------------------------------------------------------------------
  1909.   alias update_phase3_basic_command_atb update_phase3_basic_command
  1910.   def update_phase3_basic_command
  1911.     if Input.trigger?(Input::C)
  1912.       case @actor_command_window.commands[@actor_command_window.index]
  1913.       when @escape_name
  1914.         if $game_temp.battle_can_escape == false
  1915.           $game_system.se_play($data_system.buzzer_se)
  1916.           return
  1917.         end
  1918.         $game_system.se_play($data_system.decision_se)
  1919.         update_phase2_escape
  1920.         return
  1921.       end
  1922.     end
  1923.     if Input.trigger?(Next_Input)
  1924.       $game_system.se_play($data_system.decision_se)
  1925.       @input_battler.passed = true
  1926.       phase3_switch_actor
  1927.       return
  1928.     end
  1929.     if Input.trigger?(Cancel_Input)
  1930.       $game_system.se_play($data_system.decision_se)
  1931.       phase3_switch_actor
  1932.       return
  1933.     end
  1934.     return if Input.trigger?(Next_Input) or Input.trigger?(Cancel_Input)
  1935.     update_phase3_basic_command_atb
  1936.   end
  1937.   #--------------------------------------------------------------------------
  1938.   # * Cancel command input
  1939.   #--------------------------------------------------------------------------
  1940.   def command_input_cancel
  1941.     windows_dispose
  1942.     if @input_battler != nil
  1943.       @input_battler.blink = false
  1944.       @input_battlers.delete(@input_battler)
  1945.       @input_battler = nil
  1946.     end
  1947.   end
  1948.   #--------------------------------------------------------------------------
  1949.   # * Dispose windows
  1950.   #--------------------------------------------------------------------------
  1951.   def windows_dispose
  1952.     @help_window.visible = false if !@escaping
  1953.     if @enemy_arrow != nil
  1954.       @enemy_arrow.dispose
  1955.       @enemy_arrow = nil
  1956.     end
  1957.     if @actor_arrow != nil
  1958.       @actor_arrow.dispose
  1959.       @actor_arrow = nil
  1960.     end
  1961.     if @actor_arrow != nil
  1962.       @actor_arrow.dispose
  1963.       @actor_arrow = nil
  1964.     end
  1965.     if @skill_window != nil
  1966.       @skill_window.dispose
  1967.       @skill_window = nil
  1968.     end
  1969.     if @item_window != nil
  1970.       @item_window.dispose
  1971.       @item_window = nil
  1972.     end
  1973.     if @enemy_arrow_all != nil
  1974.       @enemy_arrow_all.dispose_multi_arrow
  1975.       @enemy_arrow_all = nil
  1976.     end
  1977.     if @actor_arrow_all != nil
  1978.       @actor_arrow_all.dispose_multi_arrow
  1979.       @actor_arrow_all = nil
  1980.     end
  1981.     if @battler_arrow_all != nil
  1982.       @battler_arrow_all.dispose_multi_arrow
  1983.       @battler_arrow_all = nil
  1984.     end
  1985.     if @actor_command_window != nil
  1986.       @actor_command_window.active = false
  1987.       @actor_command_window.visible = false
  1988.       @active_battler_window.visible = false
  1989.       @actor_command_window.opacity = 0
  1990.     end
  1991.     @status_window.visible = true
  1992.   end
  1993.   #--------------------------------------------------------------------------
  1994.   # * Update battler phase 2 (part 1)
  1995.   #     battler : active battler
  1996.   #--------------------------------------------------------------------------
  1997.   alias step2_part1_atb step2_part1
  1998.   def step2_part1(battler)
  1999.     battler.defense_pose = false
  2000.     if battler.cast_action != nil
  2001.       active_cast = battler.cast_action
  2002.       if active_cast.scope == 1 or active_cast.scope == 3 or active_cast.scope == 5
  2003.         battler.current_action.target_index = battler.cast_target
  2004.       end
  2005.       if active_cast.is_a?(RPG::Skill)
  2006.         battler.current_action.kind = 1
  2007.         battler.current_action.skill_id = active_cast.id
  2008.       elsif active_cast.is_a?(RPG::Item)  
  2009.         battler.current_action.kind = 2
  2010.         battler.current_action.item_id = active_cast.id
  2011.       end
  2012.       battler.cast_action = nil
  2013.     end
  2014.     step2_part1_atb(battler)
  2015.     if (battler.now_action.is_a?(RPG::Skill) or battler.now_action.is_a?(RPG::Item)) and
  2016.        battler.cast_action.nil? and active_cast.nil?
  2017.       battler.cast_action = battler.now_action
  2018.       battler.cast_target = battler.current_action.target_index
  2019.       cast_speed = battler.now_action.cast_speed(battler)
  2020.       battler.cast_action = nil if cast_speed == 0
  2021.       unless cast_speed == 0
  2022.         battler.movement = false
  2023.         battler.current_phase = 'Phase 5-1'
  2024.       end
  2025.     end
  2026.     if cant_use_action(battler) and battler.cast_action != nil
  2027.       battler.cast_action = nil
  2028.       battler.moviment = false
  2029.       battler.current_phase = 'Phase 5-1'
  2030.     end
  2031.     reset_atb(battler)
  2032.   end
  2033.   #--------------------------------------------------------------------------
  2034.   # * Update battler phase 3 (part 1)
  2035.   #     battler : active battler
  2036.   #--------------------------------------------------------------------------
  2037.   alias step3_part1_atb step3_part1
  2038.   def step3_part1(battler)
  2039.     step3_part1_atb(battler)
  2040.     freeze_atb(battler)
  2041.   end
  2042.   #--------------------------------------------------------------------------
  2043.   # * ATB reset
  2044.   #     battler : active battler
  2045.   #--------------------------------------------------------------------------
  2046.   def reset_atb(battler)
  2047.     battler.atb = 0 unless battler.passed
  2048.     battler.passed = false
  2049.   end
  2050.   #--------------------------------------------------------------------------
  2051.   # * ATB pause
  2052.   #     battler : active battler
  2053.   #--------------------------------------------------------------------------
  2054.   def freeze_atb(battler)
  2055.     @freeze_atb << battler if check_include(battler_action(battler), 'FREEZEATB')
  2056.     @freeze_atb.uniq!
  2057.   end  
  2058.   #--------------------------------------------------------------------------
  2059.   # * Update battler phase 5 (part 4)
  2060.   #     battler : active battler
  2061.   #--------------------------------------------------------------------------
  2062.   alias step5_part4_atb step5_part4
  2063.   def step5_part4(battler)
  2064.     step5_part4_atb(battler)
  2065.     @atb_turn_count += 1 unless Custom_Turn_Count == 2
  2066.     @input_battlers.delete(battler)
  2067.     @action_battlers.delete(battler)
  2068.     @action_battler = nil
  2069.     @freeze_atb.delete(battler)
  2070.     update_meters
  2071.     judge
  2072.   end
  2073. end
Expand to see the code.
I think you get the the Cast_Cancel function wrong.

It don't cancel the cast of the user, but the cast of the TARGETS.
So an skill with Cast_Cancel will cancel the cast of the ones damaged by it.

If you want a skill to not have cast time, just remove it from the hash "Cast_Time['Skill']"

Quote:
Cast_Time['Skill'] = {1 => [500,'int'], 2 => [400,'int'], 3 => [300,'int'],
7 => [500,'int'], 8 => [400,'int'], 9 => [300,'int'], 10 => [500,'int'],
11 => [400,'int'], 12 => [300,'int'], 13 => [500,'int'], 14 => [400,'int'],
15 => [300,'int'], 16 => [500,'int'], 17 => [400,'int'], 18 => [300,'int'],
19 => [500,'int'], 20 => [400,'int'], 21 => [300,'int'], 22 => [500,'int'],
23 => [400,'int'], 24 => [300,'int'], 25 => [500,'int'], 26 => [400,'int'],
27 => [300,'int'], 28 => [500,'int'], 69 => [100,'int'], 57 => [100,nil]}

As you see you added the skill 57 and 69 to the cast time hash, so they will ALWAYS have casting time. And this have no connection with the Cast Cancel.
oh thank you for clarification!!! I was sooo wrong LoL! Thats why u get paid the big bucks 😀
I'd have a wait time between "DMGRISE /**"," LIFT /**", "ANIME / **" and "DMGSMASH" must use code in Script Config 2 ACBS - Advanced??
Sorry about my english because I am a Vietnam :D
@ryukbn
i didn't really get what you wanted, but i suppose that it can be done by using the skill sequence feature.
So make two skills, in one you add the rise/lift and the wait time, and on the other the smash. and use the sequence to make them to be used one after another.
Hey atoa, i was just wondering....i coudn't find a tutorial about it, so i decided to register and ask you...how exactly can you config the system so it's like Phantasy Star IV ?
I'm reamaking that game and wondering how it works....thanks in advance :D

Nevermind, just got PM :\

(And, by the way, thanks for the "warm" welcome .-.)
Moonlighter wrote:
Hey atoa, i was just wondering....i coudn't find a tutorial about it, so i decided to register and ask you...how exactly can you config the system so it's like Phantasy Star IV ?
I'm reamaking that game and wondering how it works....thanks in advance :D

EDIT:Nevermind, just got PM :\
(And, by the way, thanks for the "warm" welcome .-.)
I have tried now and costumize all of your functions in this script and may there is one bug i can not explain.


If you use this 2 Add Ons: Atoa ATB + Atoa Summon

For Example you win the Battle with a Summon together and the method for used 0 = remove all actors, except the summoner or 1 = remove all actors
The Battle Ends and a Script Error Appear:

Script'Atoa ATB line 824:NoMethodError occurred.

undefined method 'line='for nil:NilClass

any idea how can i fix this?
maybe it helped but in Version 2.0 this Error doesn't there, only after 3.0 and also in 3.2. .....

greeting from Germany :D

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=62914