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
361
Reaction score
116
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,154
Reaction score
1,865
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

Fun fact. Today it's exactly 2600 days since I met my now gf for the first time. Sometimes being a programmer can be really useful. O:)
Is RPG Maker VX (rgss2) still relevant? xD
ZyCHqk2.png

Something about top-downs.
I have never felt so attacked by a tree before :LZSlol: it took 10++ hours to make but at least it looks pretty LOL

Untitled-1.png
now seems like the worst time for me to need a better computer with how much stuff is costing. that and I don't thing there's much else I can do to make MV run any better with what I have.

Forum statistics

Threads
118,455
Messages
1,116,111
Members
155,441
Latest member
Peetaxx
Top