MV Teleport skill

Hi everyone, I have a little problem, I'm creating a skill that teleports an enemy out of battle. The implementation is very simple, I'm using a mix between common events and action sequences (by Yanfly), the problem is that I have to store the index of the target in a variable.
I tried using various script calls but they didn't work, the only method that works is to use "v [1] = b.index ()" as the damage formula and use "action effect" in the action sequence. The problem with this method is that the damage is shown during the effect of the skill but it should not be seen, since it does not damage the enemy but eliminates it from the battle.
Do you have any advice to solve the problem?
Teleport enemy outside of battle... Teleportation is temporarly or permament? if permament, then this would be the simplest way to do it, by using special effect ->escape and set scope for skill 1 enemy.
The enemy disappears permanently, is completely hidden via script call, the command is managed by a common event but I need to know what the enemy index is to use the script call on the enemy selected at the beginning.
I am not very knowledgeable about these things, I am still fighting the js, but have you already tried to run a common event during the action so that it gives you the id?

Another way would be using the BuffStateCore, it is very useful.
EDIT: No, I didn't. Ignore that lol

I was able to make the enemy flee in his turn, not disappear when skill is used, by calling a common event with a script call:
Code:
$gameTroop.members()[0].forceAction(6, 0);
Maybe it can be useful
I'm using this for hide the enemy:
JavaScript:
$gameTroop.members()[0].hide();
And it works perfectly, I created conditional branches to figure out which enemy has to disappear but there is no way to save the index of the enemy in the troop in a variable.
I have tried many:
JavaScript:
$gameVariables.setValue(1, b.index())
JavaScript:
 $gameVariables.setValue(1, b.enemyId())
The only way that allows me to store the target index in a variable is "v [1] = b.index ()" in the damage formula.
The problem is that to apply the formula, the enemy must necessarily be hit, or healed, or one of the other damage options ...
have you tried lauching the enemy out of the screen and then kill it? Wouldn't that make the damage not appear?
Simply hide the enemy. Hidden enemies count towards victory. You dont have to inflict damage.
Note that the Escape effect hides the target and plays the escape sound. Soulrender's suggestion seems ideal here. 😅

If you insist on doing this with scripting, note that a and b are typically defined only in the damage formula. A couple of options:
I have already tried the escape command but I don't like the sound it makes by default (I tried to disable it just for that moment but I couldn't).
Anyway I solved my problem, more or less, before using the teleport, the character absorbs some HP from the enemy... 😅

That way I could use "v [1] = b.index ()" in the damage formula.
I preferred to adopt this method because I only need to know the enemy index, for several conditional branches in 2 common events.

caethyril
Your method seems to be the one for me but it doesn't let me know the enemy index, so I wouldn't be able to exploit it in my common events. 😍

Thanks everyone for the support! 👋😂
caethyril
Your method seems to be the one for me but it doesn't let me know the enemy index, so I wouldn't be able to exploit it in my common events. 😍
OK, so the second part of my post applies, right? I.e. you could have tried one of the following:
  1. Use a skill notetag from Yanfly's Skill Core to avoid the skill formula entirely:
    Code:
    <After Eval>
    $gameVariables.setValue(1, target.index());
    target.hide();
    </After Eval>


  2. Use a plugin that hides 0-damage popups and do it all in the skill formula:
    Code:
    v[1] = b.index(); b.hide(); 0
Good to hear you settled on a solution, though. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/teleport-skill.128702/