Uppercut Skill to temporarily remove enemy from battle

I've created a skill called an Uppercut for my Brawler class in MZ. It runs an attack animation which punches the targeted enemy off the top of screen. The tricky part is, I want the enemy to return to the ground and take damage 2 turns later. It is effectively a crowd control skill to give the party some breathing room. (In a way in is like the FF Dragoon Jump skill, except it apples to an enemy, not a player.)

Here are the requirements:
  1. While they are in the air, the enemy cannot act.

  2. While the enemy is in the air, the player cannot interact with them in ANY way. No attacking, no magic, no items. This includes any ability which affects all enemies. This is NOT the same as making the enemy difficult to hit, or taking zero damage from attacks.

  3. While in the air, the enemy cannot even be targeted. The UI will not even show them as an option to be selected. They are simply not there. (If this is not possible, at least have an attacking player acknowledge their absence if they try to perform an action on the airborne enemy).

  4. While they are in the air, if all other enemies are defeated, combat continues. Players will have to take actions which do not target an enemy, like Guard or Heal, to pass the time.

  5. The Uppercut skill can apply to ANY enemy in ANY battle. Please, no specialized battle events for each Troop. (In practice I may have a check to prevent the skill working on Boss enemies, but that is a solved problem I've already applied to other skills).

  6. More than one enemy can be affected by the skill; it is possible to have 2 enemies in the air at once (or more, if the duration of the time in the air is increased).

  7. When the enemy returns to the ground, they land in the same location they were launched from.
Here's what I've got so far:

The Uppercut Skill. It calls the Uppercut Common event, and applies the Eject state:
1740184482752.png


Here's the Uppercut Common Event, which provides the animation. (The Brawl Start and End calls are just for common animation actions and can be ignored for now).
1740184749149.png


Here's the Eject state. It successfully prevents the enemy from acting. The idea of the <JS On Expire State> is to call a Common Event 29 (Downercut) to return the enemy to the ground, take damage, and be targetable again:
1740185449958.png


Here's Common Event 29 (Downercut) which is supposed to return the enemy to the ground, take damage, and allow them to be targetable in battle once more. It is called by <JS On Expire State> (I've verified this by adding a Text display durng testing), but the rest of it is a work in progress...
1740185688224.png


There are two problems:
  1. The enemy is still targetable throughout the sequence. I've cannot find an MZ plugin which applies an Untargetable state to an enemy.

  2. The Action Sequence to return the enemy to the ground doesn't work because the Targets parameter does not seem to have an applicable option. I can't use "current target" because the player will have selected other targets in the interim. I can't have a variable to hold the index of the enemy because there could be multiple enemies in the air at once.
I've been going through forum posts and tutorials without success. I don't know enough about Javascript or the game engine to figure this one out. Any help would be appreciated.



Update: I've got part-way to a solution. I still don't know how to make an enemy un-target-able yet. However, I have learned how to run an Action Sequence on an enemy when their Eject status (applied by the Uppercut skill) expires. Here's how:

Firstly, I updated the Eject skill so that when it expires, it saves the index of the enemy which had the state to a variable.

<JS On Expire State>
const enemyIndex = $gameTroop.members().indexOf(this);
$gameVariables.setValue(1, enemyIndex);
$gameTemp.reserveCommonEvent(29); //Downercut
</JS On Expire State>


Secondly, I updated the Downercut Common Event to return the enemy to the ground. I couldn't get it to take damage since there wasn't a calling skill (just a state expiration), but I just dealt more damage on the initial Uppercut Common Event. I discovered that the Targets parameter of the MOVE: Float command couldn't take a variable as an argument, but Arthran had written an extension to get around that problem. Thank you Arthran!
Art_BCTargetExtension

1740210834644.png




Update: I was recommended TheoAllen's Theo_TauntHideTrait plugin and it does the job of preventing single-target skills beautifully. Multi-target skills could still hit the enemy, but applying the immortal skill could fix that.

Since the plugin notes said it was okay to edit the code, I wondered if the plugin could be tweaked to exclude AoE skills. I'm a JavaScript noob, so I asked Copilot to have at it. After three attempts, it came up with a solution which worked. I've attached the modifed version below. Perhaps someone with actual JS skill can further improve upon it.

Thanks to everyone who offered suggestions. This was probably the hardest problem I've encountered in my project.
There is a plugin by the late @TheoAllen with which you can create a state (or anything else actually) that causes the target to become non-selectable. You can still have the cursor over the enemy though. It just becomes impossible to confirm it (i.e. press OK).

I just tested it with BattleCore and it seems to work okay. Small (obvious) problem is that the enemy is still targetable by Area of Effect spells, but I suspect that this is not really a problem if the uppercutted target is set to immortal invincible.

Not sure if this is really what you're looking for, but you may want to try it out:

If that Theo plugin works for you, you can remove the uppercutted ones from multitarget attacks with VS BattleCore notetag <JS Targets>, something like targets.filter(enemy => !enemy.isStateAffected(X))
If that Theo plugin works for you, you can remove the uppercutted ones from multitarget attacks with VS BattleCore notetag <JS Targets>, something like targets.filter(enemy => !enemy.isStateAffected(X))
Mais bien sûr, I had completely forgotten about that one.
There is a plugin by the late @TheoAllen with which you can create a state (or anything else actually) that causes the target to become non-selectable. You can still have the cursor over the enemy though. It just becomes impossible to confirm it (i.e. press OK).

I just tested it with BattleCore and it seems to work okay. Small (obvious) problem is that the enemy is still targetable by Area of Effect spells, but I suspect that this is not really a problem if the uppercutted target is set to immortal invincible.

Not sure if this is really what you're looking for, but you may want to try it out:

Fantastic! That worked. My thanks to you and the late Theo Allen. Sorry to hear they died.

If that Theo plugin works for you, you can remove the uppercutted ones from multitarget attacks with VS BattleCore notetag <JS Targets>, something like targets.filter(enemy => !enemy.isStateAffected(X))
Thanks for the idea. Where would that notetag go? I tried adding it to my Untargetable state (31) but that didn't prevent AoE attacks. I tried adding it to the Skill notetag of an ability which affects all enemies and it didn't work there either.

<JS Targets>
targets.filter(enemy => !enemy.isStateAffected(31));
</JS Targets>
Fantastic! That worked. My thanks to you and the late Theo Allen. Sorry to hear they died.
Looking at the Q&A in the plugin’s description, not completely sure if it will work if the last enemy had this state though… you may want to check on that.
@jshunter For the multitarget *skill* notetag:

<JS Targets>
targets = targets.filter(enemy => !enemy.isStateAffected(X));
</JS Targets>

Original thread: https://forums.rpgmakerweb.com/threads/uppercut-skill-to-temporarily-remove-enemy-from-battle.175718/