• 🏆 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!

How to use the unit within range event?

Status
Not open for further replies.
Level 26
Joined
Mar 19, 2008
Messages
3,140
You need additional trigger for that operation.
Its all about adding event to another trigger.
  • TRIGGER 1
    • Events
      • Map Initialization
    • Conditions
      • <stuff here>
    • Actions
      • Set importantUNIT = (triggering unit)
      • <stuff here>
      • Trigger - Add to TRIGGER 2 the event (Unit - A unit comes within 256.00 of (importantUNIT))
  • TRIGGER 2
    • Events
    • Conditions
      • <stuff here>
    • Actions
      • <stuff here>
As you can see, second trigger has no event event at first, but after trigger 1 runs, it will have new event - which normaly can not be added. So now it looks like this:
  • TRIGGER 2
    • Events
      • Unit - A unit comes within 256.00 of (importantUNIT)
    • Conditions
      • <stuff here>
    • Actions
      • <stuff here>
 
Level 9
Joined
Aug 7, 2009
Messages
380
That event just work if the "Unit" is placed on your map not created by triggers after
Then, i think this will work as same as the result of that event:
  • Trigger 1
  • Events
    • Time - Every 0.40 seconds of game time
  • Conditions
    • (Number of units in (Units within X range of (Variable Y set to the position of the unit you want to check if there's any unit nearby)))) greater than 0
  • Actions
    • Action blah blah..
That's it, Remember to clear the Variable Y (leak)
Well, i think this would work too spinnaker. And Explain:
Condition: use Integer Comparison for that
Variable Y you could set it in a trigger that use Map Initialization

Edit: Seems to be i'm not alone :)
Edit 2: sorry, edit the trigger again
Edit 3: a little explain
 
Last edited:
Level 26
Joined
Mar 19, 2008
Messages
3,140
Man, your trigger is also proper, however mine too.
Nothing stands between changing event:
  • TRIGGER 1
    • Events
      • Unit - starts the effect of ability
    • Conditions
      • <stuff here>
    • Actions
      • Set importantUNIT = (Triggering unit)
      • <stuff here>
      • Trigger - Add to TRIGGER 2 the event (Unit - A unit comes within 256.00 of (importantUNIT))
Your dicision when to add this.
 
Status
Not open for further replies.
Top