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

When unit enters range of unit type

Status
Not open for further replies.
Level 3
Joined
Jun 17, 2007
Messages
62
You can do this with a periodic event.

Like every 2 seconds. Pick all Units of ur Type. Put the picked unit in a variable (guess it should do something, so u can refer do that specific unit). Then pick all units within range of that picked unit.

Should work this way.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Like Kinglz said: put all deer into a variable (for example: Deer [1] = Deer 001; Deer [2] = Deer 002 and so on in Map Initialization.

Then do a trigger like this:
Events: Every 2 seconds of game time
Actions: Loop: for each Integer A from 1 to (thenumberofdeersonyourmap) do:
pick all units in 200 (any number) of Deer [Integer A] matching : picked unit is a Hunter and do actions:
Deer [Integer A] is the deer you're concerning.
Picked unit is the Hunter.

if there's only 1 deer, you don't need an array or a loop.
 
Level 3
Joined
Jun 17, 2007
Messages
62
So you want to count all dears in range to ur hunter ?

Thats pretty easy.

Periodic Event.

Unit Group- Pick every of Type hunter.
do
pick every unit in X range of picked unit matching condition is type deer
do
** Set Temp_Count = Temp_Count +1


The Integer Temp_Count is increased everytime he finds a deer within range of the hunter.
after all that you should set Temp_Count back to 0.

** here u can set everything you want to do when a deer is picked...... it will be done for every deer in range....
 
Status
Not open for further replies.
Top