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
167
Reaction score
143
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
158
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
495
Reaction score
265
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
4,069
Reaction score
2,478
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

The power of tutorials. This was fun to make,parallax lightning makes more sense to me now. Now comes the annoying step of doing stuff without a step by step show though !_!
With the new phone, I can now play a lot of old RPGs that my old phone just didn't have room for. Some RPGs definitely show their age even with updated graphics and quick saving.
I don't think I have ever stuck to a project this long....And I'm still just in the planning stages basically xD
It's not about the engine, it's about the resources.

Forum statistics

Threads
121,963
Messages
1,145,505
Members
160,243
Latest member
KrisSis265
Top