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

Create a Unit Group on a random point

Status
Not open for further replies.
Level 5
Joined
Jun 3, 2012
Messages
96
Hello! I am making a 2D map and just missing the triggers, in one of them i do not know how to do:


I need that units groups are created next to the hero of the player(No in a fixed range, but in a random distance from hero and not so far away). When the player Advance on stage, this unit group change (stronger units will be created). When the enemy units are created, they will advance directly to the player.

I thought in use a region and use a random point to create the units, but this could create enemies far away from where the player is

So... How i do to create groups of units on a random point within a certain range of the player?

And sorry my bad english.
 
set loc = (whatever location)
set loc = loc with polar offset of (random real between minRange and maxRange) at (random real between 1 and 360) degrees.
units - create # units at loc
call removelocation(loc)
 
set loc = (whatever location)
set loc = loc with polar offset of (random real between minRange and maxRange) at (random real between 1 and 360) degrees.
units - create # units at loc
call removelocation(loc)

you're leaking the first loc, should be loc and loc2 (an overwritten point will produce leaks).

  • Set loc = (Position of (YourHero))
  • Set loc2 = loc offset of (random real between minRange and maxRange) at (random angle) degrees
  • Unit - Create YourUnit at loc2
  • Custom script: call RemoveLocation (udg_loc)
  • Custom script: call RemoveLocation (udg_loc2)
 
you're leaking the first loc, should be loc and loc2

  • Set loc = (Position of (YourHero))
  • Set loc2 = loc offset of (random real between minRange and maxRange) at (random angle) degrees
  • Unit - Create YourUnit at loc2
  • Custom script: call RemoveLocation (udg_loc)
  • Custom script: call RemoveLocation (udg_loc2)

oh yeah forgot about that
 
Oh will try!!! Ty for now! *-* !

*edit*

testwxn.jpg



Well, this form? nothing happens D:!
 
Last edited:
Try this;
  • Melee Initialization
    • Events
      • Unit - A unit enters Estrada 1 <gen>
    • Conditions
      • (Triggering unit) Equal to Blood Mage 0011 <gen>
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Set TempLoc2 = (TempLoc offset by (Random real number between 0.00 and 800.00) towards (Random angle) degrees)
      • Unit - Create 5 Footman for Player 1 (Red) at TempLoc2 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
      • Trigger - Turn off (This trigger)
Make sure to turn off the trigger so that it won't spawn again the waves if you accidentally steps on the region again.
 
Status
Not open for further replies.
Back
Top