Defective robot shutdown sequences

I'm making a robot, that's slightly quirky and defective. 


This is robot is rather powerful and destructive, but it has a habit of shutting off at the most inopportune moments.


I want it to have a 15% chance of shutting down when it gets hit. This is easy, simply give the enemies a 15% add state shutdown chance on hit.


The robot also has a power surge ability where its strength and defense greatly increase for 2 rounds, and then on the 3rd round it shuts down even if it's not hit. I can't figure out how to make this happen. 
shutdown, did you mean knockout?
No, knockout is "dead". 


The point is the robot just kind of konks out for 1 round. 


Its just a state that prevents actions. I can place it when the enemy attacks, I just can't make it happen when the power surge ends. 
I want it to have a 15% chance of shutting down when it gets hit. This is easy, simply give the enemies a 15% add state shutdown chance on hit.

require yanfly's buffs and states core and iBase


put this in your robot state.

Code:
<Custom React Effect>
value = value;
iBase.tv[1] = iBase.randomNumber(0,100);
if (iBase.tv[1] < (15 + 1)) {
target.addState(x);
}
</Custom React Effect>

15 >> 15%
x  >> state id (shutdown)
Having a 15% chance to inflict shutdown on an attack does not require any plugin. I simply have to add that state to the attack with the editor. The ability to do that is already there and easy. 


What at I can't figure out is the shutdown at the end of the buff state. How can I power surge for 2 rounds, and have him shutdown on the third round?
require yanfly's buffs and states core and iBase(optional)


put this in your robot state. (give the robot 'robot' state before starting battle, you can use yanfly's auto passive state)


<Custom Turn End Effect>
iBase.v[100] = iBase.v[100] || 0;
iBase.v[100] += 1;
if (iBase.v[100] == 3) {
iBase.v[100] = 0;
target.addState(x);
} else {
target.addState(y);
}
</Custom Turn End Effect>


when the turn end, it will add +1 to variable 100 (you can use default v[x] instead of iBase.v[x]) you can change 100 to any variable id.


when variable 100 is 3, it will add 'x' state to user and reset the variable to 0.


x is your shutdown state id.


y is the state where you increase user's atk and def.


[TRICK]


> set the state icon to 0 to hide it from battle hud.


> set state x and state y to 1 turn (power up state).
You would need a 2nd shutdown state, add the 2nd shutdown state for 3 rounds, shutdown immunity for 2 rounds.  This way enemies' hits would still have a possibility of causing shutdown.
So, adding more to this, I want any attack that does over 10% HP damage to be a guaranteed shutdown. 


I thought this would work, but my syntax is wrong somewhere on the if line. 


<Custom Respond Effect>


if value > .1 * a.mhp {


target.addState(32)


}


</Custom Respond Effect>
So, adding more to this, I want any attack that does over 10% HP damage to be a guaranteed shutdown. 


I thought this would work, but my syntax is wrong somewhere on the if line. 


<Custom Respond Effect>


if value > .1 * a.mhp {


target.addState(32)


}


</Custom Respond Effect>

<Custom Respond Effect>
if (value > 0.1 * target.mhp) {
target.addState(32)
}
</Custom Respond Effect>


target is the user that have the state. (mean the one who have the state)


a or user is the user that target to the enemy that have the state. (vice versa)


you forgot '()'


if you already have <Custom Respond Effect> before, put the if statement inside it.

Original thread: https://forums.rpgmakerweb.com/threads/defective-robot-shutdown-sequences.56542/