1. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  2. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

An item or a unit within range

Discussion in 'World Editor Help Zone' started by micca, May 1, 2019.

  1. micca

    micca

    Joined:
    Dec 31, 2016
    Messages:
    158
    Resources:
    0
    Resources:
    0
    I need to do something quite complicated I can't figure out on my own. The thing is, a unit is moving and I need to check whether an item or a unit, whichever is possible or easier (item would be better though), comes within a range of the unit. The action "A unit comes within a range" is for specific unit only and I need it in general.

    Thanks for any help.
     
  2. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    2,346
    Resources:
    1
    Maps:
    1
    Resources:
    1
    For units use :
    • Trigger 1
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set Footman = Footman 0001 <gen>
        • Trigger - Add to Trigger 2 <gen> the event (Unit - A unit comes within 256.00 of Footman)

    • Trigger 2
      • Events
      • Conditions
      • Actions
        • Trigger - Turn off (This trigger)
        • -------- Do your stuff here--------

    As for items :
    • Trigger 3
      • Events
        • Time - Every 0.01 seconds of game time
      • Conditions
        • (Distance between (Position of YourUnit) and (Position of YourItem) Equal to 256.00
      • Actions
        • Trigger - Turn off (This trigger)
        • -------- Do your stuff here--------
     
  3. micca

    micca

    Joined:
    Dec 31, 2016
    Messages:
    158
    Resources:
    0
    Resources:
    0
    Thank you very much! I didn't realise you can actually add events via triggers :D
     
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,390
    Resources:
    0
    Resources:
    0
    Be aware that using the distance between points in the condition like that means you cannot clean the 2 point leaks. (Things That Leak) You will need to move that check inside the actions to be able to clean the leaks.
     
  5. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,098
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    You can also periodically select units in range yourself with "Pick all units ...".