HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Firing Missile

01-18-2005, 03:58 AM#1
GosuSheep
how can i make it so a unit fires a projectile at the closest unit to him?

replies are greatly appreciated
01-18-2005, 09:42 AM#2
iNfraNe
variables:
closestunit (unit)
distance (integer)
set distance=9999999999999999999999999
Code:
Pick all units in playable map and do actions
    - if distance between picked unit and your unit < distance then
          set distance = distance between picked unit and your unit.
          set closestunit = picked unit
then just order your unit to attack closestunit

or, give him a big acquisition range, and make him stop (then he will automaticly attack the closest)