Advanced Skill Targeting (yanfly compatible) script without untargetable enemies in the choice windo

Hello,

I have posted question in this topic:

http://forums.rpgmakerweb.com/index.php?/topic/17950-advanced-skill-targeting-plus-multiple-forced-actions-now-yanflys-compatible/#entry176248

but maybe it is appropriate to ask in script request category as well. I just copy/paste my question.

Great script but there is one little thing that bothers me in Yanfly compatible ver. I have tried to change some things in script code but my knowledge is not sufficient 🙂 Is it possible to tweak script such that enemies that are untargetable ( that have certain state or sth ) do not appear in selection bar (choice window)  ?

https://dl.dropboxusercontent.com/u/65029315/yanflysbattle.jpg

In original version of the script selection bar displays every battle member.

Example:

There is 4 enemis, 2 are untargetable ( have untargetable state from Hime script or are untargetable with method used by advanced targeting). Now all 4 are visible in selection bar (in the choice window) , 2 have red "X" over portrait in target box, 2 are normal.

I wish that this two target boxes with red "X" was not visible in choice window. Game troop and party mebers displayed should consist only of targetable enemies (targets enemies and party members if skill can target ally) not whole alive troop and party members. I want to skip in choice window ( using left and right) only between enemies (targets enemies and party members if skill can target ally) that are targetable.

I was able to merge yanlfy not compatible ver of Advance Targeting and Untargetable State ( Author: Hime ) and as a result I was able to target only enemies without untargetable state ( but on yanlfy not compatible ver, skills that use AT script commands do not work anyway so that was pointless 😉 ) I will try to merge Hime script with Advance Targeting yanfly ver but maybe someone has sufficient knowledge and can tweak it without problem 😉
Mmm, I can't guarantee it will work (I couldn't test it yet), but you could try to add this script:

Spoiler
class Window_BattleActor  alias_method🙂create_unit_ILC_onlyTargetables, :create_unit)  def create_unit    create_unit_ILC_onlyTargetables    @entries.select! { |entry| entry[1] != -10 }  if defined?(@entries)  endend
It should remove untargetable battlers from the selection when it is created.
Thank you Another Fen for such quick answer, it is precisely what I wanted 😀

I still use Hime script (Untargetable state) and was able to get it to work with Advance targeting by adding on troop page:

( or you can use map, battle,event script call as it is mentioned in post http://forums.rpgmakerweb.com/index.php?/topic/17950-advanced-skill-targeting-plus-multiple-forced-actions-now-yanflys-compatible/) 

code= "b.state?(47)"
reason = ''
add_target_rule(code,"never")

# state 47 is untargetable state defined in Hime untargetable state script

# set conditions to page as turn 0 and battle obviously

# add_target_rule is a global rule so thereis no need to add to every single skill ASTremove:rule

# certain enemies have auto state 47 (another script), good solution if you use large troops or adding troops reinforcement

I will be testing it further and write if sth goes wrong with proposed solution. Thank you.

( I have added Another Fen script below Advance targeting script - for future e-wanderers 😉 )
In case you're not looking at the other thread anymore, I've implemented this in the script now (hopefully bug free, I wish...)

Another Fen's code was very useful but there were a ton of problems that could arise from having a zero length target list, so I've hopefully squashed all of them.

Anyway, it's all back in the other thread.

Original thread: https://forums.rpgmakerweb.com/threads/advanced-skill-targeting-yanfly-compatible-script-without-untargetable-enemies-in-the-choice-windo.38160/