RMMV How to build state conditional skill with yanfly action sequence?

Utsuho Reiuji

Villager
Member
Joined
Jan 23, 2014
Messages
8
Reaction score
1
First Language
English
Primarily Uses
I noticed that my state conditional damage formula won't work with yanfly's action sequence.

if (b.isStateAffected(39)) {a.mat * 7} else {0}

How can I make it work while using yanfly action sequence in my note tab?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,055
Reaction score
1,482
First Language
EN
Primarily Uses
RMMZ
That formula looks OK, assuming you're using it in the damage formula box of a skill or item.

Yanfly's action sequences don't change how the damage formula is evaluated, but it is possible you have forgotten to include an action effect action in your sequence, i.e. the formula never gets evaluated/applied. Maybe post your action sequence here? :)

Here's a YEP action sequence reference in case it helps~
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
772
Reaction score
482
First Language
English
Primarily Uses
RMMV
Without looking too closely at the actual plugin, I'd suspect the reason has something to do with nested if statements in the action sequence causing an issue.

To get around this, you could try changing your formula to a ternary operator instead of using an if statement.

if (b.isStateAffected(39)) {a.mat * 7} else {0} would become var dmg = (b.isStateAffected(39)) ? a.mat * 7 : 0; return dmg
 

Utsuho Reiuji

Villager
Member
Joined
Jan 23, 2014
Messages
8
Reaction score
1
First Language
English
Primarily Uses
Thanks for the reply. I can't believe I didn't realize I had an typo in the action sequence this whole time. The action effect was really my mistake. I rechecked a couple times and still didn't realized it ^^"

I am new to the damage formula thing, are there any instructions for the coding that I can learn?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,055
Reaction score
1,482
First Language
EN
Primarily Uses
RMMZ
There's a thread here with a bunch of tips:
The damage formula is essentially a JavaScript eval, so a lot of stuff is valid. :)
 

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

Latest Threads

Latest Profile Posts

Once again working on a game I'm not sure I'm going to sell or even publish
That feel when you're awake past midnight and suddenly you're one year older :ninja:
I miss collaborations, but I don't know how to find someone to make face parts just to share them with others, and even though I don't like writing or music, I can't trust anyone with writing on my game because it has themes that are easy to mess up, and music needs a clear tone and scenes.
People donating to me for my upcoming birthday so I can pay my team a little. Such angels, I'm so happy. T uT I smile so much my face hurts. Good souls in this world.
Playing Ragnarok Online again is very nostalgic. The last time I played it was 20 years ago, when I was ten-twelve old.
My first mmorpg.^^

Forum statistics

Threads
105,571
Messages
1,014,723
Members
137,245
Latest member
dashstop
Top