Skill Cooldown script
#1
Hello,

After balancing the stats and working out the skills and talents for my rmxp game during the past couple of days, I am running into a bump.
For many of the skills my actors use, I want to have a cooldown function. Meaning they cannot use specific skills for X number of turns (I use the default battle system).

Example:
Skill 1 has no cooldown
Skill 2 has a cooldown of 3 turns
Skill 3 has a cooldown of 10 turns

Ideally these skills will be greyed-out when on cooldown.

I suppose this can be done with eventing, but I think it would be far more efficient with a script.
When I looked for one, I could not find anything for rmxp.

I am hoping someone can refer me to a working script or help me tweaking one to make it work in the way I'm looking for.

As mentioned, I do not use a custom battle system, but I do use some scripts that influence battle/skills which I'll post just in case:
Threat system by Fantasist, reflection by Blizzard, hots dots by Shdwlink1993.
Reply }
#2
You could try this script.
Sadly I don't know who made this anymore

Code:
   #==============================================================================
   #
   #------------------------------------------------------------------------------
   #
   #==============================================================================
   module Config
     Cooldown = {} # Do not touch
     Cooldown[1] = 10 # Skill with ID 1 has a cooldown of 10 turns.
   
   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
Reply }
#3
(12-06-2019, 06:07 PM)Melana Wrote: You could try this script.
Sadly I don't know who made this anymore

Thanks for the script!

But, when I tested, the skill was still available after the first turn.
When I used it again in turn 2, it became grey in turn 3 though.

Any idea why?

EDIT: it doesn't seem to be working at all now. I'm using a fresh project without scripts to test.
Reply }
#4
Hmm it works for me.
If I start a fresh project and give Aluxes' Cross Cut Skill a cooldown of 3 turns, it greys out once he uses the skill.
Reply }
#5
(12-07-2019, 12:40 AM)Melana Wrote: Hmm it works for me.
If I start a fresh project and give Aluxes' Cross Cut Skill a cooldown of 3 turns, it greys out once he uses the skill.

It might have been because I used a healing skill, I will try again tomorrow morning.
Reply }
#6
Hey, guys. That script is by Victor Sant. He wrote that back in 2011 when he was still known as Atoa.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#7
(12-07-2019, 04:53 AM)DerVVulfman Wrote: Hey, guys.   That script is by Victor Sant.   He wrote that back in 2011 when he was still known as Atoa.

Alright, I'll put his name in the script so I won't forget to credit him if I ever share it.

Also, it seems to be pretty glitchy with healing spells (I need to use a spell twice in a row to trigger the cooldown and it will be one turn less than supposed to).
Could it be that the script will have trouble with such skills because of their scope or occasion?
Reply }
#8
(12-07-2019, 12:24 PM)Fenriswolf Wrote:
(12-07-2019, 04:53 AM)DerVVulfman Wrote: Hey, guys.   That script is by Victor Sant.   He wrote that back in 2011 when he was still known as Atoa.

Alright, I'll put his name in the script so I won't forget to credit him if I ever share it.

Also, it seems to be pretty glitchy with healing spells (I need to use a spell twice in a row to trigger the cooldown and it will be one turn less than supposed to).
Could it be that the script will have trouble with such skills because of their scope or occasion?

I figured out what the problem is.
Whenever a skill has a negative number or 0 as power value, the script won't work as intended.

Problem is, I mostly want to use cooldowns for utility skills (buffs, disabling abilities, etc.).
Meaning I can not use the script this way.

Anybody willing to help me fix this?
Reply }
#9
There's a part of the script that says "if effective"... Why don't you comment it out? That means placing a # pound symbol right in front of it... Check out if it now works as expected.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#10
(12-09-2019, 12:28 AM)kyonides Wrote: There's a part of the script that says "if effective"... Why don't you comment it out? That means placing a # pound symbol right in front of it... Check out if it now works as expected.

Thanks, that did the trick!
It works now, so long as a skill doesn't have scope "none", which is fine.

This should make the combat much more interesting, by having to use rotations and timing your "once in a battle" skills.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   A Skill that throws enemies? Bennerdeben 10 744 10-08-2024, 05:12 PM
Last Post: Bennerdeben
   Script compatibility help Lord Vectra 3 4,523 07-25-2021, 11:42 PM
Last Post: DerVVulfman
   [RMXP] Showing skill gained by leveling up on battle result FrQise 12 12,507 05-07-2021, 02:05 PM
Last Post: FrQise
   Adding face script on Cogwheel's RTAB Battle Status rekkatsu 15 15,601 08-25-2020, 03:09 AM
Last Post: DerVVulfman
   "Wait" in the script Whisper 13 15,987 04-28-2020, 04:06 PM
Last Post: Whisper
   Help iwth script (RGSS Player crash) Whisper 3 8,476 06-17-2017, 05:03 PM
Last Post: Whisper
   Help modifying a script Keeroh 7 10,164 06-11-2017, 04:43 PM
Last Post: DerVVulfman
Question  Mog Menu script: help me stop the crazy picture movement during transitions Zachariad 4 9,774 05-31-2017, 05:10 AM
Last Post: Zachariad
   Scan skill should show states Tumen 5 9,157 05-02-2017, 03:33 AM
Last Post: DerVVulfman
   Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! reiji1337 6 9,676 04-28-2017, 03:27 AM
Last Post: reiji1337



Users browsing this thread: 1 Guest(s)