MV Store in a variable the enemy's index before "perform action" (YEP_X_ActSeqPack)

Hi everyone! I am looking for a way to store the enemy's index that has been targeted in a variable.
I found this:
JavaScript:
$gameVariables.setValue(1, b.index())

But it doesn't let me know the ID before the "perform action" (I'm using Yanfly's Action Sequence 1, 2 and 3 plugins).

Looking and searching I also found this:
JavaScript:
$gameActors.actor(actorId)._actions[actionIndex]._targetIndex

But I don't know how to use it, can you tell me how do I store the enemy's Index in a variable BEFORE "perform action"?
Hi everyone! I am looking for a way to store the enemy's index that has been targeted in a variable.
I found this:
JavaScript:
$gameVariables.setValue(1, b.index())
That's exactly right.

But it doesn't let me know the ID before the "perform action" (I'm using Yanfly's Action Sequence 1, 2 and 3 plugins).
What does this mean?
1 - the ID of what? The ID of the variable is what you chose in the above function (you typed 1). The ID of the enemy has nothing to do with its index.

2 - The command "perform action" doesn't have anything to do with an enemy's ID or its index.

can you tell me how do I store the enemy's Index in a variable BEFORE "perform action"?
Whenever you use the setValue() function above is when it will happen. If you type it a line above "perform action," that's when it will happen. If you do it in an entirely different portion of the action sequence, that's when it will happen.

What you need to explain is what you're trying to do. Perform action has nothing to do with a variable, an index, or an ID, so it's confusing that you are talking like they're connected to each other.

If you can describe more clearly what you're trying to achieve, we can probably help you do it.
Thanks for the reply! I try to explain it in my own words, even if I am not very good with the English language... 😢
I am creating a skill that throws a shuriken to an enemy, the Yanfly's plugin does not allow to throw objects, so I want to do everything myself with common event and pictures.
I have everything I need for the common event, except the value of the target enemy, I have to get it before the "perform action" because otherwise the damage would be shown before the shuriken is thrown.
I need to know what the enemy index is inside the troop to extrapolate its coordinates and allow the image of the shuriken to move against him!
I hope everything is clear... 😂

EDIT:

I forgot to write something, this code I put it in the damage formula:

JavaScript:
$gameVariables.setValue(1, b.index())

That's probably why I can't get the enemy's Index before the damage, but I don't know where else I could put it! 😅
I am going to reiterate what @ATT_Turan said: the timing should not be an issue. The action sequence performs your instructions in the order you specify (top to bottom). If you want something to happen before "perform action" just simply put it before that.
Also the enemy index has nothing to do with the position, but rather with the order you added them to the troop. Instead of accessing the index function you are probably better off accessing the _screenX and _screenY properties.
This is the action sequence of my skill:

JavaScript:
<target action>
eval: $gameVariables.setValue(285, b.index());
common event: 118
lose item 299: 1
Eval: user.addState(60);
motion attack: user
Eval: user.removeState(60);
perform action
action animation: target
wait for animation
action effect: target
death break
perform finish
common event: 118
</target action>

I tried putting my code after "eval:"
But it continues to work only after "perform action".
I know this because the common event 118 shows me a message with the value of my variable (285 in this case).
The first message (shown before "perform action") is always 0, the second is correct, it shows me the exact index of the target enemy in the troop.

I need the index of the target enemy because I need to know his coordinates, using this:

JavaScript:
$gameTroop.members()[enemyIndex]._screenX
$gameTroop.members()[enemyIndex]._screenY

I didn't understand where I have to enter this code to get what I need 😅 :

JavaScript:
$gameVariables.setValue(1, b.index())
That is some strange stuff. Maybe we are running into a problem where b is not yet defined? Could you open the console (F8), test your action sequence again and see if any errors pop up?
That is some strange stuff. Maybe we are running into a problem where b is not yet defined? Could you open the console (F8), test your action sequence again and see if any errors pop up?
I just checked and this is the error that appeared in the console:

Code:
YEP_CommonEventMenu.js:1290 ACTION SEQUENCE EVAL ERROR
13:53:36.544 YEP_CommonEventMenu.js:1291 $gameVariables.setValue(285, b.index());
13:53:36.547 YEP_CommonEventMenu.js:1292 ReferenceError: b is not defined
    at eval (eval at BattleManager.actionEval (YEP_X_ActSeqPack1.js:1188), <anonymous>:1:30)
    at Function.BattleManager.actionEval (YEP_X_ActSeqPack1.js:1188)
    at Function.BattleManager.processActionSequence (YEP_X_ActSeqPack1.js:826)
    at Function.BattleManager.processActionSequence (YEP_X_ActSeqPack2.js:605)
    at Function.BattleManager.processActionSequence (YEP_X_ActSeqPack3.js:473)
    at Function.BattleManager.processActionSequence (YEP_X_BattleSysATB.js:1513)
    at Function.BattleManager.processActionSequence (YEP_DamageCore.js:1007)
    at Function.BattleManager.processActionSequence (YEP_ElementCore.js:439)
    at Function.BattleManager.processActionSequence (YEP_ImprovedBattlebacks.js:356)
    at Function.BattleManager.processActionSequenceCheck (YEP_BattleEngineCore.js:2282)
Action sequences don't use a and b, they use user and target. Sorry I didn't notice that in your first post.

Also, it's not free, but I think this would greatly simplify your life for making projectiles:
Action sequences don't use a and b, they use user and target. Sorry I didn't notice that in your first post.

Also, it's not free, but I think this would greatly simplify your life for making projectiles:

Thanks, I changed 'b' to 'target' and now it works! I also took a look at Irina's plugin, it looks very interesting, I solved my problem but I chose to buy it anyway! 😂

Original thread: https://forums.rpgmakerweb.com/threads/store-in-a-variable-the-enemys-index-before-perform-action-yep_x_actseqpack.151301/