• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Most efficient way to set up a proximity trigger (I.e. triggered mine)

Status
Not open for further replies.
Level 24
Joined
Feb 9, 2009
Messages
1,787
Be it explosive goblin tech or restorative runes, whats the best way to trigger something like this?
Obviously barring the landmine ability, that's too one dimensional, and GUI would be preferred!

>What the #$%& are you on about?
X comes within range of Y, if so do effects, there is the basics of "Unit comes within range" however that's creating a trigger for each unique unit, and there's the periodic unit group check, but that has tick rate effects.

>You've just explained two ways of doing it, you turkey!
Yes, but I want to read other responses of those who are more experienced than I!
Lend me thy keyboard my dear fellows, weave a tale of your know how, and let us conjoin our thoughts into a nice thick toffee that sticks to ones teeth, a thought toffee, a thoffee?
 
Level 5
Joined
Jun 12, 2018
Messages
148
For a periodical check to use a spell like Kaboom!, I'd go like this :

  • Check for Kaboom
    • Events
      • Time - Every 0.17 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Goblin Sapper)) and do (Actions)
        • Loop - Actions
          • Set Unit_Location = (Position of (Picked unit))
          • Set Spotted_Enemies = (Units within (Unit: (Picked unit)'s Real Field: Acquisition Range ('uacq')) of Unit_Location matching (((Owner of (Picked unit)) is an enemy of (Owner of (Matching unit))) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in Spotted_Enemies) Greater than 0
            • Then - Actions
              • Unit - Order (Picked unit) to Neutral - Kaboom! (Random unit from Spotted_Enemies)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Unit_Location)
The range used for detection is set by unit acquisition range for realistic purposes :p
 
Level 13
Joined
Oct 16, 2010
Messages
731
I'd go for the periodic check personally, but add all of the relevant "mines" into a unit group when they enter the map.

This way it'll only check the relevant units rather than having to find the relevant units each time if that makes sense. As a bonus you could turn the periodic trigger on/off when needed!
 
Status
Not open for further replies.
Top