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

Help

Status
Not open for further replies.
Level 12
Joined
Jun 1, 2009
Messages
576
I need trigger help:

In my map i need to create 20 units on RANDOM location on the map...but i dont want to those units be created CLOSE to buildings and units that are alredy on map....I want to those units be created example 200-300 range far from any object :))
 
Level 12
Joined
Jun 1, 2009
Messages
576
this must be modified to fit my map.....As i see function of this trigger is to create starting units for each player at random location (with some distance between units)...


I will write here exactly what i need so if you want you can modify this to fit my map.


In my map on start you have 20 neutral hostile units (creeps) scattered on the map.

I want this: when number of living units owned by neutral hostile of type ? becomes less than 5 create 15 units owned by neutral hostile of type ? at random location on the map (BUT WITH SOME DISTANCE BETWEEN UNITS). To solve this distance problem is point of this request. So pls if you have time change your trigger to do exaxtly this :)))


In the meantime other members can post their solution for this problem....
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Map init
Event - Map init
Actions
Run trigger - trig1

Trig 1
Set TempPoint = Random point in playable map area
Set TempUGroup = Unit in 300 range from temp point
Unit group - Pick evry unit in TempUGroup
Loop Actions
--If/then/else (multiple)
----Conditions
----Integer comparison - Units in TempUGroup = 0
----Then Actions
----Unit create Footman at TempPoint
----Set CreepCount = CreepCount + 1
------If/then/else
------CreepCount < 20 /Then Trigger - Run (This Trigger) /Else
----Clear Leaks
----Else Actions
----Trigger - Run (This Trigger)
----Clear Leaks
Clear Leaks

Trig2
Event
Generic unit - A Unit dies
Conditions
Unit type of dieing unit equal to Footman //I assume only neurtal hostile has creeps but if not so check for the owner too
Actions
Set CreepCount = CreepCount - 1
If/then/else CreepCount = 5 /Then Trigger - Run Trig1 /Else

This has flaws. If your map is not big enough some units could not find a suitable place to spawn and cause infinite loop. Or might stuck units in... places where you dont want them to be.
Other solution is to split the map on regions.
 
Status
Not open for further replies.
Top