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

Fairly easy AI question {assign zombies to attack a hero when spawned}

Status
Not open for further replies.
Level 11
Joined
Jul 9, 2009
Messages
927
Use Region Events via GUI.
if you dont know how to use it, I advice you to learn about it at an early stage.

Example
  • Zombie Move
    • Events
      • Unit - A unit enters Zombie Spawn Point <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Zombie
    • Actions
      • Unit - Order (Entering Unit) to Attack-Move To (Zombie Move Point)
Then continue with If/Then/Else statements
if you want the zombies to simply to automatically locate where the hero is. the zombies must have a high acquistion range
and you can simply change Zombie Move Point to All Units Owned By Player X matching condition (THE HERO)

Here are some tutorials on GUI Triggering.

Hope this helped and HAPPY MAPPING!
 
There are few ways of doing such thing.

Easiest one is to order them immidiately to move after creatring each zombie:
  • Actions
    • Unit - Create <here you summon zombie>
    • Unit - Order (Last created unit) to Attack <yourtarget>
Actions 'Order' is in Unit's action section, although there are few types of such action. It depends on which order you want to issue. You will need Issue Order Targetting An Object.

If you create multiple zombies at a time, you will have to change trigger above a little bit:
  • Actions
    • Unit - Create X <zombies>
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable map area) matching conditions (Unit type of (Matching unit) Equal to Zombie))
      • Loop - Actions
        • Unit - Order (Picked unit) to Attack <yourtarget>
You can add additional conditions to group creation if needed.

Other way:
  • init
    • Events
      • Unit - Unit enters (Playable map area)
    • Conditions
      • (Triggering unit) Equal to Zombie
    • Actions
      • Unit - Order (Triggering unit) to Attack <yourtarget>
Loop triggers might be usefull too, but you will have to specify group or use unit indexing.
  • loop
    • Events
      • Time - Every X seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (ZombieGroup) and do actions
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack <yourtarget>
That egzample requires global group for zombies only.
Remember to customize conditions or add proper actions depending on what you need to those triggers.
 
Status
Not open for further replies.
Top