HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit within range of unit of type???

07-16-2004, 01:13 AM#1
Jumbo_pie
how do make an event; unit within range of a unit of type, i can only seem to make unit within range of a preset unit events, can anyone help me?
07-16-2004, 09:24 PM#2
Vexorian
you can't , but there are few work arounds:

The goblin's land mine - exploding ability, will kill the unit whenever an enemy unit comes in range

Or have this:
Event:
A unit enters Playable map area
Condition:
Unit type of Triggering Unit equal to turtle
Actions
Trigger - to triggerA <gen> add the event a unit comes within 500 of (triggering unit)

(triggerA is another trigger , the trigger that you wanted to add the event)

PS: this will leak events like hell,
07-17-2004, 05:42 PM#3
harshateja
This probably sounds stupid(im sorry) but coudn't you just flip the event. Instead of asking it to check whether a "unit(call this unit1) in range of unit-type", why dont you say:
Event:
a unit comes within range of unit1
Condition:
unit type of triggering unit equal to ____
action:
___

Course this will only work if you ave either a varaiable name of unit1 or a preset value.

If you mean an event like unit-type comes within range of unit-type, i would add an mine explode ability to the units and edit the ability to have no art, no damage and no sound. Then, you can add a trigger to track whether the mine ability was used.

Hope this helped

~HarshaTeja~
07-17-2004, 09:01 PM#4
Vexorian
unit within range is a specific event
07-17-2004, 10:09 PM#5
R3N3G4D3
You could create a region and make a trigger to periodically center it on the unit you need, and then use "unit enters region" event. Although if you have many units of that unit-type you will need many regions, or you could just make the game auto-generate regions by giving it coordinates of every unit of a given unit-type, and gfenerate a separate region for each unit. I'm not sure if this will leak regions, so you mgiht want to add a trigger to remove old regions. Or (I'm not exactly sure if this will work) you can give a unit-type an aura ability with the needed range, and set aura data stats to none, then havea trigger check if a unit gets an effect of an ability (there is a check like that, it's in conditions, not events though) and set triggering ability to the aura that that special unit-type has. Or if this doesn't work, you could try to create a buff with no art and assign that buff to that aura, and then check if a unit gets that buff, that way you know that if any unit gets the effect of the buff or ability on it, it has to be within range of the needed unit-type.
07-17-2004, 10:11 PM#6
Vexorian
Quote:
Originally Posted by R3N3G4D3
You could create a region and make a trigger to periodically center it on the unit you need, and then use "unit enters region" event. Although if you have many units of that unit-type you will need many regions, or you could just make the game auto-generate regions by giving it coordinates of every unit of a given unit-type, and gfenerate a separate region for each unit. I'm not sure if this will leak regions, so you mgiht want to add a trigger to remove old regions. Or (I'm not exactly sure if this will work) you can give a unit-type an aura ability with the needed range, and set aura data stats to none, then havea trigger check if a unit gets an effect of an ability (there is a check like that, it's in conditions, not events though) and set triggering ability to the aura that that special unit-type has. Or if this doesn't work, you could try to create a buff with no art and assign that buff to that aura, and then check if a unit gets that buff, that way you know that if any unit gets the effect of the buff or ability on it, it has to be within range of the needed unit-type.
nope , that won't work at all, the a unit enter rect event won't recognize when the rect is moved
07-17-2004, 10:36 PM#7
R3N3G4D3
What about the second solution I suggested there, something like this:
Event:
Unit start effect of an ability
Condition:
Ability being cast equal to [whatever]
Actions:
...

or you could have a periodic event picking every unit and checking distance to other units on the map (this might cause some lag if you have a lot of units, because it will make X^2 checks where X is the total amount of units on the map. You could put units in array and only check distances units that haven't been checked yet, this would reduce it to X+(X-1)+(X-2)+... comparisons).