Skill unlock on evade

I'm trying to build a skill that shows up in a class skill list in combat, but is only useable if the class has evaded an attack. The once the skill is used, becomes unuseable until another evade happens. I'm using a ton of YanFly add-ons and the Skill core seems to have what note tag i need, i just don't know the script to make it work. 

This is about as far as i got before i gave up:
 


<Custom Requirement>


if (a.result().missed || a.result().evaded) {


value = true;


} else {


value = false;


}


</Custom Requirement>
You're approaching it the wrong way (as you probably figured) - this won't work because things like result() only last for that turn.  The best way I can think of to handle it with Yanfly's plugins (rather than building your own) would be the States & Cores plugin.


Give this battler a state that is never removed even by Death or Recover All (and preferably doesn't actually show to the player) called "Has An Evade-Based Ability" or something like that.  Use Lunatic Mode to give that battler a custom Select effect that increases a variable by 1 and a custom React effect that decreases that same variable by 1.  This will give a net increase of +0 any time the battler is targeted and hit successfully, and +1 every time the battler is targetted but not hit successfully.  Now, have your custom skill requirement simply require that this variable is greater than 0.  As part of the skill's damage formula or attached common event, set the variable back to 0 so it can't be used again until you evade again.


A few things to keep in mind:

  • This approach will include Misses (as opposed to true Evades), Failed actions, and also failures by allies that are targetting this battler - you can probably create if-branches (checking things like the user is an enemy of the target) inside your Select/React effects if you want to in order to eliminate edge cases like this and force the battler to truly Evade something.
  • If you don't want the "credit" for evasion to carry over between battles, set this variable to 0 at the beginning of each battle as well (easily done via Yanfly's common troop events).
  • Finally, if you have multiple battlers that can gain skills like this, you will want to create a separate state and a separate variable for each one, unless you want them to be able to "share" evade credit and usage between them for some reason.



By the way, I think this is a very cool idea from a mechanics standpoint, especially if this class also has ways to taunt enemies to and greatly boost their evasion for short periods of time.
Thanks for the help and compliment! I'll give this a shot when i get home.
Got it working, and its perfect!. Thanks so much

Original thread: https://forums.rpgmakerweb.com/threads/skill-unlock-on-evade.66042/