MV Need help with a code not working in Yanfly's Buff and States Core

I'm using Yanfly's Buff States Core and I'm trying to have a common event played when the state is removed. It's not working.
My goal is to make a charged skill essentially by adding a state on the user that restricts action for 3 turns and then unleashes an attack. For a few days now I've been trying to work around using the base functions to try and do something like this but nothing was working so I turned to the forums. Figured out it wasn't really possible in base functions with how I wanted my skill to execute. I'm at my wits end here and so frustrated, not sure if I'm doing something wrong or missing something obvious because I keep trying new things and just nothing is working.

This is the code I'm using in the notetags of the state:

<Custom Remove Effect>

$gameTemp.reserveCommonEvent(1);

</Custom Remove Effect>

I've checked the placement of the plugin and it's beneath the Battle Engine Core as instructed to be installed. I even tried every common event ID I could think of in case I was listing it wrong, "0001", "1", "0001[name]", "[name]", "1[name]". I even double checked the workings of the common event by just having the skill call upon it and it works fine. The state itself also works fine with what I have in it's base functions. So, I'm assuming it's something to do with the code I have in the tags.

I'm not a exactly new user, but I haven't used MV in years now and decided to get back into it so some things I remember, others I do not. Please let me know if I'm missing something obvious or if you need more information. Super desperate because I really want to be able to make this skill work how I want.
By default:
  • Common events do not run mid-action; and
  • Only 1 common event can be reserved (queued) at a time.
So maybe you're calling another event before this one gets a chance to run?

In case it helps, YEP Battle Engine Core's Action Sequences let you run common events mid-action.
what exactly is the common event intended to do other than initiate the skill? If all it does is have the battler with the state use the skill it may be easier to just have the remove effect be to call the BattleManager's queueForceAction() method and directly have the battler use the skill
By default:
  • Common events do not run mid-action; and
  • Only 1 common event can be reserved (queued) at a time.
So maybe you're calling another event before this one gets a chance to run?

In case it helps, YEP Battle Engine Core's Action Sequences let you run common events mid-action.
I'm not really sure what event would be being called before this to be perfectly honest -.-"
what exactly is the common event intended to do other than initiate the skill? If all it does is have the battler with the state use the skill it may be easier to just have the remove effect be to call the BattleManager's queueForceAction() method and directly have the battler use the skill
That actually sounds a lot simpler for what I'm trying to do. The common event is just to force the action, getting my character to use a skill as the moves finisher essentially. So, to accomplish what you're saying here would I put this in the notetags then?:
<Custom Remove Effect>

queueForceAction(0019)

</Custom Remove Effect>
Sorry if that's wrong, I'm not adept with script yet, trying to relearn a bit of basics slowly.
Sorry if that's wrong, I'm not adept with script yet, trying to relearn a bit of basics slowly.
BattleManager.queueForceAction(user, skill id, target);
user should be a valid reference to a battler, target may be a battler reference or a target index(-2 is for the last target and -1 is random target), and skill id is the skill's id in the database

try this
Code:
BattleManager.queueForceAction(user, 19, -2);
Although, you may need to pair it with an after eval effect using the <After Eval> tag from the skill core plugin to save the initial skill's target to that you can refer back to it when that line is to be ran. Its not the only way to do it, but its how I usually go about it
BattleManager.queueForceAction(user, skill id, target);
user should be a valid reference to a battler, target may be a battler reference or a target index(-2 is for the last target and -1 is random target), and skill id is the skill's id in the database

try this
Code:
BattleManager.queueForceAction(user, 19, -2);
Although, you may need to pair it with an after eval effect using the <After Eval> tag from the skill core plugin to save the initial skill's target to that you can refer back to it when that line is to be ran. Its not the only way to do it, but its how I usually go about it
Didn't work unfortunately. I'm not sure what I'm doing wrong, but I put this in and still nothing
<Custom Remove Effect>
BattleManager.queueForceAction(2, 19, -1);
</Custom Remove Effect>
I changed to -1 for random target (though maybe this is why as the finisher hits all enemies?) and the user is actor 2 in my list, I tried fiddling around with it and still nothing *flop*
I don't think the <After Eval> is needed because originally the skill is casted on the user and then the state is what forces the finisher after the state is removed.

Appreciate all the help btw!
You have to pass a reference to the battler for the user, not their index. Within the remove effect tag, one for the battler affected is already generated through "user". You didnt have to change that.

For the after eval thing however, its more so if the second skill is meant to intentionally target a selected enemy. Like, if your first skill that starts the charge let you target an enemy, you could then store the reference to that enemy for the state to then target specifically. It has no point if the skill self targets, aoes, or randomly targets, but you hadnt mentioned the scope of the skills before then
You have to pass a reference to the battler for the user, not their index. Within the remove effect tag, one for the battler affected is already generated through "user". You didnt have to change that.

For the after eval thing however, its more so if the second skill is meant to intentionally target a selected enemy. Like, if your first skill that starts the charge let you target an enemy, you could then store the reference to that enemy for the state to then target specifically. It has no point if the skill self targets, aoes, or randomly targets, but you hadnt mentioned the scope of the skills before then
That's what I originally thought yesterday when I first tried it, that I didn't have to change "user" but it did not work. Fiddled around with it again today and still nothing. Wondering if it's a bust or perhaps something wrong with the plugin or rather if something is interfering with it.
You could try not using the Yanfly function and using RPG Maker's code for force action.

Code:
user.forceAction(19,-2);
BattleManager.forceAction(user);
Legitimately I turned off all my added plugins to see if I could find a plugin that was interfering maybe but the base codes you all provided still don't work. Honestly have no clue what's going on now. They should work for rpg maker so I'm so extra lost.

I appreciate everyone's help, if you have anymore thoughts let me know. Clearly I'm doing something wrong or have something interfering with the codes I'm putting in and I just don't know what
OOOOH my god. Okay, so turns out the program just needed a bit of refreshing. So mad I tried this last. I exited, fully closed the program, and came back and it works perfectly now.

The code that worked was this one:
<Custom Remove Effect>
BattleManager.queueForceAction(2, 19, -1);
</Custom Remove Effect>
Thank you all again for your help!
its good that its working now. Maybe you know this, or maybe you dont, but when you make edits to things involving plugin configs and noteboxes, your changes wont actually happen until you save the project. If you hadnt saved the project at all while fiddling with the state's notebox between tests, then nothing would have actually changed between them

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-a-code-not-working-in-yanflys-buff-and-states-core.165261/