• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

CPU controlled units questions

Status
Not open for further replies.
Level 5
Joined
Sep 14, 2004
Messages
66
1. How can I make cpu controlled heroes to learn and most important, use their skills? I think I know how to make them learn skills, though.

2. Return to a fountain of health when their life is below 25%? I've looked into that and you can only use the command Unit - Life on a select unit or a variable, no funcions :cry: .
 
Level 6
Joined
Jun 16, 2004
Messages
237
1. They use their skills automatically, not just always. There are some hard-coded conditions when they use them. Also, there is evidence of a bug in WC3 that causes units of a computer player to stop using their abilities after a while (conditions which cause this bug to occur are unknown). Neutral Hostile player does not suffer from this bug.

You can make heroes learn skills by using Hero - Learn Skill trigger action, or by using an AI script.

2. Use "Unit - Issue order targeting a point - Move", and when the unit is at the range of the fountain of health use "Unit - Issue order with no target - Hold Position".

If you are using an AI script, you need to make AI to ignore the unit by using "AI - Ignore Unit Guard Position" first, and when it's fully healed return the unit to the AI's available units by using "AI - Recycle Unit Guard Position". However, if the unit belongs to the AI's attack group, there is no way that I know to do this.

Cheers!
 
Level 5
Joined
Jun 9, 2004
Messages
181
Yes, it applies to custom units too.

Well i'll tell u a trigger how to send a Comp. controlled hero back to a fountain:

events:
every 2 seconds of game time
cond:
-
actions:
Pick all players controlled by Comp.
Pick every unit in units controlled by picked player matching unit type of matching unit is a Hero.
if life of picked unit is less or equal to (.25*Max life of picked unit)
then: order picked unit to move to (healing font)
else: do nothing

How to send back to battle:
Like before
but pick units in 400 range to fountain
and if life of unit equal to max life
then: order picked unit to attack-move to (battle)
else: do nothing
 
Status
Not open for further replies.
Top