[Trigger] Event - Condition that determines if a hero is close to another

Status
Not open for further replies.
  • Set Temp_Point = (Position of (*your hero*))
  • Set Temp_Group = (Units within *range* of Temp_Point matching (((Matching unit) is A Hero) Equal to True))
  • -------- Remove memory leak: --------
  • Custom script: call RemoveLocation(udg_Temp_Point)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in Temp_Group) Greater than 0
    • Then - Actions
      • -------- There is a hero in range --------
    • Else - Actions
      • -------- There is NOT a hero in range --------
  • -------- Remove memory leak: --------
  • Custom script: call DestroyGroup(udg_Temp_Group)
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
  • Set Temp_Point = (Position of (*your hero*))
  • Set Temp_Group = (Units within *range* of Temp_Point matching (((Matching unit) is A Hero) Equal to True))
  • -------- Remove memory leak: --------
  • Custom script: call RemoveLocation(udg_Temp_Point)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in Temp_Group) Greater than 0
    • Then - Actions
      • -------- There is a hero in range --------
    • Else - Actions
      • -------- There is NOT a hero in range --------
  • -------- Remove memory leak: --------
  • Custom script: call DestroyGroup(udg_Temp_Group)
This will always return true as the group pick also picks the hero itself, so it makes a check "Unit_001 is withing X range of Unit_001" which is always true.
 
Last edited:

sentrywiz

S

sentrywiz

Is there a way to detect if a hero is near another hero like in that heros vicinity?

Pick each unit around each hero. Check if picked unit is hero. If yes, profit. Otherwise nothing

Its more complex if you're searching for the nearest hero near target hero, but it's also easily doable. Only more conditions.
 
Status
Not open for further replies.
Top