• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Questions about removing a trigger

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,614
Hello there.

I would like to know few things about triggers and removing then. If you know something about this, please answer.

1. What's the trigger code that deletes a trigger(in GUI form)?
2. How does it work?
3. Should I use it in order to reduce lag? Or does it even reduce lag?
4. Does it have any "bad" sides? Can it for example, give fatal errors, etc?
5. Do you know something more about this that is important for me to know?

Thanks for answering.
 
there is no function to destroy a trigger in GUI.
you must use
Custom Script: call DestroyTrigger(Triggername)
or call DestroyTrigger(GetTriggeringTrigger()) if you want the trigger to destroy itself.

if the trigger, that is destroyed is currently executed, it does not terminate this execution. but in some situations this can cause problems (in example if you try to call the destroyed trigger). (as according to a website)
 
Triggers shouldn't be destroyed at all if you don't know how to.
For normal maps, it's completly unnecessary to delete trigger.
If you don't need them, turn them off.

Destroying works with the function Cyclotrutan said, but there are problems with it.
If the trigger is executed while being destroyed the entire game can be destroyed.
If I remember correctly it is like this:
First of all, you need to know that each handle has it's own idea, maybe you got
that already (the GetHandleId function (key)).
If a handle is destroyed the id get's free to be reused again.
If a trigger gets destroyed while being executed,
the stack of this ids gets corrupted, causing ids to get
used two times. Since these ids are used for quite a lot of stuff
these systems... can break.
I don't remember all of this problems,
you just should avoid it.

System that destroy triggers keep sure that the trigger isn't running
anymore, storing the timer for example 600 seconds turned off,
destroying it afterwards.
 
Status
Not open for further replies.
Top