[RPGMMV]How to replace State via Skill?

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
82
Reaction score
5
First Language
Russian
Primarily Uses
RMMV
Okay, i got next problem:
1)I have Yanfly's Buffs & States Core and Battle Core;
2)I have States 14 and 15.

How to make a skill that checks if there is a state 14 on the target? And if the target has this state, add state 15?
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
518
Reaction score
184
First Language
English
Primarily Uses
RMMV
you could do that in the formula box in the skill

you would use an if else statement

if b.isStateAffected(14) ? b.addState(15) : 0

I'm not sure how to do it with yanfly plugin off the top of my head
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,058
Reaction score
979
First Language
English
Primarily Uses
RMMV
If your skill also does damage, you don't even need a plugin for that. In the skill note box:

Code:
if (b.isStateAffected(14)) b.addState(15); YOU_DAMAGE_FORMULA_HERE
Edit: Doh, I was a few seconds too slow ;)

Edit2: Not sure if Buffs/States Core can do much for this, but you could use action sequences if you have the action sequence packs to do it more cleanly than the formula box (no "0" damage popup if the skill isn't supposed to deal damage)

<Whole Action>
perform action
action animation: targets
action effect: targets
perform finish
</Whole Action>
<Target Action>
if (target.isStateAffected(14))
add state 15: target
end
</Target Action>
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
82
Reaction score
5
First Language
Russian
Primarily Uses
RMMV
When I wrote formulas, then nothing happens. States didn't replace, it shows only "0".
I do not have action sequences pack.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
518
Reaction score
184
First Language
English
Primarily Uses
RMMV
Well if the formula is entered incorrectly, it will result in 0. The formulae given were basic, you needed to add something else to make it deal damage if that's what you're looking for

if b.isStateAffected(14) ? (b.addState(15) a.atk*2) : a.atk*2;

This one would check if target has state 14, if yes then it adds state 15 and deals dmg = user's atk*2 else it just deals dmg = user's atk*2

Also, capitalization matters
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,058
Reaction score
979
First Language
English
Primarily Uses
RMMV
Wait, so you want it to *replace* state 14 with state 15 instead of just adding 15?

Anyway yeah, if using the formula box, it's always going to show 0 which is why I tend to avoid doing it that way unless the skill also is meant to deal damage. To replace 14 with 15:

Code:
if (b.isStateAffected(14)){ b.removeState(14); b.addState(15); } YOUR_DAMAGE_FORMULA_HERE
Unless you decide to go with action sequences, I'd strongly recommend giving the skill some damage, even if small, to avoid the tacky 0 damage popup. You can't get rid of that without plugins.

Edit: Replace YOUR_DAMAGE_FORMULA_HERE with your damage formula. a.atk * 4 - b.def * 2 or something.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
518
Reaction score
184
First Language
English
Primarily Uses
RMMV
As @Aesica mentioned, if you want it to be a skill that does no dmg, you'll need to go ahead and get those action sequence plugins. They are not too difficult to figure out how to use them. yanfly has excellent tutorial videos on his website, and there's even a thread on this forum devoted to action sequences.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
82
Reaction score
5
First Language
Russian
Primarily Uses
RMMV
It might be weird, but when I just copypasted next formulas:
JavaScript:
if b.isStateAffected(14) ? (b.addState(15));
and
JavaScript:
if (b.isStateAffected(14)) b.addState(15);
Then skill doesn't even worked. But when I use
JavaScript:
if (b.isStateAffected(14)){ b.removeState(14); b.addState(15); }
Or
JavaScript:
if (b.isStateAffected(14)){ b.addState(15); }
then skill works okay.
Also, State 14 will automatically removed if State 15 grants immunity from State 14.
 
Last edited:

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
82
Reaction score
5
First Language
Russian
Primarily Uses
RMMV
Glad you got it figured out :LZSgrin:
Thank you too for advices.
I just didn't wanted to play with HIME's plugins. They're quite different from VX Ace scripts. Thus, Progressive States plugin is not perfect.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Hope y'all are staying healthy, safe and informed. Maybe pick up a new hobby or skill while you're at it.
Wanted to post a video of location i've finished but it doesn't work...
The game jam has done a lot of good in actually kicking my butt into action. I've even gotten over my crippling hatred of mapping thanks to it! :LZSexcite:

(Okay, there's also schoolwork forcing me to get on the computer, but I like to give credit where credit is due.)
Decided to start working on my second biome/area...


I'm sure I'll end up hating and changing things a whole lot over the next week. :LZSexcite:
I feel bad sometimes around others, I hate, and I mean HATE being touched, and I know they don't know I hate it so much

Forum statistics

Threads
95,656
Messages
930,806
Members
125,988
Latest member
jiive
Top