Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: reiven10 on April 13, 2011, 02:16:21 am

Title: Skill Cooldown
Post by: reiven10 on April 13, 2011, 02:16:21 am
Can someone edit this script to be able to use with RTAB
#==============================================================================
#
#------------------------------------------------------------------------------
#
#==============================================================================
module Config
 Cooldown = {}

 Cooldown[1] = 2
end

#==============================================================================
#
#------------------------------------------------------------------------------
#
#==============================================================================
class RPG::Skill
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 def cooldown
   return (Config::Cooldown[@id] != nil ? Config::Cooldown[@id] : 0)
 end
end

#==============================================================================
#
#------------------------------------------------------------------------------
#
#==============================================================================
class Game_Battler
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 attr_accessor :cooldown
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 alias cooldown_initialize initialize
 def initialize
   cooldown_initialize
   @cooldown = {}
 end
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 alias cooldown_skill_can_use skill_can_use?
 def skill_can_use?(skill_id)
   return false if @cooldown[skill_id] != nil and @cooldown[skill_id] > 0
   return cooldown_skill_can_use(skill_id)
 end
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 def update_cooldowns
   @cooldown.keys.each {|id|
     @cooldown[id] = [@cooldown[id] - 1, 0].max if @cooldown[id] != nil
   }
 end
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 def cooldown_clear
   @cooldown.keys.each {|id| @cooldown[id] = 0}
 end
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 alias cooldown_skill_effect skill_effect
 def skill_effect(user, skill)
   effective = cooldown_skill_effect(user, skill)
   user.cooldown[skill.id] = skill.cooldown if effective
   return effective
 end
end

#==============================================================================
#
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_Battle
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 alias cooldown_update_phase4_step2 update_phase4_step2
 def update_phase4_step2
   @active_battler.update_cooldowns
   cooldown_update_phase4_step2
 end
 #--------------------------------------------------------------------------
 #
 #--------------------------------------------------------------------------
 alias cooldown_battle_end battle_end
 def battle_end(result)
   for actor in $game_party.actors
     actor.cooldown_clear
   end
   cooldown_battle_end(result)
 end
end


I hope someone here can help me, especially those who were familiar with RTAB
Thank you in advance :)
Title: Re: Skill Cooldown
Post by: WhiteRose on April 13, 2011, 02:35:46 am
I'm not much of a scripter, but I'd guess that this script is short enough and RTAB is different enough from the default battle system that it might just be easier to rewrite it, rather than just edit it, if you want to use it with RTAB. If you could give a few specifics on how exactly you want the script to function, I'm sure someone would be willing to help you.
Title: Re: Skill Cooldown
Post by: reiven10 on April 13, 2011, 02:45:46 am
The person who made the script said that it only need to edit two methods from Scene_Battle to be compatible with RTAB

Here how it works.

ex. Fire = 0 cooldown turns
Greater Fire = 2 cooldown turns (it can only be use again after 2 turns)
Mass Fire = 5 cooldown turns (it can only be use again after 5 turns)

so it means, after using the skill (Greater Fire and Mass Fire), it is unable to use after the cooldown is over, while Fire is able to use anytime

i  know that it can be made by eventing using Conditional Turns in troops and Common events by skills, but it also not compatible with RTAB because in RTAB, the highter your agility, the often you attack.

I hope someone can help

BTW, thank you very much WhiteRose for fast response :)