How do I force an action using scripts?

I'm using Yanfly's BuffsStatesCore to make a state that when attacked will force the defender to use a skill and knock the attacker back with an animation and apply a paralyze type state to him. I've had good success using the following code to apply the state to the attacker when attacked, but I'm trying for a more visually pleasing effect by using a skill where I can apply an Sequence to make things look flashier.

<Custom Respond Effect>
if (this.isPhysical()) {
user.addState(54)
}
</Custom Respond Effect>

"user" is considered the attacker in this instance for reasons I have no idea about... So the code I've tried was something along the lines of this:

<Custom Respond Effect>
if (this.isPhysical()) {
target.forceAction(117, user)
}
</Custom Respond Effect>

"target" is the defender. But nothing happens at all when I do this... I tried reversing the "user" and "target" positions but nothing happened.

I would love some help with this.

I would love the code needed to force the action, but if not that can I get the code to make the attacker get moved backward and then a State applied to him. This will be the minimum I would need to make the effect I'm trying to make.

Thanks in Advance
​
forceAction appears to take a battler's index, not the battler itself. Try:
target.forceAction(117, user.index())
@Llareian Unfortunately that didn't work... Same issue, nothing happens.

I tried: target.index().forceAction(117, user.index())

But that didn't help it says "Undefined something or nother"
You should have tried what he wrote instead of changing the line on your own.
Target should not have the index part.
@Andar I tried his way first... then I tried changing it. It was the same result as I was getting. My changes made the Undefined error happen. I tried both ways. I should have wrote, "I ALSO tried:"
Can you give a screenshot of your console (F8) when the error happens?
That way we can determine the real cause of the problem.
a4q4vn.png
This is the error I get when I use:
target.index().forceAction(117, user.index())

When I use:
target.forceAction(117, user.index())
Nothing happens.... the battle continues as if nothing was supposed to happen. Nothing...
First, rename your Sensor selfswitch plugin - the original name of that plugin most probably never contained a space in its filename and if it did, then the plugin writer made a big mistake.

Second, is the state where you try to placed that notetags the state with the ID 51 or a different one?
Yes, it's State ID 51
But the Plugin Sensor SelfSwitch has no problems.... At least it never caused a problem for me. How should I change the name since the creator made the plugin that name not me...
It will cause problems sooner or later because of the space in it. Any time you see a special letter replaced by %## (number) in the error messages of the console, that happens because the Browser can not handle that letter directly.

Can you give us the screenshot of your plugin manager I requested a few posts back?
2mneozt.png

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-force-an-action-using-scripts.88468/