Yo, me again!
What I am trying to do is to turn on a switch after an enemy took a certain amount of elemental damage and end the battle. Say as soon as the enemy has taken 500 HP of fire damage during the whole battle the switch ist turned on.
I tried to accomplish this via Yanflys Buffs & States Core using a Custom Respond effect, but I am not sure how to save the amount of damage taken. Another idea I would be fine is to turn the switch on after the enemy took a certain amount of elemental attacks instead of HP damage. In this case the switch would turn on after the enemy took fire damage for 10 times for example.
When the switch is turned on everything should be easily managable via battle events.
Here is what I tried for idea #2:
Unfortunately I am still guessing half of the time, when I try to script something, so I'd be happy about any thoughts!
What I am trying to do is to turn on a switch after an enemy took a certain amount of elemental damage and end the battle. Say as soon as the enemy has taken 500 HP of fire damage during the whole battle the switch ist turned on.
I tried to accomplish this via Yanflys Buffs & States Core using a Custom Respond effect, but I am not sure how to save the amount of damage taken. Another idea I would be fine is to turn the switch on after the enemy took a certain amount of elemental attacks instead of HP damage. In this case the switch would turn on after the enemy took fire damage for 10 times for example.
When the switch is turned on everything should be easily managable via battle events.
Here is what I tried for idea #2:
<Custom Respond Effect>
if (target.result().hpDamage >= 0) {
var elements = this.getItemElements();
while (elements.length > 0) {
var element = elements.shift();
var state = 0;
if (element === 11) {
$gameVariables.setValue(81, $gameVariables.value(81) + 1);
}
if ($gameVariables.value(81) >= 2) {
$gameSwitches.setValue(79, true);
}
}
}
</Custom Respond Effect>
Unfortunately I am still guessing half of the time, when I try to script something, so I'd be happy about any thoughts!