• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Need help in a trigger to create units!!!!

Status
Not open for further replies.
Level 6
Joined
Jul 17, 2008
Messages
185
Hi...

basically what i want to do is to create 20 units in different random points of the map, but when i do this:

  • Unit - Create 20 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
This creates 20 mines only at 1 random position, so i changed the trigger:

  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
  • Unit - Create 1 Goblin Land Mine for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
this seems a very ridiculous thing and i wanted to know how to do it in a better way

Help pls...
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You have integer A and integer B because you may want to have a loop inside of a loop.

Using

  • For every (Integer A) from 1 to 6
    • Loop
      • For every (Integer A) from 1 to 6
        • Loop
          • *do your things*
Would not work too well. So you need to use integer B for the other.

And your trigger:
  • For every (Integer A) from 1 to 20
    • Loop
      • Set Temp_Loc_1 = (Random point in (Playable map area))
      • Unit - Create 1 *unit* at Temp_Loc_1 facing...
      • call RemoveLocation(udg_Temp_Loc_1)
 
Status
Not open for further replies.
Top