"Single ally" magic only targeting last enemy?

I never really noticed this before, but it seems that spells targeting "single ally" used by enemies (e.g. healing magic) only target the last enemy on the list. Has this already been addressed on another thread? I tried a search but didn't come up with anything.
I think I've about it somewhere already... if you need more control, you can like use Tsukihime's Target Conditions (if I recall correctly)
That is a (somewhat) known bug. Use this to fix it.

Code:
class Game_Action    def targets_for_friends    if item.for_user?      [subject]    elsif item.for_dead_friend?      if item.for_one?        if @target_index == -1          [friends_unit.random_dead_target]        else          [friends_unit.smooth_dead_target(@target_index)]        end      else        friends_unit.dead_members      end    elsif item.for_friend?      if item.for_one?        if @target_index == -1          [friends_unit.random_target]        else          [friends_unit.smooth_target(@target_index)]        end      else        friends_unit.alive_members      end    end  end  end
ShadowLurk- Am I supposed to add that in a specific place? I just pasted it into an empty page in the Script Editor, applied it, then pressed OK- tried a battle with ally spells and it didn't work... Then I tried replacing the actual def targets_for_friends in the Game_Action class, and that didn't work either.
Wait, never mind. I didn't know you had to close the editor and reopen it. It's working perfectly now.

Thank you very much for the help!
Hierophant, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Just edit your post and add the extra info.


You need to save your game before testing. So if you change scripts and then run your game, it'll prompt you to save. If you say no, or if just you do a battle test instead of a full test, the scripts won't be saved, so it'll still play with the previous version of scripts.


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/single-ally-magic-only-targeting-last-enemy.25616/