• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Random Unit Placement

Status
Not open for further replies.
Level 4
Joined
Feb 3, 2011
Messages
56
Hey is there a way to spawn a single type of unit in multiple places in a region, possibly facing random directions? Trying to spawn villagers in a village.
 
  • For each (Integer A) from 1 to NumberOfPoints, do (Actions)
    • Loop - Actions
      • Set Point1 = (Random point in YourRegion <gen>)
      • Unit - Create 1 Unit at Point1 facing Default Building Facing degrees
      • Set Point2 = (Point1 offset by 200.00 towards (Random angle) degrees)
      • Unit - Order (Last created unit) to Patrol To Point2
      • Custom script: call RemoveLocation (udg_Point1)
      • Custom script: call RemoveLocation (udg_Point2)
You don't have to set a random angle facing upon spawning, since the patrol command will affect it anyway.

NumberOfPoints is the number of units you want to spawn.
 
Status
Not open for further replies.
Back
Top