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

Zombie attacking/movment trigggers

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2008
Messages
145
ok i need help wiht triggers on a zombie survival map idk what to do to make the zombies be smart and attack people randomly or to make it changgeling as possable can any one help me or give me advice to make ti more changgleing cause right now the zombies wander around and don't attack anyone

can anyone help me with this?
 
Level 3
Joined
May 3, 2008
Messages
44
First make a unit group variable called Zombies (It can be an array if you want (like if you want different zombies to do different things)) To add a zombie to the group make a trigger like this

  • Events
    • Unit - A unit enters entire map
  • Conditions
    • Entering unit is equal to <zombie type>
    • Actions
      • Unit - Add (Entering Unit) to Zombies
Then to make your zombies go after a player unit, you'll need to make another variable called Player_Units (unit group) and then add this trigger

  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Unit Group - Add <The players hero> to Player_Units
Finally, to make your zombies attack the humans use the following trigger

  • Events
    • Time - Every 30 seconds of game time // you can do this at any time interval, but dont make it trigger too often or it will lag your map
  • Conditions
  • Actions
    • Unit Group - Pick every unit in Zombies and order (picked unit) to attack random unit from Player_Units
Also to prevent your variable from becoming huge and cumbersome, add this

  • Events
    • Unit - A unit dies
  • Conditions
    • Unit Type of (Dying unit) is equal to <Zombie unit type>
  • Actions
    • Unit Group - Remove (Dying unit) from Zombies

I hope that's what you're looking for
 
Last edited:
Level 5
Joined
Jan 11, 2006
Messages
110
You should create a custom point and order them to attack move to it or the zombies will attack only one unit. Afterwards remove the custom point to avoid leaks

  • ZombieAttack
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set Reg[0] = (Region centered at (Position of (Random unit from (Soldiers))) with size (1.00, 1.00))
      • Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of Reg[0])
      • Custom script: call RemoveLocation(udg_Reg[0])
 
Level 3
Joined
May 3, 2008
Messages
44
You can do that without creating and removing a region (saves you a variable too 0.0)

  • Actions
    • Unit Group - Pick every unit in Zombies and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from Player_Units)))
 
Level 3
Joined
May 3, 2008
Messages
44
I'm not sure what you mean, in WE terms a "Player" cannot be attacked, only the units he controls can be attacked. Are you saying you want the zombies to attack a specific player's units?
 
Level 3
Joined
May 3, 2008
Messages
44
Revised:

Change your zombies attack action to

  • Unit Group - Pick every unit in test and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from (Units owned by Player 1 (Red)))))
 
Last edited:
Status
Not open for further replies.
Top