stun enemy with elemental weakness

i'm not too savvy with coding or damage formulas, but something i remember being able to do in MV is to make it so a target gets a "stun" state if a skill hits their elemental weakness, similar to how weaknesses work in SMT and Persona where whoever is hit with their weakness would lose a turn in battle

i am well aware that MV and VX Ace have completely different scripting languages, but i was wondering how i could do that in VXA's damage formulas. if anyone can help, thanks in advance
Is the weakness supposed to be permanent or temporary? (i.e. does it go away when you change accessories, for example, or is it actor-dependent for the whole game)
Is the weakness supposed to be permanent or temporary? (i.e. does it go away when you change accessories, for example, or is it actor-dependent for the whole game)
i have a job system where the jobs have different elemental affinities, but it's all based around the built-in element rate traits
what i wanted to know was, like, the damage formula equation i'd need for, say...
a Fire elemental spell that checks if it hits a target that has a 200% elem. rate for Fire and applies a state to them on hit (in this case a "stun" state that makes them miss a turn)
and it'd apply to both enemies and actors, of course
i'd also take a script suggestion of anything that could speed this up, like, adding a state if a skill meets certain criteria (like being a weakness or hitting a critical). that feels like a script that should already be out there somewhere, and i'll probably search for it, but i'm kinda lazy sometimes lol-
I'm not a scripter (I'm sure it can be done elegantly through a script and maybe one of the resident script masters will make it for you), so here is a clunky way I would use:

1. I'd create states for each elemental weakness, which would be added to the actors when they get/change the jobs (for enemies, you'd probably have to add the states in troop events); they would need to be permanent states, you'd need a script for that (e.g. Tsukihime's permastates)

2. For the skills which should be adding the stun state, I'd add a common event, which would test if the target has the weakness state, and if so, add stun (alternatively, this could be put in the damage formula, but there probably wouldn't be enough space, so you'd again need a script, e.g. Tsukihime's formula effects)

I'm sure there are ways to find out if there's a weakness, or if the hit is critical, but as I said, I only have a basic knowledge od scripting, so I can't help with that. If nobody else replies with a better solution, and if you're interested in details for what I've written, let me know.
oh yeah, maybe i should check that "formula effects" script. something about making passive states for all the specific weaknesses just feels... clunky
Yup, clunky is my middle name :LZSlol: Let's hope you'll get a reply from someone who can come up with a more streamlined solution.

Original thread: https://forums.rpgmakerweb.com/threads/stun-enemy-with-elemental-weakness.154734/