How to get current target for VS action sequence?

EDIT: Ok managed to get what I want working by using their Battle core setting where you can control a switch when attacks miss/are evaded. But I'm still annoyed that I can't figure how to reference the current target.
////////

EDIT2:
I'm using the ATB battle system, so I also have the VS ATB battle plugin installed.
////////

So, I'm trying to create my action sequences so that it doesn't play the hit animation if the attack misses or enemy evades.

In MV it seems like you can just reference the enemy with "target", like:
if !target.result().missed && !target.result().evaded
But it doesn't work in MZ. I went through a dozen threads but can't get anything to work. I tried:

target
$target (that was supposed to be some kind of VS shortcut?)
BattleManager._targets[0]
$gameTroop.aliveMembers()[BattleManager._action._targetIndex]
$gameTroop.aliveMembers()[$gameTemp.lastActionData(5)]

Why the **** isn't it basic functionality not to play hit animation when you miss (or am I just missing something)? And how do I solve this? Thanks! 😀
I think everything except the first option of target should work...to get any more concrete help, of course, you'd need to share the sequence.
The sequence was just replacing the "target" in the MV sequence (in my post) with the different stuff I wrote down and putting it in the 'script' portion of a conditional branch.

For example:
!$target.result().missed && !$target.result().evaded ->play animation

The sequence works when I replaced the conditional with checking for the switch that can be set to turn ON in event of miss/evade in the plugin settings.
I mean, you could shorten that to isHit() but as to why that wouldn't work in a VS action sequence...sorry, not your dude.
Just thinking out loud but couldn’t you instead check if any damage was dealt after action effects? Depends on what order you want the effects to resolve, of course…
Maybe, at least for damage dealing skills, though I don't know if you'd need to reference the target even then (of course using notetags might work, but I was thinking about inside the action sequence). But like I said I already got it working with the miss/evade switch. And now I was just more annoyed that I couldn't find out how to reference the target (actually now I remembered that I think I asked this same question like ~6 months ago or something - needed the reference for some other thing back then).
You might want to poke @Arthran, he knows his way around action sequences pretty well.
Yeah. I kind of realized that I left out information. I'm using the ATB battle system, so I have the VS ATB plugin in addition to battle core (and core engine and others). Don't know if that affects anything though.
Unless the ATB plugin is changing things, BattleManager._targets[0] should retrieve the current target during an action sequence, as long as there is only one target. If you have Core Engine installed, then $target should work as well.

Are you certain that the point of failure is that it's not retrieving the correct target?
Ok, I tried it again. Can't get the original conditional script to work, but when I tested a script to add a state to $target, it works. So is there some problem with that script checking for miss/evade (noone at least commented anything)? Or does VS change something related to it?

ActionS.jpg


EDIT: So, it's always playing the animation, regardless of hit or miss.
I can’t look at the console right now to check, but missed and evaded are not functions?
I can’t look at the console right now to check, but missed and evaded are not functions?
No, they're properties.

If he were doing !$target.result().isHit() that's a function, but missed and evaded are just booleans.

And a syntax error would be showing in the console.
If only you knew someone who'd spent an inordinate amount of time converting action sequences from YEP to VS

JavaScript:
BattleManager._action.subject().opponentsUnit().members()[BattleManager._action._targetIndex]

has always worked for me. Try that? If it still doesn't work, then the problem is the property comparison.
Yeah, not working either, so it seems the problem is with those result miss / result evade stuff.
But like I said, I've got this working another way, so wouldn't want anyone to necessarily use too much brain power to think about this...
I would guess that the action result has already been cleared by the time that your script is being evaluated, so evaded and missed are always false. I can't get to my computer to verify it right now, but that seems like the most likely scenario that would cause the behavior you're experiencing.
Have you tried using a Battle Core notetag instead? Like, put the animation call inside a JS Post-Damage?

The documentation isn't super clear, but I'd assume from the name that only gets executed if damage was dealt.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-current-target-for-vs-action-sequence.166045/