Force Action error

Hiya guys, I could use some help as I am new with this Force Action. I am using plugins from Yanfly, and trying to make a functional state until...
help.png


I have used this for my State, and it led to what you see above here:
Code:
<Custom Leave Effect>
var skill = 112;
var target = -2;
BattleManager.queueForceAction(user, skill, target);
</Custom Leave Effect>

I need as much help as possible qwq
Check the order of your plugins, please strictly follow the order required by yanfly
Yea, here's the recommended order, you can just drag+drop as needed~
Save after making changes in the Plugin Manager else your changes won't be seen in-game. 🙂

If that's not it...I vaguely recall something weird happening with Yanfly's Battle Engine and stunned battlers. Something like...if a battler has no actions and you try to force-action them, the plugin will try to reserve their existing action, undefined, which causes this error when it tries to deep-copy it? 👋

If that is the problem, you could try saving the following code as a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) and importing as a plugin, loading immediately after Battle Engine Core~
JavaScript:
(function(alias) {
	// Don't queue current action if it doesn't exist
	BattleManager.savePreForceActionSettings = function() {
		if (this._action) alias.call(this);
	};
})(BattleManager.savePreForceActionSettings);
(It's all theory, I haven't tested it. 😴)
Yea, here's the recommended order, you can just drag+drop as needed~
Save after making changes in the Plugin Manager else your changes won't be seen in-game. 🙂

If that's not it...I vaguely recall something weird happening with Yanfly's Battle Engine and stunned battlers. Something like...if a battler has no actions and you try to force-action them, the plugin will try to reserve their existing action, undefined, which causes this error when it tries to deep-copy it? 👋

If that is the problem, you could try saving the following code as a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js) and importing as a plugin, loading immediately after Battle Engine Core~
JavaScript:
(function(alias) {[/INDENT]
[INDENT]    // Don't queue current action if it doesn't exist[/INDENT]
[INDENT]    BattleManager.savePreForceActionSettings = function() {[/INDENT]
[INDENT]        if (this._action) alias.call(this);[/INDENT]
[INDENT]    };[/INDENT]
[INDENT]})(BattleManager.savePreForceActionSettings);
(It's all theory, I haven't tested it. 😴)
I will test this out right away. Thank you for the assistance!
It works now, thank you very much, caethyril (err, is there some way to tag someone?)

Problem resolved, this thread is ready to be closed anytime!
It works now, thank you very much, caethyril (err, is there some way to tag someone?)
Yay! And yes, just use an @ symbol before someone's username, e.g. @devonxm1014.

Also, you can report your opening post with reason "Solved" or something: that lets the moderators notice solved threads more easily. 🙂

Happy RPG Making! 😂

Original thread: https://forums.rpgmakerweb.com/threads/force-action-error.123142/