• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Unit Chase Players

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
Hello, I have a big zombie map. I want the randomly spawning zombies to chase the player, how would I do this?
-TRIED:
-Acquisition range set to 9999999
-Map Initiate, giving zombies vision of entire map.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
-TRIED:
-Acquisition range set to 9999999
-Map Initiate, giving zombies vision of entire map.

And what was wrong with this methodology? I personally didn't like this way because I found the AI would always close to the closest player. I wanted everyone to receive more of a share of attackers.

Here is a system I developed for a map one time. It causes the attackers to move to a random unit with the group. It's kind of like a tag map, so I only added the main builder unit from each player within this group.

  • Register Aliens
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Owner of (Triggering unit)) is in AliensPlayerGroup) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to AlienUnitGroup
      • Set Random_Destination = (Position of (Random unit from Idiots))
      • Unit - Order (Triggering unit) to Patrol To Random_Destination
      • Custom script: call RemoveLocation (udg_Random_Destination)
  • Alien Movement Update
    • Events
      • Time - Every 16.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AlienUnitGroup and do (Actions)
        • Loop - Actions
          • Set Random_Destination = (Position of (Random unit from Idiots))
          • Unit - Order (Picked unit) to Patrol To Random_Destination
          • Custom script: call RemoveLocation (udg_Random_Destination)
With triggers like this, its important to keep track of the "AlienUnitGroup". You don't want to "pick every unit" every 16 seconds. That creates a new unit group every time, and if you have lots of zombies, it could really lag your map. Just manually remove the unit on death:

  • Respawn Aliens
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Triggering unit)) is in AliensPlayerGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from AlienUnitGroup
Your welcome to wait if anyone has a better solution.
 
Status
Not open for further replies.
Top