MV A way to target both Dead and Alive characters in Battle

I have a skill I want to make that will use a part of the user's HP to bring a character to life and give them that much HP as well... But I also want it to do the same, minus the bringing to life part, for alive characters as well. Essentially the user uses his life to save his allies.

I used YEP_SkillCore and it works great when used on dead allies... But only if the scope is "1 ally (Dead)", which doesn't allow it to work on alive allies - It works great when used the other way, but can't be used to bring the character to life anymore.

Essentially I need the skill to work on an ally whether that ally is dead or alive.

Is there a way to do this? I've looked through YEP_TargetCore and YEP_SelectionCore and I wasn't able to find the way to do this... Or I should say I thought I did, but it didn't work.

Help Please...
in ACE we have used to have Tsukihime Scope Manager for that...

i do some quick search and apparently Tsukihime port 'partial part' of the manager to MV.

and this too (there's a link there to other version):

but i think one ally except self (both dead and alive) is not default scope provided..... you might need to add it yourself.

hope this help though.
If you have yanflys plugin and you want to aim at both dead and alive enemies then this should work
Code:
  <Select Conditions>

   condition = target.isEnemy() && target.isDead() || target.isAlive();

  </Select Conditions>

and set scope for that skill "All enemies"
@estriole Unfortunately, that's not going to work for me since I'm using MV... But thanks for the reply.

@Soulrender How would I change that so it only affects allies? Or is changing the scope from "All Enemies" to "All Allies" the solution? I'll try it and see.... Thanks.

UPDATE: I tried Sourender's suggestion... I had to change "isEnemy" to "isActor", but it worked - kind of.
I have to still make the skil have a scope of "1 Ally (Dead)" for it to work on the dead guy. I f I set it up for "All Allies" then nothing happens. Also, if I set it up for "1 Ally (Dead)" then is it will target the alive guy, but it won't activate the skill effect on him... nothing happens.

I'm beginning to think that it's not possible to do... I might have to just work on a workaround and hope it comes out with a good result.

How do you retain the target of one skill and automatically use it for another?
To target allies you need to negate condition, like this:
Code:
 <Select Conditions>

   condition = !target.isEnemy() && target.isDead() || target.isAlive();

  </Select Conditions>

if you don't see the difference then negating condition is done by adding exclamation mark at the begining of statement:

target.isEnemy() and !target.isEnemy()
To target allies you need to negate condition, like this:
Code:
<Select Conditions>

   condition = !target.isEnemy() && target.isDead() || target.isAlive();

  </Select Conditions>

if you don't see the difference then negating condition is done by adding exclamation mark at the begining of statement:

target.isEnemy() and !target.isEnemy()

I tried this and though the effect is that I can now select dead and alive characters, the result is the same. Nothing happens when I try to do the opposite of the scope. If I try to raise a character from the dead without using the "(Dead)" scope then nothing happens. if I try to heal an alive character while using the "(Dead)" scope nothing happens.

It seems to be something in the native code of MV. Something hard wired into it. If the character is dead then only the "(Dead)" scope can target them and only the skill/item with that scope can activate and heal them.
Lemme check it in my project. Even though I use these plugins I don't use them in very expert way.
(I prefer as simplest as possible solutions, nothing extravaganza 🙂)

Edit:
Ok, I did some analises of behaviour battle, scope and plugin YEP_X_SelectionControl.js. Main issue is here:
https://prnt.sc/uwlhul - scope of spell's target. Yanfly's plugin allows to select target and my code works, because conditions are met - target is not an enemy, target is alive or target is dead - so selection is valid, but when skill is trying to execute see the scope "Aah, player want's to use spell X on ally, but must be alive". I changed scope to dead ally and goes the same, but spell affects dead friend. So concluding... Some changes in that scope code need to be modified to work it properly.

Perhaps I might be mistaken, because I'm not that much JS coder, but my guess is to edit scope code (just like I fixed items scope function in some of my previous topics.)

Edit2:
Another thing we might check is to use lunatic mode from YEP_TargetCore.js plugin and take this example as pattern
Code:
  <Custom Target Eval>
  for (var i = 0; i < foes.aliveMembers().length; ++i) {
    var member = foes.aliveMembers()[i];
    if (member.level % 3 === 0) targets.push(member);
  }
  </Custom Target Eval>

@firestalker Final EDIT!
This works perfectly:


Code:
<Custom Target Eval>
    $gameParty.members().forEach(function(m){
        if (m.isAlive() || m.isStateAffected(1)){
            targets.push(m);
        }
    });
</Custom Target Eval>

and if you wish to aim at enemies then replace $gameParty with $gameTroop.
@Soulrender You are my hero! Thank you so much. Just what I was looking for!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/a-way-to-target-both-dead-and-alive-characters-in-battle.128496/