Branch of skills that can only target the same enemy?

Hey guys! It's me again, with another question! I couldn't find anything on this. Maybe I'm stupid or I just don't search well, but I now have a problem with this.


I am using Yanfly Instant Cast plug in, while this is lightly irrelevant I think it helps explain my predicament. I created a set of skills and here is how the battle should go


Iris the Combat Medic uses Vital Strike on Generic Enemy, applying it with a Sigil that lowers it's defense and deals X damage! The skill is instant-cast, Iris can still act, but this time she has new skills that interact with the sigil! Iris now uses her combo skills, Incision, to ignite the Sigil, dealing massive damage and removing the defense debuffs.


There are also three other alternate skills she can use in place of Incision, but that's off-topic.


In the ideal battle, she would just instantly pop Incision to deal bonus damage to her debuffed enemy. However I'm dumb and can't seem to find a way to make it auto-target the debuffed enemy.


Can anyone help me? Perhaps there's a plug-in or a secret RMMV battle state I don't know about?
My instinct is that the best way to handle what you're doing would be to handle it with a Custom Target Evaluation (Yanfly Target Core).


Here's an example of Custom Target Eval for a skill on Yanfly's site:


<Custom Target Eval>
for (var i = 0; i < foes.aliveMembers().length; ++i) {
var member = foes.aliveMembers();
if (member.level % 3 === 0) targets.push(member);
}
</Custom Target Eval>



 


You would probably just need to replace member.level % 3 === 0 with member.isStateAffected(x) where x is the State ID of the sigil.  I'm not sure what you should set the database scope of the skill to (None, One Enemy, or All Enemies), or whether it doesn't matter and the Custom Target Eval makes it completely irrelevant.


I think that this will either automatically target the affected enemy like you're imagining, or it will give you only the Sigil-affected enemy in the list of choosable targets, which is also pretty good.
I think that this will either automatically target the affected enemy like you're imagining, or it will give you only the Sigil-affected enemy in the list of choosable targets, which is also pretty good.

Oh my gosh! Yanfly's target core! I even have that haha! I don't know why I didn't think of it. I think I did but I was too dumb to realize I could just do that. Thank you so much!
You're welcome!  And you're certainly not dumb - Yanfly has a ton of plug-ins, some with some obscure functionality (like this custom target eval), so it's super-common to know about a plugin and not immediately think of all its uses.
You're welcome!  And you're certainly not dumb - Yanfly has a ton of plug-ins, some with some obscure functionality (like this custom target eval), so it's super-common to know about a plugin and not immediately think of all its uses.



So I did that. 


<Custom Target Eval>


for (var i = 0; i < foes.aliveMembers().length; ++i) {


var member = foes.aliveMembers();


if (member.isStateAffected(36)) targets.push(member);


}


</Custom Target Eval>


Sort of crashes the game lol
<Custom Target Eval>


for (var i = 0; i < foes.aliveMembers().length; ++i) {


var member = foes.aliveMembers();


if (member.isStateAffected(36)) targets.push(member);


}


</Custom Target Eval>


Sort of crashes the game lol



I don't see any immediate reason why that wouldn't work.  Not sure if it's a Yanfly Target Core idiosyncracy, or a call to the wrong GameBattler method, or some kind of faulty JS syntax.  Anyone know?
So I did that. 


<Custom Target Eval>


for (var i = 0; i < foes.aliveMembers().length; ++i) {


var member = foes.aliveMembers();


if (member.isStateAffected(36)) targets.push(member);


}


</Custom Target Eval>


Sort of crashes the game lol

for (var i = 0; i < foes.aliveMembers().length; ++i) {


var member = foes.aliveMembers();





if (member.isStateAffected(36)) targets.push(member);





}





 





this should work
I'll be honest, can't see what kien changed...


I think you should do use the i somewhere though...


try 


<Custom Target Eval>


for (var i = 0; i < foes.aliveMembers().length; ++i) {


var member = foes.aliveMembers(i);


if (member.isStateAffected(36)) targets.push(member);


}


</Custom Target Eval>


because... both of you forgot the i there. I think this is the problem.

Original thread: https://forums.rpgmakerweb.com/threads/branch-of-skills-that-can-only-target-the-same-enemy.68317/