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

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,240
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