Creating a Skill that Affects All Enemies and Allies Differently

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
166
Reaction score
246
First Language
English
Primarily Uses
RMVXA
I am uncertain if this is in the right forum so I apologize in advance if it is.

I am working in Rpg Maker MV and recently ran across an issue. I was developing skills and wanted a powerful skill that targets all enemies and all allies but affects the groups differently. Specifically I want all enemies to be slowed and all allies to be hasted. I already have states built for slow and haste but I don't know how to go about combining these ideas together into one.

Can this be achieved through a forumla in the Hp damage box? A common event conditional scripting? Will I need plugins? I am at a loss on how to create this.
 

Uzuki

Kawaii on the streets, Senpai in the sheets
Veteran
Joined
Aug 18, 2012
Messages
1,884
Reaction score
1,275
First Language
English
Primarily Uses
RMMV
What you could do is give all the enemies a state that will mark them as enemies. Then use this formula in the skill box:

b.isStateAffected(x) ? b.addState(x) : a.addState(x)

The formula will check if the enemy state is inflicted and if it is, it'll inflict the slow state if the state isn't inflicted then they get the haste state.
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
166
Reaction score
246
First Language
English
Primarily Uses
RMVXA
So if I put that forumla in the damage box to affect all enemies with the enemy state, would I keep the skill as affecting all allies for the skills scope and apply a haste state to them?
 

Uzuki

Kawaii on the streets, Senpai in the sheets
Veteran
Joined
Aug 18, 2012
Messages
1,884
Reaction score
1,275
First Language
English
Primarily Uses
RMMV
So if I put that forumla in the damage box to affect all enemies with the enemy state, would I keep the skill as affecting all allies for the skills scope and apply a haste state to them?
Yes just put this in the damage formula box. And sorry I forgot that Target Everyone isn't a default option in the engine. Use Yanfly's Target Core plugin and then you'll have more control over the target scope.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,642
Reaction score
2,972
First Language
Tagalog
Primarily Uses
You can also just make it target self then do the buff/debuff all in the damage formula... The damage formula is a full JS evaluator so you can put any valid code in it, including enumerating all allies and enemies and doing something to each of them.
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
166
Reaction score
246
First Language
English
Primarily Uses
RMVXA
I'm afraid I've rarely ever touched the damage formula box. How would I go about doing what you suggested, @Engr. Adiktuzmiko?
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
166
Reaction score
246
First Language
English
Primarily Uses
RMVXA
Okay so what I could gather from doing a bit of digging on a formula forum and from @Uzuki's formula provided, I managed to whip up this formula for the damage box using HP Damage: b.addState(x); a.addState(x) but I'm having a problem where the spell is also applying the debuff to the allies, but interestingly enough not the enemies. I'm not sure what to do from here.

I've downloaded Yanfly's Target Core and applied the <Target: Everybody> notetag to the skill notebox. To rephrase, everyone is getting hit.

@Uzuki - is this why you suggested checking for a previous existing state on the enemy battler's? So that the allies would not be targeted?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,365
Reaction score
849
First Language
EN
Primarily Uses
RMMV
If you've got the "everybody" scope sorted out, you could try this for your skill formula:
Code:
(a.isActor() === b.isActor()) ? b.addState(11) : b.addState(12)
This says "if the user and target are on the same side (i.e. both actors or both enemies) give the target state 11, else give them state 12". You can change the numbers to suit your states~

Note that, because this is using the damage formula, it'll probably show a "0" damage popup on everyone. As a workaround you could try setting the Damage Type to None and putting the formula in a notetag instead, e.g. maybe this one from Yanfly's Skill Core plugin:
Code:
<Post-Damage Eval>
(a.isActor() === b.isActor()) ? b.addState(11) : b.addState(12)
</Post-Damage Eval>
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
166
Reaction score
246
First Language
English
Primarily Uses
RMVXA
Thank you everyone for your assistance with this skill's creation! @caethyril I got it working following your suggestion. There was only a minor hiccup. I had to use the <Before Eval> notetag from Yanfly's Skill Core plugin and not the <Post-Damage Eval>. That one would not work with the damage formula box turned off. But having the code check before damage got it working.

<Before Eval>
(a.isActor() === b.isActor()) ? b.addState(28) : b.addState(27)
</Before Eval>

Again, thank you everyone!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I really need to stop thinking there are new freebies just because someone made a new post in the freebies subforum lol.
AND just like that..... I got STEAM DLC up and working! YES!
Game making is like a marathon, except the last 1/4 is more like sprint... a very long and intense sprint.
Finally got to finish the demo for my project!
Another week has gone by. Maybe you made changes to your project/s. Maybe you didn't. Nonetheless, THAT IS NO EXCUSE TO NOT BACK THEM UP O_O!

Forum statistics

Threads
93,442
Messages
912,448
Members
122,968
Latest member
Paitshens
Top