Enemy Healer

I'm trying to make an enemy that heals his ally whenever she takes damage. However, just giving the enemy access to healing spells seems to result in him only healing himself. I've been looking for a solution for a while, and, while this seems to be a common problem, I haven't found a solution that works. Can anyone help?

This is my go-to VX Ace enemy AI script. Instructions are in the main post on how to use it, but the script can have enemies target their skills much, much smarter. You can have enemies use skills on targets with low hp, only use skills on targets that have certain states, or whatever. It's a geat script, I used it a lot before moving to MV, and can vouch that it works perfectly.

This is my go-to VX Ace enemy AI script. Instructions are in the main post on how to use it, but the script can have enemies target their skills much, much smarter. You can have enemies use skills on targets with low hp, only use skills on targets that have certain states, or whatever. It's a geat script, I used it a lot before moving to MV, and can vouch that it works perfectly.

Yo, where was this script my entire life? I've needed smarter AI control for the longest time.

I came here to answer OP's question the best of my ability, funnily enough.

This is my go-to VX Ace enemy AI script. Instructions are in the main post on how to use it, but the script can have enemies target their skills much, much smarter. You can have enemies use skills on targets with low hp, only use skills on targets that have certain states, or whatever. It's a geat script, I used it a lot before moving to MV, and can vouch that it works perfectly.
Thank you very much for the suggestion! However, I can't seem to get it to work.
My attempt is pictured below. Did I misunderstand something?
Spoiler: Attempt
ehealwhy.PNG
It's been several years since I last used this script, so I'm not the best at troubleshooting it.

I'd start by making sure it's not an issue with other scripts. I usually troubleshoot in new projects where only the script I am troubleshooting is added, and everything else is default. After getting it to work in the blank project, then I add it back to the main project.

With this script, I've always used the evaluations, 'cause I like to get AIs precisely what I want. So, something like this:

Spoiler: Code
<target eval 5>
if b.hp == b.mhp
-1
else
1
end
</target eval>

This would only target enemies not at max HP.

I apologize that I may not be able to help much more. I use MV nowadays, and don't have access to my old VX Ace projects, so I can't copy and paste the code.
It's been several years since I last used this script, so I'm not the best at troubleshooting it.

I'd start by making sure it's not an issue with other scripts. I usually troubleshoot in new projects where only the script I am troubleshooting is added, and everything else is default. After getting it to work in the blank project, then I add it back to the main project.

With this script, I've always used the evaluations, 'cause I like to get AIs precisely what I want. So, something like this:

Spoiler: Code
<target eval 5>
if b.hp == b.mhp
-1
else
1
end
</target eval>

This would only target enemies not at max HP.

I apologize that I may not be able to help much more. I use MV nowadays, and don't have access to my old VX Ace projects, so I can't copy and paste the code.
Thanks for trying to help! Using your code did actually seem to force the healer to heal, sadly he still only heals himself.
Hmm, what about adding an underscore, so it is now <target_eval 5> and </target_eval>? Times like this I really wish I still had access to the game that I had this script to work in, because I remember taking some time to get it to work, but it does work, I can guarantee it. My first boss was a healer who only healed creatures below max HP.

Also, this is only a targeting script, it has nothing to do with when they use the skill.
Hmm, what about adding an underscore, so it is now <target_eval 5> and </target_eval>? Times like this I really wish I still had access to the game that I had this script to work in, because I remember taking some time to get it to work, but it does work, I can guarantee it. My first boss was a healer who only healed creatures below max HP.

Also, this is only a targeting script, it has nothing to do with when they use the skill.
Ah, thanks again for trying to help, sadly this still does not work.
Hmmm, can't you set up a troop event in the database, that triggers when enemy1 HP is below max, and then make a 'force action' event command to force your enemy2 to cast a heal spell on enemy1?

Original thread: https://forums.rpgmakerweb.com/threads/enemy-healer.146438/