HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Stand in range and click

07-15-2004, 10:48 AM#1
Fladian
I've been trying to find this out for a while but I can't seem to find the answer...

I want dialoges to start when a unit is within range of an other 'certain' unit. Not hard to do, and I know the event, but I also want the player to click on that "certain" unit while HIS own (not an other player) unit is within range of that 'certain' unit.
I first used the trigger just to let a player select that unit and the cinematic started but I was thinking. If more of the map is visible then it just doesn't work, so he needs to be in range of it too.

Thanks in advance
-Fladian
07-15-2004, 02:22 PM#2
johnfn
I dont think this would be too hard, if I understood you right.

Try something like this:

Events
A player selects a unit
Actions
for each unit in(units in region size 500,500 around (In range of this unit))
if (picked unit) Equal to (Selected unit)

Do whatever you want

End if

A little side note: you might want to set

units in region size 500,500 around (In range of this unit))

to a unit group and search through a unit group on the next line to cut off some memory leak.
07-15-2004, 02:48 PM#3
Anitarf
You don't even need a region, just do it this way:
Code:
Events:
  The special unit gets selected
Conditions:
Actions:
  Set tempPoint = position of (selected unit)
  Set tempUnitGroup = units within 500 range of tempPoint matching condition: ((matching unit) is owned by (selecting player)) equal to true
  If -then - Else multiple functions:
    If - conditions:
      Integer comparison: Number of units in tempUnitGroup greater than 0
    Then - actions:
      --Do your stuff--
    Else - actions:
      Do nothing
  Custom script:  call RemoveLocation ( udg_tempPoint )
  Custom script:  call DestroyGroup ( udg_tempUnitGroup)