Custom Force Action using Javascript

I'm trying to create a custom force action plugin command. I found this in the script list but I don't know how to use it:


$gameParty.members()[index].forceAction(skillId, targetIndex);


BattleManager.forceAction(battler);


I want to force the current actor to use skill x on target y, in the form of a plugin command like this: ForceBattle x y


I'd like y=-1 to return a random target, y=0 to return the last target, and y=1 through y=8 to return those indexes.
You forgot to put this after 


BattleManager.forceAction(battler);
Further displaying my ignorance of how to use these.


Can you help me?
I guess by plugin command you mean either in a state or in a skill so


<Custom Respond Effect>


if (value >= 1) {


$gameParty.members()[X].forceAction(skillId, -1);


BattleManager.forceAction($gameParty.members()[X]); }


</Custom Respond Effect>


will force an action of the party member X when the target of the state is struck by damage
Not a state and not a notetag. I want a plugin command I can use in an event.


I'm updating a plugin and I want to add this functionality.


The code for the plugin command itself wouldn't be related to any other code in the plugin.


So all I need is the code to go in the plugin that would allow users to use the plugin command I described in the OP.
That's why you need to be more precise in your description.


battler.forceAction(this._params[2], this._params[3]);


BattleManager.forceAction(battler);
How could I have been more precise? I said I needed a plugin command, said what I needed it to look like, and said what I needed it to do.


How do I use that code to make a plugin command?
l think you're confused at what a plugin command is...
I'm not.


Screenshot_20161206-113144.png


I want to be able to enter "ForceBattle x y" in that box so that when the common event gets to that step, it forces the current battler to perform skill x on target y as describe in the OP.
But you can't because a plugin command is usable for plugins like Yanfly using those plugin commands.


Script call basically do the same thing and is usable anywhere, plugin command is one of the worse features of MV and the only time l used it is for Gab Window because l was forced to.


What...? You want to force an action in the map? It's not at all what you asked at the beginning. You probably need a plugin for that since the only way to get skills usable is from the menu.
I meant common event, not event. Sorry. I edited it.


And why can't my plugin use plugin commands? I'm pretty sure any plugin can use plugin commands. That's what they're for.


Plugin commands are a great feature for people who don't know Javascript very well.

Original thread: https://forums.rpgmakerweb.com/threads/custom-force-action-using-javascript.71773/