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
543
Reaction score
462
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
212
Reaction score
155
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
270
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
7,541
Reaction score
5,305
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

Try changing POV battle, near and far away like suikoden...
watercave2.jpg

diablofar.jpg

In the end I choose near over shoulder resembles RE4. Tight close window better. The correlation between battleback, monster style and battler should also be observed and merged.
Upgraded my avatar to be cuter.
When you look for several things for ages and then suddenly find it all at once.

Status.png
Status2.png
equip.png
I'm going to see if I can set up a triple booting setup. Windows for standard use & gaming, debian for linux development and manjaro for linux gaming, wine & proton use.
Who's got 2 thumbs and discovered an issue with his plugin after deleting the last fully functional copy? This guy xD

Forum statistics

Threads
129,701
Messages
1,204,406
Members
170,766
Latest member
EvilArthas
Top