HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Using local triggers

05-06-2007, 08:01 PM#1
Joker
Im a bit confused on how local triggers work. Lets say I want a spell so that when it is casted, I dont want the caster to be attacked by anything(so the attackers will be ordered to stop) until the caster dies. Im having trouble turning the trigger on and off. Since it's a local trigger, I cant use DisableTrigger in another function. How would you stop the trigger?
05-06-2007, 08:08 PM#2
Earth-Fury
What do you mean a "local trigger"? The first thign that pops to mind is usage of GetLocalPlayer(), and that would cause a desync with triggers...
05-06-2007, 08:29 PM#3
Pyrogasm
He means a local trigger: local trigger t = CreateTrigger()

Joker: Local triggers work just the same way normal triggers work (create them, add events/conditions/actions), except that the only way to access them after they're created is through Structs or Handle Variables.

After you create your local trigger, you'd need to attach it to the unit casting your spell so that you could disable the trigger when you need to (Destroying it is a bad thing, according to Vexorian).
05-06-2007, 08:35 PM#4
Rising_Dusk
Or you could make them global.

In most cases you don't need local triggers.
There are some cases (Most of these revolve around the EVENT_UNIT_DAMAGED event as well as a few others) where you might need local triggers.
However, if you don't need the trigger to work for specific units only at specific times, you can always make the triggers global and Disable/Enable as necessary.

It's best to avoid local triggers whenever possible.
Destroying them fries handle indicies and not destroying them leaks them.
05-07-2007, 01:07 AM#5
Joker
So i would need multiple triggers for this spell? :(
05-07-2007, 01:28 AM#6
Rising_Dusk
You might, there isn't anything wrong with it if it's the only way to do it.
It's really spell-dependent.
05-07-2007, 01:51 AM#7
Pyrogasm
It depends on how MUI you need it to be.
05-07-2007, 03:03 AM#8
Tossrock
Quote:
Originally Posted by Rising_Dusk
Or you could make them global.

In most cases you don't need local triggers.
There are some cases (Most of these revolve around the EVENT_UNIT_DAMAGED event as well as a few others) where you might need local triggers.
However, if you don't need the trigger to work for specific units only at specific times, you can always make the triggers global and Disable/Enable as necessary.

It's best to avoid local triggers whenever possible.
Destroying them fries handle indicies and not destroying them leaks them.

They're quite handy for unit enters range of unit, as well.