Im having a very difficult time making a piece of armor that provides a bonus to DEF once each battle, once the actor takes any sort of damage the state is turned off and reset the next battle.
I tried this on the state given by armor. No luck, I also tried creating a dummy state that adds my DEF state and used the custom react to remove the state and it did not work either.
I tried this on the state given by armor. No luck, I also tried creating a dummy state that adds my DEF state and used the custom react to remove the state and it did not work either.
Code:
<Custom Passive Condition>
if ($gameParty.inBattle() && user._guardCheck !== 1){
var atkcount = 1; //This is the attack counter. Change it to fit your purpose. 1 means it will be removed after 1 attack and so on
user._attackCount = user._attackCount || atkcount; //Set this flag to count your attacks received
user.setStateCounter(99, target._attackCount); //Set a visual counter to your state. Change X to your state ID
condition = true; //Enablethe passive state
}
else{
user._guardCheck = undefined;
user._attackCount = undefined;
condition = false; //Disable the passive state
}
</Custom Passive Condition>
<Custom React Effect>
//Check if actor takes dmg
if (value > 0 && !this.isHpRecover()){
//Decrease the attack counter by 1
target._attackCount -= 1;
//Set a counter to your state. Change X to your state ID
target.setStateCounter(99, target._attackCount);
//Check if attack counter reaches 0
if (target._attackCount <=0){
target._guardCheck = 1;}}
</Custom React Effect>