Swapping enemy resistances mid-battle

Is there a way I can set an enemy to gain resistance after being hit with attacks of the same type? (i.e. after 3 fire attacks the enemy now takes half damage from fire)?
yes and no.

you can add as many elemental damage rates to an enemy as you want, they will simply multiply each other.
doing so after a time will require it to be a state, and theoretically this can be done by a troop event checking for most conditions.

unfortunately the conditions you specify are a bit complex to be handled by events, especially if there are many possible attacks of the same element.

so your best guess might be to look for a plugin that could handle this.
I feel like Im getting close to event programming this in the troops menu, but I cant seem to be able to count and keep track of how many times the fire move, for example, was used...
that needs to be done in the skill, either by calling a common event that counts the correct variables up or by a javascript command in the damage formula that does the same.
both ways require different variables for different targets and will have problems of targeting the correct variable.

there are reasons why I said this is difficult to do by events.
There a way where you can do it with one hit if you are using Yanfly's scripts


I would say start there, Maybe add a variable to each element and if variable gets to the number you set activate that state for resistance if its for one enemy.
Is there a way I can set an enemy to gain resistance after being hit with attacks of the same type? (i.e. after 3 fire attacks the enemy now takes half damage from fire)?
Alright, you need to setup a troop event for that and that needs to check some variables for that.
On skill tab on your fire skill put that into formula before the damage:
$gameVariables.setValue(21, $gameVariables.value(21)+1);
Change the 21 to what your fire variable will be.
Then add a state to change element resist.
Back to troop events, make one event page like that Conditions: Turn End - Span: Turn
on the bottom: if the enemy has 3> fire variable
add state Fire Resist to enemy.
After the battle ends set those element variables to 0 (I recommend using a common event to reset them). I hope this helps.
Alright, you need to setup a troop event for that and that needs to check some variables for that.
On skill tab on your fire skill put that into formula before the damage:
$gameVariables.setValue(21, $gameVariables.value(21)+1);
Change the 21 to what your fire variable will be.
Then add a state to change element resist.
Back to troop events, make one event page like that Conditions: Turn End - Span: Turn
on the bottom: if the enemy has 3> fire variable
add state Fire Resist to enemy.
After the battle ends set those element variables to 0 (I recommend using a common event to reset them). I hope this helps.
Awesome! I had something similar set up where I had a common event as an effect of the skill use to count up the variable, I just wasn't able to get the state to show up but now it works perfectly!

Thanks a lot!
Funny enough my variable was also number 21, but what does that line do for the damage formula?
Awesome! I had something similar set up where I had a common event as an effect of the skill use to count up the variable, I just wasn't able to get the state to show up but now it works perfectly!

Thanks a lot!
Funny enough my variable was also number 21, but what does that line do for the damage formula?
Whenever you cast or do a skill, it adds +1 to the 21st variable~

Original thread: https://forums.rpgmakerweb.com/threads/swapping-enemy-resistances-mid-battle.147946/