• 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.

[General] Variables, Events, Regions, & Conditions

Status
Not open for further replies.
Level 5
Joined
Apr 1, 2010
Messages
107
I've done plenty of searching, and nothing has answered my question, so I'm going to ask here. On all answers I tried to comprehend, nobody was very clear from the other topics, so please be very thorough with your answer if you have the time to do so.

Firstly, I would like my AI Hero to cast a spell (For example, Holy Light), based on how much health he has. The hero is a unit that is created, and is not pre-placed.

The event Unit - Life requires that it be a preplaced unit. I have done all of my unit variables correctly, and it works with neither unit nor array.

There are no condition values in Integer to detect the life or mana value of a unit.

I cannot set an integer variable to be the life of a unit and then check that.

I've ran out of workaround ideas. How do I perform an event based around the life of a unit that has already been created and cannot be preplaced? The variables don't work, they just don't.

____

My other issue is checking whether or not units are in a region/rect. I would like it to happen so that my AI Hero, upon entering a creep region that already has dead creeps (They respawn, but I do not want him to sit there for 30 seconds and wait) to immediately move away to another area.

I have not been able to find a solution to checking if there are already units in a region, only if they enter or exit, and no condition appear to exist that I can see.

How can I check this? It has been said in other topics that using unit groups were unsuccessful and leaky.

Basic idea:

Hero enters region. If no creeps are in region, (This needs to be detected), he goes somewhere else.

EDIT: I am reluctant to attach the map as I'd rather not spoil my work, but if I have to take the measure in order to receive help, I'm willing to do so.
 
Level 5
Joined
Apr 1, 2010
Messages
107
I'm already developing an AI system. It's not a regular melee AI, however. The map is styled to be a hero arena.

Can you please give me the life condition?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • AI Heal
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HeroGroupAI and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of (Picked unit)) Less than or equal to 50.00
            • Then - Actions
              • Unit - Order (Picked unit) to Human Paladin - Holy Light (Picked unit)
            • Else - Actions
Assume that you have a global variable of Unit Group name HeroGroupAI and once an AI is created in the map, you immediately put that hero into this Unit Group

This trigger will perform a health check on the hero unit once every 1 second
If the hero's HP is 50% or below, it will cast Holy Light on himself.
 
Status
Not open for further replies.
Top