• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Unit/Item/Whatever gets in X range of unit = something happens

Status
Not open for further replies.
Level 5
Joined
Jun 5, 2009
Messages
121
Hello Hive,

I always have the same problem and i dunt know how to solve this...

Is it possible with gui to trigger like if a unit gets in range of a specialy unit it happens something?

Like

Unit of type Survivier gets in 500 range of unit of type Angry Wisp

Teleport unit (the survivor) to zone 1


and if it is possible is it also possible to make with gui that a unit takes items if the unit can see them? like the unit has 700 range and is random running around then a item appears in is sight radius and it stops all actions and grab the item?

I didn't found something like this in the tutorial area or in the forum maybe cause of my bad english anyways i hope someone can help

Greetings, Chris
 
Level 5
Joined
Jun 5, 2009
Messages
121
You can use Trigger - Add new event, then add that event and you can use variables.

Or you can use a periodic trigger (Time - Periodic event) and check the distance.

In what kind of situation are you planning to use this?

Its a surviving fun map while survivors have to survive (suprise suprise lol) and they are in a "magical forest" and there are dozens of events happening, like spawning a angry tree tower and a wisp and the wips is running randomly around and if units come in range of the wips they get ported to the tower and slowed i have this all done but i needed to spawn the wisp in the editor outside the map to choose it cause it wont let me use it as variable except if i use the trigger add new event but thats not really working at all D:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Add the units (whom you want to let the unit do something when any unit comes in contact with it) in a Unit Group and simply loops it:

  • Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set GroupUnit = (Picked unit)
          • Set UnitLoc = (Position of GroupUnit)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within XXX.XX of UnitLoc) and do (Actions)
            • Loop - Actions
              • -------- DO ACTIONS HERE --------
              • Unit - Move (Picked unit) instantly to ResetPoint
You can choose whether the survivors should enter the unit group, or the wisps (and all other creatures)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Add the units (whom you want to let the unit do something when any unit comes in contact with it) in a Unit Group and simply loops it:

  • Check
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set GroupUnit = (Picked unit)
          • Set UnitLoc = (Position of GroupUnit)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within XXX.XX of UnitLoc) and do (Actions)
            • Loop - Actions
              • -------- DO ACTIONS HERE --------
              • Unit - Move (Picked unit) instantly to ResetPoint
You can choose whether the survivors should enter the unit group, or the wisps (and all other creatures)

You forgot something:

  • Custom script: call RemoveLocation(udg_UnitLoc)
;)
 
Status
Not open for further replies.
Top