Hey all,
Around two months ago, I made some abilities with the help of some lovely people from the forum. Having changed a bunch of systems since then, I was trying to iterate on one of those abilities and hit a bunch of errors I can't seem to solve.
Basically how these abilities work is that the class has opener skills with MP cost which turn on switches(6, 7) and each switch is required for a different finisher skill which then turns off those switches so the finisher can only be used once per turn. The change I'm trying to implement is to have one of these finishers "reset its cooldown" when it kills an enemy.
The first method I've tried is this:
This code gives me the following error in the console: target is not defined.
My guess was that by the time the code runs, the target is already dead and removed from the troop list so the code has no target. So, thinking that may be the problem, I've tried the following code so that the target is saved in a variable before it is dead:
But this code gives the following error: $gameVariables.value(21).isDead() is not a function.
I'm really not sure what this error means. I'm probably doing something wrong, but what?
Additional Question: I didn't want to make a separate thread for this question so I'll tack it on at the end: Is there a plugin like BaseTroopEvent that runs at the end of every combat? If not, I'll probably do this by making a common event and adding it at the end of each battle but a way to do that automatically would be helpful.
Around two months ago, I made some abilities with the help of some lovely people from the forum. Having changed a bunch of systems since then, I was trying to iterate on one of those abilities and hit a bunch of errors I can't seem to solve.
Basically how these abilities work is that the class has opener skills with MP cost which turn on switches(6, 7) and each switch is required for a different finisher skill which then turns off those switches so the finisher can only be used once per turn. The change I'm trying to implement is to have one of these finishers "reset its cooldown" when it kills an enemy.
The first method I've tried is this:
JavaScript:
<Instant Cast>
<Custom Requirement>
if ($gameSwitches.value(7)) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Execution>
$gameSwitches.setValue(6, false);
if (target.isDead()) {
$gameSwitches.setValue(7, true);
} else {
$gameSwitches.setValue(7, false);
}
</Custom Execution>
This code gives me the following error in the console: target is not defined.
My guess was that by the time the code runs, the target is already dead and removed from the troop list so the code has no target. So, thinking that may be the problem, I've tried the following code so that the target is saved in a variable before it is dead:
JavaScript:
<Instant Cast>
<Custom Requirement>
if ($gameSwitches.value(7)) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Before Eval>
$gameVariables.setValue(21, target);
</Before Eval>
<Custom Execution>
$gameSwitches.setValue(6, false);
if ($gameVariables.value(21).isDead()) {
$gameSwitches.setValue(7, true);
} else {
$gameSwitches.setValue(7, false);
}
</Custom Execution>
But this code gives the following error: $gameVariables.value(21).isDead() is not a function.
I'm really not sure what this error means. I'm probably doing something wrong, but what?
Additional Question: I didn't want to make a separate thread for this question so I'll tack it on at the end: Is there a plugin like BaseTroopEvent that runs at the end of every combat? If not, I'll probably do this by making a common event and adding it at the end of each battle but a way to do that automatically would be helpful.