Having one state transition to another after it expires? (Making a stun resist state.)

I have a stunned state, and I have also made a state that makes a character or enemy immune to stun for a set amount of turns so that they cannot be stun locked. Is there a way to make it so that when the stun effect expires, the victim of the stun gains the resistance state?
You'd use Yanfly's Buffs & States Core.

Give your stun state the notetag:
Code:
<Custom Remove Effect>
user.addState(ID);
</Custom Remove Effect>

where ID is the ID of your immunity state, no leading zeros.
You'd use Yanfly's Buffs & States Core.

Give your stun state the notetag:
Code:
<Custom Remove Effect>
user.addState(ID);
</Custom Remove Effect>

where ID is the ID of your immunity state, no leading zeros.
Thank you. already have the buffs and states core in. I didn't see this notetag on the page... very much appreciated!

Original thread: https://forums.rpgmakerweb.com/threads/having-one-state-transition-to-another-after-it-expires-making-a-stun-resist-state.162557/