Elemental Weakness causes Status Effects.

In this story one of the characters has a phobia of fire.
Obviously he has a elemental weakness but is there a way to make it so that if he's hit by fire then he'd get confused?
Allocate a passive state with no name, no icon to the actor concerned. I suggest making a note in the note box of that state of what you have done so that you don't accidentally use it for something else. This state will be the 'identifier'.

Then in the damage formula box for the fire skill have this:

if b.state?(x);b.add_state(y); a.mat * 4 - b. mdf * 2 end; a.mat * 4 - b. mdf * 2

x = the id of the state you have created, y = the id of the state you want to add (confusion is 5)
a.mat * 4 - b. mdf * 2 is purely for the sake of the example, you would put in whatever damage you want to occur.
Allocate a passive state with no name, no icon to the actor concerned. I suggest making a note in the note box of that state of what you have done so that you don't accidentally use it for something else. This state will be the 'identifier'.

Then in the damage formula box for the fire skill have this:

if b.state?(x);b.add_state(y); a.mat * 4 - b. mdf * 2 end; a.mat * 4 - b. mdf * 2

x = the id of the state you have created, y = the id of the state you want to add (confusion is 5)
a.mat * 4 - b. mdf * 2 is purely for the sake of the example, you would put in whatever damage you want to occur.

By Passives...i assume i'm gonna need the yanfly passive state script?
Well I tried it out and the damages just keeps being Null. What did I do wrong?
I missed a semi-colan from the formula - sorry about that. It should have been
if b.state?(x);b.add_state(y); a.mat * 4 - b. mdf * 2; end; a.mat * 4 - b. mdf * 2

though now I come to think about it, probably all you need is
if b.state?(x);b.add_state(y); end; a.mat * 4 - b. mdf * 2
I missed a semi-colan from the formula - sorry about that. It should have been
if b.state?(x);b.add_state(y); a.mat * 4 - b. mdf * 2; end; a.mat * 4 - b. mdf * 2

though now I come to think about it, probably all you need is
if b.state?(x);b.add_state(y); end; a.mat * 4 - b. mdf * 2

Now it's not working at all.
So I downloaded Yanfly's passive state script.

Put the <passive state: 50> (that's the empty one) in the Actor Notes.

Put the b.state?(50);b.add_state(5); end; a.mat * 4 - b. mdf * 2 into a skill called Test Fire.

When I test it out in battle it just doesn't work. It does that black screen error thing.
See if this works. Put a space after (50);
It would then read:
b.state?(50); b.add_state(5); end; a.mat * 4 - b. mdf * 2
See if this works. Put a space after (50);
It would then read:
b.state?(50); b.add_state(5); end; a.mat * 4 - b. mdf * 2
Nope.
Hmm...I'm not even sure if it'd be worth it at this point.

Original thread: https://forums.rpgmakerweb.com/threads/elemental-weakness-causes-status-effects.85370/