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

[Trigger] Creep AI

Status
Not open for further replies.
Level 14
Joined
Jun 13, 2007
Messages
1,432
Hi, I'm making a survival map and I can't figure out a good way to make a good AI for the creeps. I'd like them to run and attack the closet unit they find. +Rep and creds will be given for the one who helps. :grin:
 
Level 20
Joined
Oct 21, 2006
Messages
3,230
This is just pasted from one of my old map..

This just spawns the enemy unit, you can do it as you like.
  • Spawn 20 seconds
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set UnitGroup = (Units of type Spawner)
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set Point1 = (Position of (Picked unit))
          • Set Point2 = (Random point in (Playable map area))
          • Unit - Create 1 Spawn20[1] for (Owner of (Picked unit)) at Point1 facing (Facing of (Picked unit)) degrees
          • Unit - Order (Last created unit) to Patrol To Point2
          • Special Effect - Create a special effect at Point1 using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_Point1)
          • Custom script: call RemoveLocation(udg_Point2)
          • -------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
          • Set Point1 = (Position of (Picked unit))
          • Set Point2 = (Random point in (Playable map area))
          • Unit - Create 1 Spawn20[2] for (Owner of (Picked unit)) at Point1 facing (Facing of (Picked unit)) degrees
          • Unit - Order (Last created unit) to Patrol To Point2
          • Special Effect - Create a special effect at Point1 using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Custom script: call RemoveLocation(udg_Point1)
          • Custom script: call RemoveLocation(udg_Point2)
      • Custom script: call DestroyGroup(udg_UnitGroup)
And this trigger controls units.
  • All move maphack
    • Events
      • Time - Every 45.00 seconds of game time
    • Conditions
    • Actions
      • Set UnitGroup = (Units in (Playable map area) matching ((((Matching unit) is Undead) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in (Random 1 units from Player_Unit) and do (Set Point1 = (Position of (Picked unit)))
      • Unit Group - Pick every unit in UnitGroup and do (Unit - Order (Picked unit) to Patrol To Point1)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Custom script: call RemoveLocation(udg_Point1)
 
Status
Not open for further replies.
Top