1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Unit comes out of range

Discussion in 'World Editor Help Zone' started by Krogoth, May 2, 2014.

  1. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    I need to check coming out of range immediately, because it must remove some spell. If it is delayed, spell can be casted and mana/cooldown wasted (because effect must not take place out of range). (Spell must have no cast animation)
    What I am doing currently, is
    - eventually check unit comes within range
    - eventually check unit leaves region
    - every 0.1 sec check if unit is within range
    Thus, you can use it in corner, which is not that critical, but still not good
    Using less time period seems to be a solution, but some kind of retarded
     
  2. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    The best way is add units to unit group when they are in certain radius of point.
    Every 0.03 check for units in range and add them to a tempGroup.
    Then check the main group and loop through it to check if units are in tempGroup.
    If that unit is not in tempGroup then it is not in range anymore.

    Also 0.03 is the normal time period. Almost all spells use 0.03 as a timer.
     
  3. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    Ty, this looks much better than calculating distance
    Does not solve problem on 100% though, so I have to check leave region also
    Btw, just spent 20 min in searching of bug. That was GetFilterUnit() not working on filter for unit leave region event, but TriggerUnit() instead (!). So retarded. :/

    qac
     
  4. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    You should not need a leave region event for this.
    You should only need one trigger with one event in it. Unit in Range event.
    With the extra events unit leave / enter region you could make it more efficient as you can turn the trigger off that checks for unit in range if no units are even close to it.

    Also this post should be in WEHZ not in Triggers and Scripts.
     
  5. Krogoth

    Krogoth

    Joined:
    Apr 5, 2011
    Messages:
    247
    Resources:
    0
    Resources:
    0
    I mean, if unit blinks out and uses spell before next timer tick. For example, using shift key.
     
  6. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,532
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    With 0.03 timer it would be almost impossible for someone to get within range then blink out before that unit is caught.
     
  7. plumsy460

    plumsy460

    Joined:
    Oct 2, 2013
    Messages:
    272
    Resources:
    0
    Resources:
    0
    Why 0.03 timer for spells specificly? Does it take too much unnecessary data to use shorter or?

    I have a "mass mana burn" spell I use that summons a dummy to cast mana burn on everything around it. Should I use a 0.03 timer for that, instead of 0.01?
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    It is a good compromise between performance and smooth visuals.

    Ideally you would want a 0.01667 delay as this would mean that not a single frame would render without the actions being performed however the gain for performance is often not worth it.

    This breaks auras as a warning. Auras seem to use the mechanics of this event in a mutually exclusive way.
     
  9. plumsy460

    plumsy460

    Joined:
    Oct 2, 2013
    Messages:
    272
    Resources:
    0
    Resources:
    0
    I see. Thanks a lot :)