Dynamically add counterattack to skill

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
426
Reaction score
173
First Language
Dutch
Primarily Uses
RMMV
I'd like the skill to add the counter-attack-state after an attack to the user.

        var state = {code:21, dataId:18, value1:1, value2:0}; // 18 is my counter-attack-id in the database
        $dataSkills[skill.id].effects.push(state);
The code above applies the counter-attack-state to my enemies... That's not good :p. I need it to be applied to the user. But how?
 
Last edited by a moderator:

Uzuki

Kawaii on the streets, Senpai in the sheets
Veteran
Joined
Aug 18, 2012
Messages
1,933
Reaction score
1,326
First Language
English
Primarily Uses
RMMV
You can do this easily enough in the damage formula. You can add this after the damage output: ;a.add_state(State ID). This will add the state to the user after the damage is done. If you want to inflict a state on the target it's: ;b.add_state(State ID).
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
426
Reaction score
173
First Language
Dutch
Primarily Uses
RMMV
I tried adding:


100 + a.mat * 2 - b.mdf * 2 ; a.add_state(7)


But the result was that I now do 0 damage, and no state is added at all.
 
Last edited by a moderator:

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,454
First Language
Portuguese
Primarily Uses
the damage formula must always return a number, so the calculations must be the last part of your code.


a.addState(7) ; 100 + a.mat * 2 - b.mdf * 2 


should work ("add_state" is from RM VXa, the correct syntax on MV is "addState")
 
Last edited by a moderator:

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
426
Reaction score
173
First Language
Dutch
Primarily Uses
RMMV
Thanks. It must indeed be added to the first part.


It seems the state worked. It's just not visible on the GUI because it has no state-icon so I thought it didn't work, but it did.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

A part of me wants to return back to the beginning and first two chapters and remake them with parallax map. But I have decided not to. Every chapter is just another step in the journey. No need to walk back unless I have to revise dialouge.
Hey guys! Good news!
I just released the Games from Brazil - Part 2 on my Youtube Channel! I am really happy that part 1 had 100 views and I hope more people will be interested to see the potencial of Brazilian Game Devs!
Effervesce Fallacy™ - Attract Mode (proto)

Forum statistics

Threads
107,570
Messages
1,030,636
Members
139,671
Latest member
WDRS
Top