Help converting VX Ace script to XP?

Hi, I've been looking for a script that lets you set a state (stun/knock down) when hitting an enemy with a skill it's weak to or a critical hit. I found this one: http://forums.rpgmakerweb.com/index.php?/topic/30388-weakness-stunning/  

which is pretty nice, but its for VX Ace and I'm not sure if it works with RMXP or not. I think Ive figured out how to do stunning on critical hits, but the weakness is baffling me. So yeah, can anyone help me make something along the lines of a RMXP equivalent or teach me how to set elemental efficiency as a variable? (I want actors/enemies to gain the state "stun" when I hit it with a skill with elemental efficiency "B" or greater, and on critical hits with normal attacks.)

I'm not that great of a scripter, but I do have some idea of what I'm doing. 

Thanks in advance!

Original thread: https://forums.rpgmakerweb.com/threads/help-converting-vx-ace-script-to-xp.54993/