Elemental Weakness stun

so.. I was trying to make a system that applies a state to an enemy or an actor when hitting them with their elemental weaknesses, like in persona 5.
Like, if an enemy is weak against fire, and he get hit by fire skill, he will get an state (stun, for this example)
I using “DreamX instant turn battle” and Yanfly's plugins
But I don’t that good on scripting
You can do this with the damage formula like so:

Code:
if (b.elementRate(elementId) > 1) {b.addState(stateId)}; damage formula;

//Example, where element id is 1, and state id is 3

if (b.elementRate(1) > 1) {b.addState(3)}; a.atk * 4 - b.def * 2;
so I tested that out and its works out!
thank you 🙂
Maybe you have an older version of the plugin but Elemental Weakness settings are included in it at the top of the plugin settings list.
I know but for some reason when I tested it with the plugin itself I couldn’t get it to work on the way I wanted it to work
Maybe I will try it again with the plugin itself but If this method works out I wouldn’t mind

Original thread: https://forums.rpgmakerweb.com/threads/elemental-weakness-stun.108588/