Causing a state by inflicting a state on a battler with an existing state

I thought I had seen a thread that asked this same question, but I couldn't find it. I wanted to know if I have a party member/enemy with a particular state, how I can have a second state inflicted upon them which would cause a completely different state, that is a combination of the first 2 states.
There MAY be an easier way to do it, but if you can't find one, try my State Add/Remove Commands Script


Let's say when you inflict state 20 on an enemy, if they already have state 15, it will replace states 15 and 20 with state 25.


You'd do that by putting the following into State 20's notebox:

Code:
onadd: if state?(15); remove_state(15); remove_state(20); add_state(25); end;
Type all of that without pressing the enter key - let it wrap to a new line by itself.
Thank you. I will try it and see what happens.

Original thread: https://forums.rpgmakerweb.com/threads/causing-a-state-by-inflicting-a-state-on-a-battler-with-an-existing-state.25258/