HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Nearest enemy unit?

03-23-2005, 06:43 AM#1
DrizztTwoBlades
Ok I'm making a skill called chain hex, basically its like chain lightning but it hexes all the units it hits, what I need to know though is if theres a way to make it affect the nearest enemy unit, I also don't want it to target the same unit twice so I was wondering if polymorphed units are the same as hexed units. Any help would be appreciated, thanks in advance!
03-23-2005, 06:50 AM#2
Azhag
Polymorphed units, have the poly buff on them. Hexed units, have hex buffs on them, so no they arn't the same.
03-23-2005, 06:53 AM#3
Raptor--
um, i'm tired so there might be a better way, but

set distancevar = X
set closestunitvar = no unit
pick all units in range X of unit Y
-- if distance between picked unit and unit Y <= distancevar
-- -- set distance var = distance between picked unit and unit Y
-- -- set closestunitvar = picked unit
-- endif
endloop
03-24-2005, 02:04 AM#4
PCPharaoh
Assuming chain lightning targets the closest unit (which I believe it does), can't you just use a chain lightning with zero damage, and then trigger: If unit is hit by chain lightning, cast hex on that unit?
03-24-2005, 07:46 AM#5
Strategy Master
@PCPharaoh
yeah, but unless chain lightning creates a buff on the units it hits for a second, this idea will fail.
03-24-2005, 07:48 AM#6
Azhag
So use triggers to add a useless buff on the unit, and then use hex on them.
03-24-2005, 11:13 AM#7
Strategy Master
but that only gives u the first unit. How are u going to third unit or even fourth.