Hi all. This bothersome issue has graduated from the "JavaScript questions that don't deserve their own thread" topic. My game has a skill (among several others) that deals damage to one target, then applies a state to all allies that lasts for the remainder of the turn. To that end, the skill uses "1 Enemy" as its scope and applies the ally state through JS. The code is as follows (I'm using Yanfly's Skill Core):
The state applies as expected unless I use the skill again on the next turn, immediately after the state elapses. If this happens, the state does not apply to anybody. On the turn after this, if the skill is used again, the state applies as normal.
I am not really sure what's causing the issue. I initially believed it was an issue with the Turn End auto-removal timing - the issue does not arise when using Action End, and as far as I can tell the only time this happens is when attempting to apply the same state using JS the turn after the initial state ends. The state can be re-applied if a different skill applies the state to the target through the game engine as opposed to JS. ATT_Turan believes it is an issue with Yanfly's Skill Core, so I've played around with that a bit (e.g. changing the note tags) to no avail.
At his suggestion I also tried adding member._stateTurns[81] = 0 to the After Eval. With this line, the state disappears if an actor is attacked (not 100% what I'm looking for but that's not really a problem), and that allows me to successfully reapply the state to that actor by reusing the skill on the next turn. However, reusing the skill still won't apply the state to any other actors that were not attacked, as if the state is not properly refreshing like it does when an actor gets attacked (it does also successfully apply to the actor that used/is using the skill, which I guess is because by that point there's been one whole turn since the initial usage of the skill). Turning off the Turn End auto-removal causes the state to not be removed at all, even though the addition to the After Eval sets the turns to zero (I assume that it doesn't check turn count if there is no auto-removal parameter). Forcing a removal through e.g. user.removeState in the state's note field is not effective.
Manually checking the actors for the state via the console reveals that they are all unaffected by the state after the initial turn elapses, regardless of whether or not they were attacked on the previous turn. Even though the value returns as "false," the state still does not re-apply to anyone except the user and, if applicable, the character(s) that were attacked on the previous turn.
These are the state's settings; they're fairly simple:
Turning off the Turn End auto-removal causes the state to not be removed at all, even though the addition to the After Eval sets the turns to zero (I assume that it doesn't check turn count if there is no auto-removal parameter). Forcing a removal through e.g. user.removeState in the state's note field is not effective.
I am curious if this is because of a quirk in the baseline programming; the only insight I've been able to find on this is a thread from 2014 where a VXA user was having a similar issue.
There are a couple of workarounds I can slap together for this, so the problem isn't dire, but none of them are exactly ideal. It seemed like something that would have a simple solution but this is proving to not be the case. At this point I mostly just want to know more about the underlying problem that is causing this; if it is solvable while retaining the intended functionality of the skill, that would be really great.
Thank you!
JavaScript:
<After Eval>
var group = user.friendsUnit().aliveMembers();
for (var i = 0; i < group.length; ++i) {
var member = group[i];
member.addState(81);
}
</After Eval>
The state applies as expected unless I use the skill again on the next turn, immediately after the state elapses. If this happens, the state does not apply to anybody. On the turn after this, if the skill is used again, the state applies as normal.
I am not really sure what's causing the issue. I initially believed it was an issue with the Turn End auto-removal timing - the issue does not arise when using Action End, and as far as I can tell the only time this happens is when attempting to apply the same state using JS the turn after the initial state ends. The state can be re-applied if a different skill applies the state to the target through the game engine as opposed to JS. ATT_Turan believes it is an issue with Yanfly's Skill Core, so I've played around with that a bit (e.g. changing the note tags) to no avail.
At his suggestion I also tried adding member._stateTurns[81] = 0 to the After Eval. With this line, the state disappears if an actor is attacked (not 100% what I'm looking for but that's not really a problem), and that allows me to successfully reapply the state to that actor by reusing the skill on the next turn. However, reusing the skill still won't apply the state to any other actors that were not attacked, as if the state is not properly refreshing like it does when an actor gets attacked (it does also successfully apply to the actor that used/is using the skill, which I guess is because by that point there's been one whole turn since the initial usage of the skill). Turning off the Turn End auto-removal causes the state to not be removed at all, even though the addition to the After Eval sets the turns to zero (I assume that it doesn't check turn count if there is no auto-removal parameter). Forcing a removal through e.g. user.removeState in the state's note field is not effective.
Manually checking the actors for the state via the console reveals that they are all unaffected by the state after the initial turn elapses, regardless of whether or not they were attacked on the previous turn. Even though the value returns as "false," the state still does not re-apply to anyone except the user and, if applicable, the character(s) that were attacked on the previous turn.
These are the state's settings; they're fairly simple:
Turning off the Turn End auto-removal causes the state to not be removed at all, even though the addition to the After Eval sets the turns to zero (I assume that it doesn't check turn count if there is no auto-removal parameter). Forcing a removal through e.g. user.removeState in the state's note field is not effective.
I am curious if this is because of a quirk in the baseline programming; the only insight I've been able to find on this is a thread from 2014 where a VXA user was having a similar issue.
There are a couple of workarounds I can slap together for this, so the problem isn't dire, but none of them are exactly ideal. It seemed like something that would have a simple solution but this is proving to not be the case. At this point I mostly just want to know more about the underlying problem that is causing this; if it is solvable while retaining the intended functionality of the skill, that would be really great.
Thank you!