• 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 create unis on line?

Status
Not open for further replies.
Level 1
Joined
Nov 4, 2012
Messages
2
So, I'm making map where you defend a castle. Problem is, that I want more units on the walls than editor allows to be placed. I know how to create more units in the beginning of the game by using triggers, but my problem is that they all spawn on small area, though region where they should be is quite large. So how can I make them form clear lines instead of one big bunch?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I hope I understood the question correctly, so you want to create units in a line with triggers?

If that is the case, then this should do:
  • Actions
    • Set tempLoc1 = (Center of (Playable map area))
    • For each (Integer A) from 0 to 9, do (Actions)
      • Loop - Actions
        • Set tempLoc2 = (tempLoc1 offset by (80.00 x (Real((Integer A)))) towards 0.00 degrees)
        • Unit - Create 1 Footman for Player 1 (Red) at tempLoc2 facing Default building facing degrees
        • Custom script: call RemoveLocation( udg_tempLoc2 )
    • Custom script: call RemoveLocation( udg_tempLoc1 )
Info:
  • tempLoc1 defines the initial location, such as the corner of the wall.
  • In this case, 10 units will spawn. Edit the last number of the loop (from 0 to 9) to "units to spawn - 1". (So for 15 units: from 0 to 14).
  • The offset (80.00 * Integer A) defines how far from each other they will spawn (change the 80.00 to whatever you like).
  • The angle defines the angle of the line (0.00 degrees is a horizontal line, 90.00 is a vertical line - anything else is possible too).
  • The "RemoveLocation"s are necessary to remove the leaks (which slow down the game).
 
Status
Not open for further replies.
Top