I am trying to make a state that kills an actor or battler, and then switches which team they are on in following battles (only works on some enemies/actors). This includes having an enemy equivalent to some of the actors in the game.
Notable plugins include YEP_BuffsStatesCore and WAY_CustomOnDeathEval.
What I'm trying to accomplish is a state using the StateCounter function which, when the state counter reaches 10, kills the affected actor or battler, running a common event with some dialogue specific to what actor or battler died and then either spawning an enemy event or adding them to the party respectively.
Here's the state note:
It checks if the target is an actor (and what actor it is) before running a common event for that actor, or if it is an enemy, simply tells the game that variable 3 (my 'cause of death' variable) was state 8.
The skill which applies the state has the damage formula:
which applies the state, kills the target if it is at 10, and does some damage regardless.
The enemies which are susceptible to this state all have the notetag:
Which does effectively the same thing as the target.actorId() section in the state tag but for enemies.
My problem is that enemies killed by the state aren't triggering the common event. Actors killed by state level 10 will successfully trigger it and subsequently determine whether or not they should be switching teams, and enemies killed before reaching state level 10 are successfully triggering event 8, calling which enemy has died, and declaring that they are not state affected based on variable 3.
For whatever reason, killing an enemy via reaching state level 10 will not trigger any common events I try. They just die and nothing else happens.
I'm a novice at coding and can't figure out why this specific scenario doesn't work. The best guess I have is the order of operations is wrong somehow.
Notable plugins include YEP_BuffsStatesCore and WAY_CustomOnDeathEval.
What I'm trying to accomplish is a state using the StateCounter function which, when the state counter reaches 10, kills the affected actor or battler, running a common event with some dialogue specific to what actor or battler died and then either spawning an enemy event or adding them to the party respectively.
Here's the state note:
JavaScript:
<Custom Apply Effect>
target.addStateCounter(8, 1);
$gameVariables.setValue(1, target.actorId());
if ($gameVariables.value(1) >= 1) {
if (target.getStateCounter(8) >= 10) {
$gameVariables.setValue(3, 8);
$gameTemp.reserveCommonEvent($gameVariables.value(1));
}
}
else if (target.getStateCounter(8) >= 10) {
$gameVariables.setValue(3, 8);
}
</Custom Apply Effect>
The skill which applies the state has the damage formula:
JavaScript:
b.addState(8); if (b.getStateCounter(8) >= 10) {b.die()}; a.atk * 0.5
The enemies which are susceptible to this state all have the notetag:
JavaScript:
<Custom On Death Eval>
$gameVariables.setValue(2, [a number specific to each enemy to ID who died]);
$gameTemp.reserveCommonEvent(8);
</Custom On Death Eval>
My problem is that enemies killed by the state aren't triggering the common event. Actors killed by state level 10 will successfully trigger it and subsequently determine whether or not they should be switching teams, and enemies killed before reaching state level 10 are successfully triggering event 8, calling which enemy has died, and declaring that they are not state affected based on variable 3.
For whatever reason, killing an enemy via reaching state level 10 will not trigger any common events I try. They just die and nothing else happens.
I'm a novice at coding and can't figure out why this specific scenario doesn't work. The best guess I have is the order of operations is wrong somehow.