Code for the "hexdrinker" effect

Hello everyone


Currently, I'm trying to recreate the Hexdrinker effect from League of Legends, using Yanfly's plugins.


This is my current code inside of a state:


<Custom React Effect>
if (target.hp / target.mhp <= 0.25) {
target.gainBarrier(100 + (20 * target.level), 5)
AudioManager.playSe({name:'Reflection', volume:100, pitch:100, pan:0});
}
</Custom React Effect>


I'm using Yanfly's AutoPassiveStates Plugin to automatically assign the state onto a player.


The problem I now have is, that it won't stop generating shields, when the conditions are met.


is there a way to generate a cooldown of 6 rounds or something?


Thanks in advance


Goldschuss
Ofcourse... set a new variable and count it down the cd.


Something like:


var cd;


if (cd===0){x=3;


...}


else {cd--;}


Care for how to combine 2 conditions with your other if.


Gl


p.s.: you ll possibly have to initiate the variable outside of the skill note. By script or using a variable done by game.
Thank you, I'll test it out
Fine, tell me if all went well.
I would suggest adding a cooldown state to the target which lasts some number of turns (or the entire battle, your call) and simply checking to make sure that state is not on the target before applying the shield state.


This will make it easier to track than a local variable, and I also worry that a variable might be shared between actors that both have Hexdrinkers equipped (meaning it would go on cooldown for everyone once the effect is triggered for anyone), although it's possible they'd be tracked separately; I've never played around with variable declaration inside Lunatic Mode code before.
Also a fine and possibly easier option, if you think inside of the rpg maker concept... I thought about it more generally
Thank you for all the answers guys, as well as lazrelectric.


I've taken some ideas from everyone and came up with my own solution.


And its much easier than cooldown variables 


If anyones interested, I can post it once I get home

Original thread: https://forums.rpgmakerweb.com/threads/code-for-the-hexdrinker-effect.66101/