Hi there. I'm currently having trouble with Yanfly's Buff and States Core plugin.
I'm trying to create a skill that confuses enemies by changing the other party member's battler graphics to another party member's. To do this, I have the skill add a state to the 3 other members that when applied to the inflicts confusion to all enemies in a troop while also calling a common event to change character graphics. Then, upon removal of the state, I wanted it to play an animation on the character who lost the state while also changing the graphics back to their originals.
This is the best I could come up with to achieve all of the that using script calls in the state's notebox:
There seems to be to problems with this. First, I can't figure out how to make the script call for adding a state to an enemy target all enemies in a troop, so I had to resort to repeating the script call (which causing a TypeError in the console when the index for an enemy isn't filled). The other problem is that I can't figure out what script calls are need to make sure that the animation only plays once for each actor. The way it is now it will play even when the character has already exited the state, as the Remove Effect gets redone when each member loses the state and the code is re-ran. I know this is because I have my if Statement checking for whether the character has the state, and playing the animation if he doesn't which keeps getting checked on each execution of the code.
Is there anyway to make it so that my script call adds the confusion state to all members of the enemy Troop without repeating the script call, and make it so that the animation that plays at the removal of the state only plays once for each actor?
Many thanks to whoever answers.
I'm trying to create a skill that confuses enemies by changing the other party member's battler graphics to another party member's. To do this, I have the skill add a state to the 3 other members that when applied to the inflicts confusion to all enemies in a troop while also calling a common event to change character graphics. Then, upon removal of the state, I wanted it to play an animation on the character who lost the state while also changing the graphics back to their originals.
This is the best I could come up with to achieve all of the that using script calls in the state's notebox:
<Custom Apply Effect>
$gameTroop.members()[0].addState(8);
$gameTroop.members()[1].addState(8);
$gameTroop.members()[2].addState(8);
$gameTroop.members()[3].addState(8);
$gameTroop.members()[4].addState(8);
$gameTroop.members()[5].addState(8);
$gameTroop.members()[6].addState(8);
$gameTroop.members()[7].addState(8);
</Custom Apply Effect>
<Custom Remove Effect>
if ($gameActors.actor(1).isStateAffected(19) === false) {$gameActors.actor(1).startAnimation(121, false, 2);}
if ($gameActors.actor(2).isStateAffected(19) === false) {$gameActors.actor(2).startAnimation(121, false, 2);}
if ($gameActors.actor(3).isStateAffected(19) === false) {$gameActors.actor(3).startAnimation(121, false, 2);}
$gameTemp.reserveCommonEvent(2);
</Custom Remove Effect>
$gameTroop.members()[0].addState(8);
$gameTroop.members()[1].addState(8);
$gameTroop.members()[2].addState(8);
$gameTroop.members()[3].addState(8);
$gameTroop.members()[4].addState(8);
$gameTroop.members()[5].addState(8);
$gameTroop.members()[6].addState(8);
$gameTroop.members()[7].addState(8);
</Custom Apply Effect>
<Custom Remove Effect>
if ($gameActors.actor(1).isStateAffected(19) === false) {$gameActors.actor(1).startAnimation(121, false, 2);}
if ($gameActors.actor(2).isStateAffected(19) === false) {$gameActors.actor(2).startAnimation(121, false, 2);}
if ($gameActors.actor(3).isStateAffected(19) === false) {$gameActors.actor(3).startAnimation(121, false, 2);}
$gameTemp.reserveCommonEvent(2);
</Custom Remove Effect>
There seems to be to problems with this. First, I can't figure out how to make the script call for adding a state to an enemy target all enemies in a troop, so I had to resort to repeating the script call (which causing a TypeError in the console when the index for an enemy isn't filled). The other problem is that I can't figure out what script calls are need to make sure that the animation only plays once for each actor. The way it is now it will play even when the character has already exited the state, as the Remove Effect gets redone when each member loses the state and the code is re-ran. I know this is because I have my if Statement checking for whether the character has the state, and playing the animation if he doesn't which keeps getting checked on each execution of the code.
Is there anyway to make it so that my script call adds the confusion state to all members of the enemy Troop without repeating the script call, and make it so that the animation that plays at the removal of the state only plays once for each actor?
Many thanks to whoever answers.