I'm surprised I'm the first person to ever attempt this with RPG Maker MV. Are there really no plugins that already do this? Ideally it would also make each skill usable once per battle for enemy battlers, but that's just a bonus for my purpose.
MV Make each skill only usable once per battle
JS Plugin RequestsIf there's no specific plugin for this, then why not use one of the plugins which give cool downs and set the cool down for each skill at e.g. 99 turns?
derp I didn't even think to try that! Thanks for the prompt reply!
I think you're looking for one of Yanfly's plugins, YEP_X_LimitedSkillUses.
I've been using it for a while and is pretty good, you can limit all skills at default or each one individually.
I've been using it for a while and is pretty good, you can limit all skills at default or each one individually.
one problem with this method is eventually the 99 turns will pass and the skill will be used again... I would think garret95's method would be better since Yanfly's plugin can make a skill usable only once. If you cannot use the plugin I will try to test a few idea's I have with events.
You don't even need a plugin for this (or for cooldowns in general). You can create a state that seals the skill, and set it to be removed with whatever condition you want, such as when the battle ends. Obviously, this is a bit of a chore since every skill probably needs its own cooldown state, but it's definitely doable.
A bigger problem would be having a battle with more than 99 turns! But if it does last that long, then probably the player ran out of skills much, much earlier, so letting them have them back so they can finish this fight might be a kindness.
But actually I personally use the method that @Solar_Flare suggests when I want this. I didn't mention it because I think if you have a lot of skills it could be burdensome. But it's definitely doable.
Moved to: Plugin Requests
The problem with that is the state gets reset when you die.
Also: how do I programmatically seal a skill? I'm just gonna hard code it, but there's no explanation in the docs.
There's a "seal skill" trait which is checked by the
There should be a way to avoid states being reset when you die if that's what you want. I can't remember exactly but it most likely does require a plugin.
Game_BattlerBase.prototype.isSkillSealed function. Does that help?There should be a way to avoid states being reset when you die if that's what you want. I can't remember exactly but it most likely does require a plugin.
Eh, not quite. I want to prgrammatically seal a skill, not check if a skill is sealed. Is there anything I can do other than search the RPG Maker source code?
The "no coding" way to seal a skill would be:
If you're doing in JavaScript, you'd probably overwrite the function I mentioned to return true when the skill should be sealed. That's why I pointed you to the "isSkillSealed" function when you asked how to seal a skill – because the way to do it is to, one way or another, make that function return true.
- Create a state that adds the Seal Skill trait for that skill
- In your event, add that state to the actor.
If you're doing in JavaScript, you'd probably overwrite the function I mentioned to return true when the skill should be sealed. That's why I pointed you to the "isSkillSealed" function when you asked how to seal a skill – because the way to do it is to, one way or another, make that function return true.
I understand that, but because I'm building a plugin it won't work for my purposes. What is the instruction the virtual machine receives from the game to seal skills?
The quickest way to change how skills are sealed would be to replace this function to do something different. For example:
JavaScript:
const old_isSkillSealed = Game_BattlerBase.prototype.isSkillSealed
function Game_BattlerBase.prototype.isSkillSealed(skill) {}
return old_isSkillSealed.call(this, skill) || this._sealedSkills.contains(skill);
}
This is untested and incomplete (you'd need to couple it with something that puts things in a _sealedSkills array on the actor), but that's the general approach I would take.
Another possibility would be to add another trait source, which would look something like this (example taken from one of my actual plugins):
JavaScript:
var old_actorTraits = Game_BattlerBase.prototype.traitObjects;
Game_BattlerBase.prototype.traitObjects = function() {
var traits = old_actorTraits.call(this);
if(this.race()) {
traits.push(this.race());
}
return traits;
};
In this example
this.race() returns a class from the database, which is then used as an additional source of traits (so in effect, actors in this system get two classes - one for their actual class, and one for their race). You can use pretty much anything, as long as it has an array of traits. You could even just push an object that has nothing but an array of traits.Original thread: https://forums.rpgmakerweb.com/threads/make-each-skill-only-usable-once-per-battle.137909/