Skill Restrictions

Last Updated: 2011.07.21
Download Link
Github Link

Sometimes good game balance depends on restriction mechanics. Of these mechanics include skill cooldowns, warmups, and the amount of times a skill can be used (limited uses). Included in this script are features also to lock cooldowns, reduce cooldown rates, change cooldown values for skills, skill types, and more. If this isn’t enough restriction power, switches may be used to restrict skills from being used as well as even code.

Skills with cooldowns require turns to pass before they’re usable once again. Cooldowns are seen more frequently in MMORPG’s, but there’s no reason to not use them in normal ones. In fact, they help balance overpowered skills from being spammed endlessly.

<cooldown: x>

Causes the skill to have a cooldown of x once it’s used in battle. Skills with cooldowns cannot be used again until cooldown reaches 0 or until the battle is over.

<cooldown lock>

A battler afflicted with cooldown lock will not have cooldowns count down every turn until the cooldown lock is removed. This tag can go under in the Actors, Classes, Weapons, Armours, States, and Enemy noteboxes.

<cooldown rate: x%>

When cooldowns are applied from using skills in battle, the cooldown rate can reduce or increase the finalized amount of turns a battler would need to wait before being able to use that skill again. This tag can go under in the Actors, Classes, Weapons, Armours, States, and Enemy noteboxes.

Skills can also affect the cooldowns of targets by increasing/decreasing skill types or specific skills. Changing an enemy’s cooldowns may become a vital part of strategy in some games.

<change cooldown: +x>
<change cooldown: -x>

This will cause the target’s cooldowns for every skill to increase by x or decrease by x. This selects skills indiscriminately.

<skill cooldown x: +y>
<skill cooldown x: -y>

This will cause the target’s specific skill x to receive a change in cooldown by either an increase or decrease of y amount.

<stype cooldown x: +y>
<stype cooldown x: -y>

This will cause all of the skills with skill type x to have its cooldowns changed by y amount. +y increases cooldown turns while -y decreases turns.

Warmup skills require a certain amount of turns to pass in battle before they can be used. This helps limit certain extremely overpowering skills from being used right from the start of battle.

<warmup: x>

Causes the skill to be sealed until the x turns pass in battle. There’s no way to speed up a warmup manually with the exception of warmup rates.

<warmup rate: x%>

Lowers/Raises the amount of turns needed to pass in battle before the warmup skills become available for usage.

Skills can have a limited amount of times they can be used per battle, too. This can help prevent some skills from being used too often or allow the existence of tide turners without breaking the entire balance of a battle (like Hamedo).

<limited uses: x>

This will allow the skill to only be usable x times throughout the course of battle. Once the skill is used x times, it is disabled until the battle is over. This effect only takes place during battle.

Restricting skills from being able to be used can also be done through switches for all the eventers. With switch control, skills can be enabled on and off with ease.

<restrict if switch: x>

This will restrict the skill if switch x is ON. If switch x is OFF, this skill will no longer be restricted.

<restrict any switch: x>
<restrict any switch: x, x>

This will restrict the skill if any of the x switches are ON. If all of them are off, then the skill will not be restricted.

<restrict all switch: x>
<restrict all switch: x, x>

This will restrict the skill if all of the x switches are ON. If any of them are off, then the skill will not be restricted.

Users with coding experience can take advantage of the <restrict eval> notetag to create their own custom restrictions!

<restrict eval>
  string
  string
</restrict eval>

For the more advanced users, replace string with code to determine whether or not the skill is restricted. If multiple lines are used, they are all considered part of the same line.

And that’s all, folks!

