• 🏆 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!

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