try a direct index first - I don't know how that function works, but according to the linked topic the -2 is the last previous target - if there was no target before or if that target is already eliminated, then of course the force action doesn't work.
I don't even know if that way is possible - even in that other topic the person claiming that is possible reported problems.
Have you tried the solutions given there?
Otherwise, post a screenshot of your skill, possibly the bug is somewhere else.
No, but there might be one on the master script list - it contains over 1000 scripts, and something like this should have been wanted before.
Other than that, you might try to do that using a common event - this will make targeting a bit trickier (apply a target-identification state in the skill effects, check and remove that on the common event) and has the problem that the common events run later in the battle sequence, but it should make things easier that way.
There is probably a way to fix this (Yanfly's Battle Engine seems to overwrite several methods pertaining to Force Action but I'm not sure what the end result is there), but it's trickier than it would first appear because of the way the BattleManager handles the action list and forced actions. You'd probably need to change the way that it clears battler-actions from the list, among other things.
In general, when I need to force an action using a skill, I just have it run a Common Event that includes a forced action.
Yanfly does have a script that adds follow up skills, with a % chance for the skill to perform. That might be what you want.
Thank you everyone for helping me out.
I'll try to look for Yanfly's script and common event to force character's action. I'll come back to this thread again if I have any question regarding this.