100 comments on “Skill Restrictions

  1. Every single detail of this script makes me happy, especially the built-in cooldown modifiers and the tag. Unnnngggghhh, cannot wait for the 15ths!

  2. I had a look at your scripts now and I’m still wondering if there is any possibility to get rid of MP bars. Especially with this script here, when you want to use only these restrictions and don’t want to have MP at all. If it’s not possible, are you planning on making an add-on for that?

      • Doesn’t look like it. And even if that was possible, that would not hide MP bars in the menu, I guess. :/

      • It does not hide the bars in the menus but it does hide the bars in battle where it matters. If the actor does not use skills that use MP, it won’t show the MP bar. If the actor does not use skills that use TP, it won’t show the TP bar.

        For menus, it’s better that both are shown. But if it truly bugs you that much, all you have to do is just change draw_actor_mp to draw_actor_tp where-ever it is in the script.

  3. Hey Yanfly, how does it feel to be awesome? Awesome I bet. The most useful script by far for me.

    One question though! Is it possible to make an attack affect the cool-down of some of the caster’s other moves, or do they have to be the target of the skill? (Specifically I am having a light/dark guy and I want all the dark skills to increase the cool-down of his light skills and vice versa.)

  4. I have a suggestion here: Cooldown carry-over between battles. :) Maybe even limit carry-over, to be reset only at an INN or with an item or something like that.

  5. Question: how do I make it so a skill is only usable if you have all the specified equipment on that character? I haven’t been able to find a way yet, but I am guessing it would be a simple code? Thanks.

  6. Skill restriction seems to be useless on the base skill of random invoke skill :(
    This frustrated me a lot when I tried to make a random invoke skill with restricted use :(

  7. How about introducing “Casting time”?
    It can be done manualy with states. I, for example, have a certain skill that takes two rounds to prepare. During that time, the “Guard” flag is on (Reduced damage), but all evasions are off.
    Another thing that would be interesting would be a “Delayed Effect”, so once you cast something it might take a little while before activating.
    That could be really interesting to make counter-attack skills without the need to specify a number of turns: You could just make a skill that has a delayed effect until the next physical attack targetted towards you.

  8. There are two things I’m missing. :) Charging up skills (activation in the first round with a message like “Ralph charges up” and automatic execution in the second round) and the opposite, that is basically a cooldown without you being able to do something else due to exhaustion. So “charging” and “exhaustion” would be cool tags for that. :D

  9. Hi Yanfly. I’m loving your scripts, thank you!

    I noticed there is an option for advanced users to use scripts. I was wondering what i should put in there if i want to limit a skill being used only if the target is stunned.

  10. Hmmm…I didn’t notice a problem with this script, however. There seems to be a conflit with this script and TP selection script. Trying running them in unison and see if you find anything.

      • I got the same error. TP modes script has always worked fine. Just installed this and it crashes whenever you hover over ‘TP modes’ in the menu. The error message takes you to line 738, saying it’s an undefined method for ‘restrict_any_switch.’ Shame. I need both scripts.

        Does anyone know how to fix this?

    • There’s about a 100% chance that Yanfly makes these scripts to be compatible with each other and runs them “in unison” with each other. There’s also about a 100% chance that this is a user error… on your part.

      • I can confirm that this is a fault in the script itself and not user error. I just installed both scripts into a blank project with no modifications and the same thing happened.

  11. I encountered a small bug with this script.

    I am using the instant-skill script to have an instant heal. This instant heal got a five turn cooldown attached to it. I also got another instant spell which instantly restores 200 mana to the caster. That’s all working fine.

    However, I have another spell.. a non-instant heal which reduces the cooldown by 1 turn for those two instant-abilities. This works most of the time but sometimes when using this non-instant heal the cooldowns of my instant spells does not go down the right amount of turns. Usually when using this heal the cooldowns should go down by two turns (one turn thanks to using the spell and the other turn thanks to ending the turn) but it doesn’t.

    Because it works most of the time I don’t really believe I done anything wrong with my note-tag.

    • Cooldowns update at the start of the turn. This means instant skills will update twice, once at the start of the turn you’re about to enter and once from the cooldown reduction.

  12. A small feature request as well:

    At the moment the “” is used to change a target’s cooldown.

    Would it be possible to also have a notetag to change the casters cooldowns? I would want my damage skills to be able to reduce/increase the casters cooldowns instead of the monsters. There is very little use to me to change a monsters cooldown.

    • Try using Lunatic Objects or Lunatic States to apply the affect while the user is attacking. You can look at Give and Take to get an idea of what to do.

    • Tips for the requestfags:

      Learn to use RPG Maker to make work arounds. Make the skill target the user instead to have cooldown changes. If you want the skill to change the target’s cooldown AND the caster’s cooldown, make a goddamned common event run from the skill, run a forced action, and have the user perform a skill that targets himself and changes the cooldown, too.

      It’s not that effin’ hard.

      • Request fags remain request fags. They never learn anything new because they refuse to try to solve anything on their own.

      • And being completely ungrateful for you explaining to them a work around. Clearly, them being annoying is of no concern but you being irritated for GOOD REASONS is something to post publicly to the world about.

        Fucking ingrates.

    • That might be, and I don’t mean to sound harsh here, because it is. I’ve seen so many “I can’t find line ‘x’ ” issues that could have been solved with good ol’ Ctrl + F. You do kinda need to know what your searching for, but seeing as most people put comments describing stuff, it’ll usually take you there and what you want is right below.

  13. Wait, damn. Okay… I don’t think I’ve got the syntax right.

    Restricting access to a skill by referencing the presence of a particular state…

    actor.states[state_id] != nil

    Am I way off on this? In the meantime, I have it running on a common event – but events hurt my FPS. Less o’ them would be real nice.

      • Anon, you are Prometheus bringing light unto the darkness of my ignorance – but alas, I still can’t seem to figure this out.

        So as not to be a “request fag,” I’m trying as best I can to resolve it on my own. Having a hell of a time, though.

        I’m generating an error within the Skill Restriction script itself on line 760. I’m sure it’s because of a syntax problem on my part, but the error says I’m using an undefined method. I was under the assumption the code needs a string, which leads me to believe I’m doing something “srsly wrong.”

        actor.state? only seems to referenced in the scripts once in Game_Interpreter, and I can’t really seem to figure out from the syntax and wording there how to phrase my restriction strings in the “restrict eval” notetags.

        I’d also like to throw out there that I’m sorry if my asking for help constitutes a kind of gross injustice or offense to anyone, because I certainly don’t mean it that way. Just trying to learn new things, and I’m having some trouble on my own…

        (Thanks again, anon!)

      • Don’t worry, Chomp. The fact you’re asking for HELP rather than some edit or feature that can be evented AND are trying to fix it yourself shows wonders. I’m not sure about the others, but you’ve no animosity from me. As an eventer, all this ‘eval’ business is over my head, but so many comments both here and on forums, I’m constantly thinking, ‘Why are you asking for a script/add-on for “x”? You can event that easy!’ But, y’know, you’re trying, at least.

        Good for you.

      • Assuming you’re using the eval tags,

        self.state?(2)

        That might be what you’re looking for.

  14. Okay, so.. Update. Still working on only this shit. (self.state? seems to be exactly what I needed, so thanks again, Anon. You rawk.)

    self.state?(state_id)

    This doesn’t crash the game when I open the skills menu, but neither does it restrict the skill properly. It’s just always useable.

    self.state?(state_id) != nil

    This results in the same.

    self.state?(state_id) == true
    self.state?(state_id) = true

    These both restrict the skill permanently, regardless of the presence of the state.

    I shall continue to endeavor!

    • Was there any progress on this?
      I attempted this myself utilizing those same things, and in the end it looked like this:

      self.state?(state_id);

      *where state_id is the number correlating to the state in question.

      In the end, this results in limiting the skill if the character is in the state.
      Is there any way to reverse this?

      • Derp.
        !self.state?(state_id) will require the you to be in the state to use it.
        self.state?(state_id) will prevent you from using it while in said state.

        Success!

  15. Ok. I have a question. I’m trying to see if I could use this script to apply limitations for party members who have the same skill.
    In my project, say actor 1 and actor two knows the fire spell, however, they need to have a fire magic level of 2 to use it. I establish the levels via variables so actor 1’s level is three and actor 2’s level is one. Is there a way to make it so the script can look for specific variables depending on the actor trying to use the skill?

  16. Lol, found a minor bug. If you are using a skill as a command (via Battle Command List) and it is a skill that a class has not been assigned, the cooldown on it will not function. It’s easy enough to work around/fix by adding it to their class and giving it a tag, just figured I’d point it out.

  17. Hi everyone! There’s someone who can say me how to put as a restriction the fact that some character is not in the party? I’ll use and but i’m not good at scipting, sorry for bother you.

  18. !self.state?(state_id)

    Hey i’m using this for some of my skills to allow it being used under a certain state but say I want to have a skill that can be used with either state?

    Example being
    Fire element state = Can use fire skills
    Omni element state = Can use any element skills

    have an idea what code to use? I’m new to this so it’s kind of difficult for me. Any help would be awesome!

  19. according to the restrict eval part, is there a way to write something like”skill with a restriction of shield holding or dual wield”? because ‘skill with weapon type don’t have such options.

  20. is there a way to add a cool down based on battles done. kind of like breath of fire 3 with the Bone break skill.?

  21. hey :D nice script :D but i get a error if i equip a waepon ^^
    Script Cooldown line 712: TypeError occurred
    nil cant be coerced into float
    Thats the error… where is the problem? xD

  22. Hey I’m having a little problem with a skill. I set the warm-up to: 2, but passed almost 15 round before it changed to 1 and more 15 to become available. I’m using a AT system… Does this script have compatibility with AT scripts?

  23. I don’t know why, but the cooldowns in this system isn’t working. The warm ups seem to be doing fine, but not the cooldowns. It’s like they’re always locked.

    I’m also using AT scripts, I have reason to believe that may be part of the problem.

  24. I’m getting a cannot convert nil to integer error, stemming from the method update_cooldowns on L 695. Anyone have a clue where the conflict is?

  25. Slight issue I’ve come across with this, if a character has two actions in a turn, it will allow them to select a skill twice, even if the skill is set to only be usable once per battle or is restricted after one use with a switch. For example, on the mage’s turn, she gets two actions. She has Powerful Spell A or whatever, which is only usable once per battle. But when her turn comes around, if I select Powerful Spell A as her first action, I can select it again as her second action. It’ll then only use it once, due to the restriction, and end the turn. Is there any way to stop it from letting the player select the skill twice if the skill can’t be used twice in the first place?

  26. I know this blog has been dead for years, but…

    Does anyone know how to make it so that you can increase Limited Uses? As in, Allow for an item to recharge the limited uses that a skill has left?

    *goes back to tinkering with the code to figure it out*

    • An example is shown in the images.

      self.hp < somenumber

      Change the check to be however you want to limit the HP range it can be used in.

  27. A quick question. What would it take for a skill with a limited number of uses be granted another use in the same battle? (Using either a separate skill or an item.)

    I.e. Actor1 uses ‘Armageddon’. (limited uses: 0/1)
    Actor2 uses ‘Skill Charger’ on Actor1. (limited uses: 1/1)
    Actor1 uses ‘Armageddon’. (limited uses: 0/1)

    If this is a bit outside of the scope of this script, I understand.

    Keep up the good work!

  28. The functionality doesn’t work if there’s no scope set. I’m using it in conjunction with a script known as Enemy Reinforcements by Tsukihime in order to limit the amount of times an enemy can call a troop into battle.

    It works fine when I add a scope to the skill in question, but once I set it to none the enemy can use the skill as many times as they want.

    The reason it’s a bit of a pain is because if I have a scope set it comes up with the irritating message that skill failed all the time (when in actuality it summons another enemy and is not failing at all).

    Is there a fix for this?

  29. Hello,
    I am new to this community and already love the script. I do think I’ve found a bug though (or I did something stupid and just didn’t notice). whenever I learn a skill that I have set to be restricted until a certain state is inflicted, if I try to look at it in skills right away, the game crashes. But, if I try to look at it after a battle, the skill is fine there’s no problem.

    Here let me show you:

    [spoilers]http://i1275.photobucket.com/albums/y441/montezfr/fault1_zps83bffa47.png[/spoilers]

    That’s right before I learned the skill.

    [spoilers]http://i1275.photobucket.com/albums/y441/montezfr/fault1A_zps1dffbf18.png[/spoilers]

    And that is right after I learned the skill.
    I didn’t change a single thing in the script when I placed it into the script editor and placed it in the correct spot as well.

    !self.state?(8)
    this is the notetag I placed into the skill notebox. did I do something wrong?

  30. Hey guys just wondering if anyone know how to alter the skill restrictions to work based on percentages instead of straight up amounts. What I want to do is to have a skill that only appears and is usable when the character has less than 45% HP.
    I tried with skill restrictions like this:

    self.hp <45%
    but I get errors everytime I enter combat.

    I also tried the hiding skill category mod to the battle command script but that one doesn’t accept percentages either. I made a small change but it doesn’t do what I want:
    #————————————————————————–
    # new method: add_skill_type_command
    #————————————————————————–
    def add_skill_type_command(stype_id)
    return unless @actor.added_skill_types.include?(stype_id)
    return if @actor.hp!<300 && stype_id==3
    return if @stype_list.include?(stype_id)
    @stype_list.push(stype_id)
    name = $data_system.skill_types[stype_id]
    add_command(name, :skill, true, stype_id)
    end

    My personal change to this script only involved putting hp<300 but the program didn't recognize the command and crashed during testing. I don't know if there's a better way of hiding the skill or what. I'm a bit of a novice, but if anyone has any ideas on how to hide it, I'd appreciate it.

  31. Question – is there a simple way to link CD to a an entire skillset?
    Example …
    Witch has the following skill sets
    – Atk
    – Minor arcana
    – major arcana
    Wtich uses blizzard from major arcana

    The objective would be to put the entire Major Arcana skillset in CD. Is there a simple way of doing this without tagging each individual skillset?

    so, question’s out of the way … thanks a million for posting this. This is just about head-on-the-nail exactly what I’m looking for. =)
    Cheers,
    – lucky

  32. I’ve been seeing this script until now, and I tested.

    The cooldown/warmup works fine BUT, when you try to change a cooldown with a skill (by using this skill reduces the cooldown of other) it doesn’t work.
    With items works fine, and I tested a few times.

  33. What I want to do is have a skill that has a limited amount of uses, and then you have to go to an inn to get those uses back. A X uses per Day kind of restriction. How do you do that?

    • The best way to do that is to use variables and the Skill Cost Manager script instead. Assign a variable with the number of uses, and then use the Skill Cost Manager’s custom skill requirements to make sure it’s greater then 0, and custom skill costs to reduce that variable every time the skill is used.

      • Yeah, that’s what I was suggested to do elsewhere. Use the Skill Cost Manager with variables, and then use a Common Event for my Extended Rests to rest the variables. I’ll be doing that.

  34. We have been using this script for a while now with Yamis battle system. The 2 worked together fine until the most recent Yami battle system update. They seem to be counting turns differently and the cooldown system isnt working at all. Anyone know what could be doing this or have a work around? Thanks

  35. Hmmm, trying to make a skill restricted based on the presence of a different actor.

    restrict eval
    !$game_party.battle_members.include?(7)
    or $game_actors[7].state?(1)
    /restrict eval

    (tags arent closed because I didn’t want to cause parse issues here. They’re fine in the note tag)

    According to this (if I’m using the right syntax), the skill should be restricted if actor ID 7 isn’t in the battle party or if actor ID 7 is under the effects of state ID 1 (dead).

    However, it doesn’t work. The skill is restricted all the time, whether the other actor is in the battle party and alive or out of the battle party and dead.

    Anyone know where I went wrong on the custom eval?

    I’ve also written it out as an entire method on a single line (the script says it ignores line breaks and runs custom eval as one line) like so:

    restrict eval
    if !$game_party.battle_members.include?(7)
    or $game_actors[7].state?(1); return true;
    else; return false; end;
    /restrict eval

    This is assuming returning true restricts the skill and returning false leaves it usable.

  36. For the limited usage of a skill, the word used will display when all uses have been used. Is it possible that during the battle, the amount of uses you have remaining could be displayed? How would one go about to accomplish this?

    Thanks in advance for those who reply.

  37. Hey Yanfly!
    I’m trying to use the “limited use” for my skills, is there any formula the set the use times being equal to the number of same equip?

    For example, if the Actor is equipped with 3 Fire Orbs he’ll be able to use the skill Fire 3 times.

    Thanks a lot!

  38. I am currently using this script for the skill restriction, but everytime i test the skill out it won’t be restricted to the limited uses. For example, I want a character to have a randomized buffing skill, but I want it to only be used once in a battle. For now i’m stuck with powering myself up until i can destroy anything to my heart’s content.
    The command I used was in the notes of the skill.

  39. I was wondering if some one could help me figure out how do use the restrict eval option to check if any shield armours are equipped.

    I’ve done some digging, and am still very surprised this isn’t standard (shield bash needs shield, didn’t think shield bash would be uncommon?)

    So far i know i need to look at :
    .equips[1]
    I think, but not finding where to go from there…

  40. Is there any way to use this script to get an item cooldown? I have an item that damages all enemies, but I only want it to be used once every 5 turns.

  41. Is there a possibility to increase the max uses once a sill gets upgraded? I would like to copy the battle system of Final fantasy record keeper . The abilities there are ranked between 1 and 5 and at rank one they had 2 uses and at rank 5 they had 10 uses. is this possible?

  42. Thank you so much for the amazing scripts and being a major pillar in the community!

    I hope you’re still checking here.

    I can’t seem to get stype to work. The cooldown just doesn’t apply in game when I use it. The regular works fine though. I tried removing but that didn’t do it either. Any advice?

    http://imgur.com/EMFBxoj

  43. can someone explain me why the cooldown doesn’t work?, the counter freezes, and never goes down, so the skill never gets usable again until the battle’s over…

    i tried using , but nothing. please help… :(

  44. I know I’m 4 years late on this, but I just grabbed this script for a project I’m doing. If you’re using Fomar’s ATB script, I was able to get it to start acknowledging turn ends for cooldowns by adding:

    battler.update_cooldowns

    to the def turn_end rewrite block around line 490 or so, inside the all_battle_members.each do |battler| function. It’d end up looking like this:

    def turn_end
    all_battle_members.each do |battler|
    battler.on_turn_end
    battler.update_cooldowns
    refresh_status
    @log_window.display_auto_affected_status(battler)
    @log_window.wait_and_clear
    end
    BattleManager.turn_end
    process_event
    start_party_command_selection
    end

    If you’re using another ATB script you may be able to get it to work by using the same battler.update_cooldowns line somewhere in there.

Leave a reply to Sion Cancel reply