HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Removing Triggers

12-31-2006, 02:30 AM#1
Joker
How do you remove triggers after they have been used such as triggers that occurs once and isnt used again?
12-31-2006, 02:45 AM#2
darkwulfv
I do beleive there is a destroy or remove trigger action, but be careful with it, i think it can cause bugs, but since its a once only trigger i dont think itll do anything.
Or you could turn it off...
12-31-2006, 02:59 AM#3
Zandose
As far as I know you can't remove lines of code from a trigger. You can however add add events, conditions, and actions (Use WEU). If you have a trigger such as a map initialization trigger which only fires once at the start of the game then you can destroy it with "call DestroyTrigger( GetTriggeringTrigger() )". Make sure you put it at the end of the trigger or it may cause problems.
12-31-2006, 06:56 AM#5
Chocobo
Quote:
Originally Posted by smily132
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
Actions
Trigger - Turn off Melee Initialization <gen>

example of a gui trigger... cuz i don't know jass

This only turns off a trigger. It isn't destroying it.
12-31-2006, 01:36 PM#6
WILL THE ALMIGHTY
so? the trigger won,t ever activate anymore, but if you ever need it, you can just reopen it. using this is much more effective then completly destroying a trigger, even if it is possible.
12-31-2006, 02:25 PM#7
wyrmlord
You can choose to use the DestroyTrigger function, but you'll also want to remove the actions and conditions from the trigger too, otherwise you'll have a memory leak for each one (if I remember right). If you don't know any JASS, just put this code at the end of a trigger in a custom script action:
Collapse JASS:
call DestroyTrigger(GetTriggeringTrigger())
12-31-2006, 06:46 PM#8
Joker
what do you mean ill have a leak for each one?
12-31-2006, 09:17 PM#9
DioD
Do not use triggeraction

declare all your actions like counditions of a trigger


function action takes nothing returns boolean
return false
endfunction

just add returns boolean to head
and return false to end of action

counditions die with trigger

boolexp is return function e g Coundition(fun x) == Coundition(fun x)

soo it is not leak at all
12-31-2006, 09:33 PM#10
Av3n
... it works, but bewarned not to put it in the beginning.

-Av3n