• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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