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

Trigger Remove Event

Status
Not open for further replies.
Level 2
Joined
Apr 1, 2019
Messages
156
Ok thanks,
how do I re-make a trigger? lol

I know I can have multiple of the same trigger with them all turned "off" and then I can turn them "on" and add events as needed. But what if I need to do this a finite amount of times?

Edit: ok looks like I might be able to save the trigger handle in a hashtable then add events to it or destroy the trigger that way.
 
Last edited:
Level 13
Joined
Mar 24, 2013
Messages
1,105
What is the usage you are after?

Feels like if you want to detect something and then no longer need to detect it you would just use a condition check? Although, I suppose if you never need it again maybe it makes sense.
 
Level 2
Joined
Apr 1, 2019
Messages
156
I'm creating waypoint units then setting them to variables then I'm adding the event to another trigger, "a unit comes within range of said variable" the action that other trigger does is just ordering the triggering unit to move to a point.

The thing is periodically I'm removing the waypoint units then creating new ones and setting them to a variable. Then of course adding the trigger event again. This actually seems to work but will it cause lag or problems after a period of time where that trigger has hundreds of added events?
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
2 methods you could use here:

1. Create a stack of waypoint units that you can pull from when you need a new one instead of always creating them (create only when stack is empty). Store information about who owns the wp/where the wp should direct to in some parallel arrays/linked list data structure. When a waypoint is no longer needed, put it back in the stack. You can change ownership and move the unit without messing with the unit in range event.

2. Instead of using the event, put all your waypoint units in a unit group and then periodically loop through them to check for nearby units that should be redirected.
 
Status
Not open for further replies.
Top