Applying a state to the user only once on skills that hit multiple times?

sleepykat

Villager
Member
Joined
May 14, 2021
Messages
5
Reaction score
4
First Language
English
Primarily Uses
RMMV
Hi, I'm having a little bit of trouble with making a skill that's designed to hit random enemies, and then apply a stacking state to the user. So far, I've been using Yanfly's Skill Core and Buffs & State Core, as well as Nekoyoubi's State Resources plugin to make this happen.

To give a little more info, the skill is supposed to hit 3 random enemies, and then apply 1 stack of the stacking state, which can be used as a resource to spend on other skills. I've set the 'scope' of the skill to the '3 random enemies' option, and placed this notetag in the skill notes to have it apply the state to the user:

<After Eval>
a.addState(15);
</After Eval>

So far, so good. Except...when I actually go to test the skill, it applies the stacking state to the user for each enemy hit. So instead of granting only one stack, it actually grants three. Is there any way to have it apply the state to the user only once, despite hitting the enemies multiple times? I've tried experimenting with applying the state during the post-damage phase, or with manually determining the scope via Yanfly's Target Core, but nothing seems to work. If anyone has any ideas, I would greatly appreciate it! Thanks!
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
154
Reaction score
130
First Language
German
Primarily Uses
RMMV
Mhm, haven't tried this myself yet, but maybe it works if you place your code in the <Custom Execution> notetag?

If all else fails, you could only apply the state if a switch is true and immediately set that switch to false. Then you can set it to true again in a common event triggered by the skill (as far as I know this should only be called after the skill has finished resolving).

If even that fails you could instead use a base troop event plugin to reset the switch at the end of every turn. This would require a different switch for every actor who can use the skill.
 

VegaKotes

Veteran
Veteran
Joined
Jun 25, 2013
Messages
217
Reaction score
152
First Language
English
Primarily Uses
RMMV
If you can't get the stacks to stack correctly you might also consider simply increases the cost of those other skills. So that spells that would cost 1 now cost 3. Ones that cost 2 cost 6 and so on and so forth.
 

pawsplay

Veteran
Veteran
Joined
Mar 29, 2012
Messages
392
Reaction score
136
First Language
English
Primarily Uses
RMMV
What if you designed the skill as adding the state to the user, and then used scripting to execute the attack against three random enemies?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,207
Reaction score
1,895
First Language
English
Primarily Uses
RMMV
Mhm, haven't tried this myself yet, but maybe it works if you place your code in the <Custom Execution> notetag?
This, or just install Yanfly's Action Sequences 1 and add the state in the <finish action> section. That only executes one time after the rest of the skill is done.
 

sleepykat

Villager
Member
Joined
May 14, 2021
Messages
5
Reaction score
4
First Language
English
Primarily Uses
RMMV
Mhm, haven't tried this myself yet, but maybe it works if you place your code in the <Custom Execution> notetag?

If all else fails, you could only apply the state if a switch is true and immediately set that switch to false. Then you can set it to true again in a common event triggered by the skill (as far as I know this should only be called after the skill has finished resolving).

If even that fails you could instead use a base troop event plugin to reset the switch at the end of every turn. This would require a different switch for every actor who can use the skill.
I tried it out with <Custom Execution> and it immediately worked ^^" I can't believe I forgot to check that one, I tried out nearly all of the other tags in Yanfly's system haha.

Thank you to everyone who answered, and to eomereolsson and ATT_Turan for reminding me about <custom execution> and the action sequences pack! Hopefully I'll manage to remember those exist in the future lol ^^
 

Latest Threads

Latest Posts

Latest Profile Posts

“Battle not with monsters, lest ye become a monster, and if you gaze into the abyss, the abyss gazes also into you.”
gxQUtTE.gif
Don't you hate it when you play an mmo to pass some time then an update drops that makes your playing experience less enjoyable and quit because of it?
sigh...
SF_People3_6 added!
index.php

OcRam MZ and RETRO demo -projects are now also updated (includes all plugins released yesterday).
At work.
Co: "This bug drove me insane. I tried a lot of things to debug, it just stuck".
Me: "How did you debug it?"
Co: *shows a complicated debugging method using breakpoints and everything*
Me: "What about ... " *casually prints a stack trace in the try/catch exception
Co: "Wait, you can do that??"

Forum statistics

Threads
118,663
Messages
1,117,648
Members
155,768
Latest member
grc14
Top