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

How to prevent units spawning in unset locations

Status
Not open for further replies.
Level 4
Joined
Nov 26, 2008
Messages
25
I'm trying to have creeps spawn randomly around map but prevent them from spawning in player bases.

Player bases are not defined or set positions on the map so i'm trying to have it as a building.
And i still want creeps to be able to enter the region around this building so they can attack player bases, just not spawn directly on top of them.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
When spawning a creep, you should check if there is a player base nearby.

  • Spawn Creep
    • Events
    • Conditions
    • Actions
      • Set TempPoint = (Random point in (Playable map area))
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units within 1500.00 of TempPoint matching ((Unit-type of (Matching unit)) Equal to Footman))) Equal to 0
        • Then - Actions
          • Unit - Create 1 Footman for Neutral Hostile at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Trigger - Run Spawn Creep <gen> (ignoring conditions)
 
Status
Not open for further replies.
Top