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
152
Reaction score
126
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
365
Reaction score
121
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,165
Reaction score
1,869
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

You thought kids rooms were messy. Look at this.
Back in the house and I'm hungry
Yoshi!
DNPwhy.gif

You're using that item wrong... TwT

Trying to get the mechanics down for a cute, story-driven board game! I think I've accomplished dice movement, item effects, and activating a space's event when you land on it. Art is WIP. Hope to open a thread about the game soon!
My entire family and I have Covid... If it's this bad with the vaccine, without must be terrible. Stay safe, everyone. This thing is a doozy.

Forum statistics

Threads
118,524
Messages
1,116,623
Members
155,539
Latest member
NecroCaticGames
Top