• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to detect unit when leaves range of unit?

Status
Not open for further replies.
Level 11
Joined
Jul 28, 2007
Messages
920
I have a hero and that hero can summon units, but when those summoned unit leave range of 1000 from hero they must die. How can i set that ? Oo Have few ideas, but those are complicated and some could result as lagg.

Notice: There are only max of 12 heroes in map, so i think add event wouldn't leak.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
I say again, checking a bunch of units for if they are range for every 0.001 seconds wont lag and what you need is 0.25 so stop being performance freak!!!
 
Level 11
Joined
Jul 28, 2007
Messages
920
I thought that could maybe result as lagg, but if you say no, ok then, i was going to do that, but to be sure.

Fist i need to pick all sumoned units owned by specific player, and then if those picked(summoned) unit are not in range of 1000 of that player's hero, i kill them.
 
Level 11
Joined
Jul 28, 2007
Messages
920
Actually, if i pick unit every 0.5 seconds (and if unit is not in range of 1000 of hero, then i kill unit), (after i destroy that group), it will cause lagg... little, coz of picking units on map and storing them in group.
So i made it like this.

  • Store Summon
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to (==) Player 1 (Red)
          • ((Triggering unit) is Summoned) Equal to (==) True
        • Then - Actions
          • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (StoreSummon1[(Integer A)] is alive) Equal to (==) False
                • Then - Actions
                  • Set StoreSummon1[(Integer A)] = (Entering unit)
                • Else - Actions
        • Else - Actions
and then

  • Check Summon
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Is StoreSummon1[(Integer A)] near Hero[1] and withing a range of 1000.00) Equal to (==) False
            • Then - Actions
              • Unit - Kill StoreSummon1[(Integer A)]
            • Else - Actions
 
Status
Not open for further replies.
Top