Question about delayed effects from skills in battle.

I was wondering how to make it so a skill in battle has a delayed effect after x amount of turns. I want to give my party a huge buff and then after 2 turns (which is how long the buffs will last) my entire party loses 50% of their hp. Is there anyway to do this or am I just overreaching?
there are several ways to do this, but the easy ways will require a plugin.

Without a plugin you would have to use the troop events to check for skill effects and create a second state after the delay.

I remember an Ace-script for follow-up states (where the next state automatically is activated when the first one wears off), but I don't know if that has been ported to MV yet.
Yanfly's buffs and states core and passive states plugins (Lunatic mode) are a way to go. She even made one tips and tricks video about delayed effects if I remember correctly.
But generally you want to create a variable that, with Custom regeneration effect, increases by one, followed by the condition that if this variable is equal to some value, it will subtract 50% of user's mhp.
Use YEP_Buff_And_States core to do this:
<Custom Remove Effect>
for(i=0; i < $gameParty.size (); i++){
var hpId = $gameParty.members().hp * 0.5
$gameParty.members().gainHp(-hpId)
}
</Custom Remove Effect>
Now the code above makes it where everyone in the party looses 50% of their current HP. So let's say an actor in the party has 100/1000 HP (eg they have 100 out of 1000 HP) then they lose 50 HP and then have 50/1000 HP.
If you want it where they losed half of the max hp, ie an actor with 100/1000 HP would lose 500 HP (as 1000/2 is 500)
Then change
"var hpId = $gameParty.members().hp * 0.5"

to this


"var hpId = $gameParty.members().mhp * 0.5"

This code should be put on a state that adds the buff you want.
I ended up figuring it out with a little help from some of these posts. Ended up using Yanfly's buffs and states core, and passive states plugins. It ended up being really simple.
Thank you guys so much for your response, I really appreciate it.

Original thread: https://forums.rpgmakerweb.com/threads/question-about-delayed-effects-from-skills-in-battle.78424/