Padowin1991

Villager
Member
Joined
Jul 30, 2013
Messages
12
Reaction score
0
First Language
English
Primarily Uses
I'm trying to make something similar to persona 5, where if certain enemies are hit by certain elements, they enter into a knocked down state. I am using yanfly's buff and states script and here is what I have as a passive state in my enemies notebox.

<Custom Respond Effect>

Get the element ID of the the attack the target received.

var element = this.item().damage.elementId;

// Check if it is damage based and if the element matches the interrupting element.

if (this.isDamage() && element === 2) {

self.add_state(33)

}

</Custom Respond Effect>

However when my enemy is hit by the fire element(element 2), they don't enter into this state, i'm wondering if I did something wrong.

Here is the link to the script being used.
http://www.yanfly.moe/wiki/Buffs_&_States_Core_(YEP)
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,925
Reaction score
1,656
First Language
English
Primarily Uses
RMMV
I believe u need a semicolon after (33)
Like so:

if (this.isDamage() && element === 2) {
self.add_state(33);
}

I am assuming the syntax for everything else is correct, I haven't actually tried testing it out, but the semicolon thing was the 1st thing I noticed was missing.
 

Padowin1991

Villager
Member
Joined
Jul 30, 2013
Messages
12
Reaction score
0
First Language
English
Primarily Uses
I believe u need a semicolon after (33)
Like so:

if (this.isDamage() && element === 2) {
self.add_state(33);
}

I am assuming the syntax for everything else is correct, I haven't actually tried testing it out, but the semicolon thing was the 1st thing I noticed was missing.
Oh yeah I forgot about that, fixed that, but it still isn't working.
 

ScientistWD

Innocuous
Veteran
Joined
May 28, 2016
Messages
72
Reaction score
59
First Language
English
Primarily Uses
RMMV
Hmmm....
Instead of

self.add_state(33);

use

target.addState(33);

I think that's all you need.
 

Padowin1991

Villager
Member
Joined
Jul 30, 2013
Messages
12
Reaction score
0
First Language
English
Primarily Uses
Hmmm....
Instead of

self.add_state(33);

use

target.addState(33);

I think that's all you need.

Thanks! it's working now, I also put "//" before the comment "Get the element ID of the the attack the target received."
 

Latest Threads

Latest Posts

Latest Profile Posts

SA51K_SHADER_IDLE.gifZombie is not the only thing people turned into in this town. There is also something else here. Something has many different names in history, the plague, the black oil, the purity, the filth. And now, it's called the shade.
(Maybe too much X-File reference. :kaojoy:)
Thanks, google for putting together a random pixel art Olympics game in your logo that puts everything I've ever done to shame in pretty much every aspect. ;)
Chizuru
chizuru.png


anyway, i just recovered from Covid.
Work's been delayed for a month but now i'm back drawing again.
Ah yes i learned how to make name boxes Im now profeshonal
The snowy mountains in my game are finally done... what a crazy journey.

Forum statistics

Threads
113,611
Messages
1,076,216
Members
147,618
Latest member
Ohzaru
Top