Yanfly's Auto Passive States Help

This may be a product of me being new to java to some degree still, but how do I use Yanfly's Lunatic Mode script for the leave function? Im trying to get the plugin to at the end of one buff, add a debuff, but I cant seem to figure out how to get the event to work. I would use HIME's Progressive States, but the patch for it to work with Yanfly's battle engine has not been updated in a long time.
I know this is answering my own question, but oh well. Can a moderator move or lock this or something? Anyways, getting on here. 

After several days of looking around and getting help from one of my more knowledgeable coding friends, I have gotten an example of the formula used for applying a state at the end of BuffStatesCore from Yanfly (which I am almost certain AutoPassiveStates needs?) and this eliminates the need for Progressive States, or the patch to be updated, and so on.

Example:
 


<Custom Remove Effect>


$gameActors.actor(actorId).addState(n);


$gameTroop.members()[enemyIndex].addState(n);


</Custom Remove Effect>



In this are the call events found at this document that lists the different events you can call or tag with this type of tag. "N" represents the number of the state that is added, and if left blank no state is added.

Here is a simpler version: 

 


<Custom Leave Effect>


user.addState(n);


user.refresh();


</Custom Leave Effect>



Variables still apply as normal. 

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-auto-passive-states-help.71600/