So, I've been working on a system that sort of combines FFVI's Runic Blade with FFV's blue magic, where when you have a certain state, you are targeted by spells, and there's a chance you'll learn the spell afterwards. I got this to work perfectly until I actually needed to check for the state. I admit, I'm ad-libbing it a bit, but this is the script I'm using to check if the spell gets learned.
Now, when I remove "&& (target.isStateAffected(30), I still get the same error, but when I revert it back to the original script which asked if the target's Class is ID 3, the script runs as intended again. What is it I'm doing wrong?
The picture I added is of the error message.
Code:
<Post-Damage Eval>
if (target.isActor() && (target.isStateAffected(30)) {
if (!target.isLearnedSkill(item.id)) {
if (Math.randomInt(100) < target.luk * 5) {
target.learnSkill(item.id);
var text = target.name() + ' has learned '
text = text + item.name + '!';
$gameMessage.add(text);
}
}
}
</Post-Damage Eval>
The picture I added is of the error message.