Elemental Weaknesses give States

I am currently in the middle of making a game, and I thought of everything, from battle systems to the story.
Now, there's something I want to have in battle. Kinda dumb but.....

I want elemental weaknesses to gives states. An example of this is from the Persona series, when the enemy is hit with it's weakness it gives them the state "Down." How do I achieve that in RMMV?

If there's a plugin for this, would you send me the link? I've looked everywhere but still no luck

Thanks

*note: I've posted this before in the RMMV section but someone told me to post this here
I figured it out in the other thread, sorry for making your ask here. My son was on mv when I walked into the room. This thread will make it easier for others who want to do the same I suppose.

if (b.elementRate(2) > 1) {100 + a.mat * 2 - b.mdf * 2 + b.addState(4); 100} else {100 + a.mat * 2 - b.mdf * 2}

On that line it says if targets element rate for fire (fire) is over 100% than do damage and add poision (state 4)
else just do regular damage.

Just change the elementRate(x) to whatever elemet you want, and change the addState(y) to the state id number, you can also change the ;100 to any number to change the odds. Eg.. 50 will make it a 50/50 chance, 75 will make it 3 outta 4 times etc..
If you feel like it, remind me to provide you with another piece of code to achieve this. I'm using lunatic code, so it'll keep the damage formula box looking clean. I won't have access to my computer until tomorrow though. So give me a mention in a reply in a few hours and I'll post it then.
If you feel like it, remind me to provide you with another piece of code to achieve this. I'm using lunatic code, so it'll keep the damage formula box looking clean. I won't have access to my computer until tomorrow though. So give me a mention in a reply in a few hours and I'll post it then.
Okay, thanks!
I figured it out in the other thread, sorry for making your ask here. My son was on mv when I walked into the room. This thread will make it easier for others who want to do the same I suppose.

if (b.elementRate(2) > 1) {100 + a.mat * 2 - b.mdf * 2 + b.addState(4); 100} else {100 + a.mat * 2 - b.mdf * 2}

On that line it says if targets element rate for fire (fire) is over 100% than do damage and add poision (state 4)
else just do regular damage.

Just change the elementRate(x) to whatever elemet you want, and change the addState(y) to the state id number, you can also change the ;100 to any number to change the odds. Eg.. 50 will make it a 50/50 chance, 75 will make it 3 outta 4 times etc..

I tried it, and it is working, but.....
I set the element rate to 110% right, and the normal damage is 23-27ish but when I used that code it turned to 115, help pls?
I tried it, and it is working, but.....
I set the element rate to 110% right, and the normal damage is 23-27ish but when I used that code it turned to 115, help pls?

Did you change the battle formula's. Whats your characters magic attack points and enemies magic defence and i'll see whats up. The hit on the enemy should be only 10% harder on the enemy with 110% as opposed to the hit on the enemy at 100%. The damage formula is the same regardless of whether the enemies element rate. Had you changed the formula before, if your using default states and skills let me know and i'll try to re-create it.
Double-post notice: Raijinn
If you want to add something, please edit your earlier post.

'Learning Javascript' is - as the name suggests - for discussing aspects of writing Javascript, which you are not doing. I suspect that what the person may have said to you was to post in JS Plugin Requests.

Moderator note: I am, therefore, moving this to JS Plugin Requests
This could be done manually as well: you just create a down status for each element, make skills of that element to apply it 100% and make all enemies but the appropiate element weak ones immune to the status.
@padr81 I'm testing this thing with a level 1 player.
So the stats is pretty low.

Here's the stats.
a.mat = 19
b.mdf = 17

I changed the formula to this.
if (b.elementRate(5) > 1) {a.mat - a.mdf + 10 + b.addState(14); 100} else {a.mat - a.mdf + 10}
@padr81 I'm testing this thing with a level 1 player.
So the stats is pretty low.

Here's the stats.
a.mat = 19
b.mdf = 17

I changed the formula to this.
if (b.elementRate(5) > 1) {a.mat - a.mdf + 10 + b.addState(14); 100} else {a.mat - a.mdf + 10}

At first glance it looks like you are using your own magic defence and not the targets. I'll set my game up the same but with battle formula a.mat = users magic attack, a.mdf = users magic defence, b.mdf is targets magic defence. a. for user b. for target
At first glance it looks like you are using your own magic defence and not the targets. I'll set my game up the same but with battle formula a.mat = users magic attack, a.mdf = users magic defence, b.mdf is targets magic defence. a. for user b. for target
OH RIGHT, OH DANG I NEED TO FOCUS. Thanks for pointing that out!
But unfortunately, it didn't change much. The same thing happened. (a.mdf and b.mdf has a 1 digit difference)
OH RIGHT, OH DANG I NEED TO FOCUS. Thanks for pointing that out!
But unfortunately, it didn't change much. The same thing happened. (a.mdf and b.mdf has a 1 digit difference)

Was my mistake I was confusing my formulas, told you I was terrible at javascript lol.

if (b.elementRate(5) > 1) {b.addState(14); a.mat - b.mdf + 10} else {a.mat - b.mdf + 10}

This makes the skill hit both for about the same attack score but of course as the player grows stronger that 10% will show more and more.
It actually hits for exactly 12 as it should because a.mat(19) - b.mdf (17)= 2 + 10 = 12.
It hits the enemy at 110% for 13 as the added 10% rounds to 1. To be hitting in the 20's you must have had a weapon equipped. It should be much more balanced now.

The 100 I thought was % was actually being added as damage. so I added the state first then put in the damage formula and its working fine now. There is no setting the % it lands (well maybe there is and I haven't figured it out.)

Sorry about that. It was simpler than I thought. It would probably also work by just removing the 100 and semi-colon but I didn't check.
Was my mistake I was confusing my formulas, told you I was terrible at javascript lol.

if (b.elementRate(5) > 1) {b.addState(14); a.mat - b.mdf + 10} else {a.mat - b.mdf + 10}

This makes the skill hit both for about the same attack score but of course as the player grows stronger that 10% will show more and more.
It actually hits for exactly 12 as it should because a.mat(19) - b.mdf (17)= 2 + 10 = 12.
To be hitting in the 20's you must have had a weapon equipped.

The 100 I thought was % was actually being added as damage. so I added the state first then put in the damage formula and its working fine now. There is no setting the % it lands (well maybe there is and I haven't figured it out.)

Sorry about that. It was simpler than I thought. It would probably also work by just removing the 100 and semi-colon but I didn't check.

Oh wait my bad, a.mat was 29
Oh wait my bad, a.mat was 29

Ah cool its working perfect so. Should hit enemies with normal defence for 29-17 = 12 + 10 = 22. And the 110% weakness for 22 + 10% = 24. To test make sure you set the skill variance to 0%. If those numbers are exact then you can turn the variance back on.
Ah cool its working perfect so. Should hit enemies with normal defence for 29-17 = 12 + 10 = 22. And the 110% weakness for 22 + 10% = 24. To test make sure you set the skill variance to 0%. If those numbers are exact then you can turn the variance back on.
Whoa dude thanks!

Original thread: https://forums.rpgmakerweb.com/threads/elemental-weaknesses-give-states.78827/