Performing a "Force action" event using a script call

Hello, im looking for a way to perform a skill during the battle by using a script call.
I need this so that I can set the target and user to variables, which is impossible using the in-editor event.
Put this in the script window:

$game_actors[$game_variables[X]].force_action(Y, $game_variables[Z]);
BattleManager.force_action($game_actors[$game_variables[X]])

where X is the user/actor variable, Y is the ID of the skill you want performed, and Z is the target variable.
Put this in the script window:

$game_actors[$game_variables[X]].force_action(Y, $game_variables[Z]);
BattleManager.force_action($game_actors[$game_variables[X]])

where X is the user/actor variable, Y is the ID of the skill you want performed, and Z is the target variable.

Oh that's nice. Though, is there a way to make it for enemies instead of actors?
It should work for enemies by replacing $game_actors[$game_variables[X]] with $game_troop.members[$game_variables[X]], where $game_variables[X] will be the index of the enemy (its position in the troop, starting with 0, not 1). $game_variables[Z] should then be the index of the actor (not ID, but that is also doable, if you prefer that).

Original thread: https://forums.rpgmakerweb.com/threads/performing-a-force-action-event-using-a-script-call.169095/