| 12-31-2006, 02:30 AM | #1 |
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 |
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 |
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 | |
Quote:
This only turns off a trigger. It isn't destroying it. |
| 12-31-2006, 01:36 PM | #6 |
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 |
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: JASS:call DestroyTrigger(GetTriggeringTrigger()) |
| 12-31-2006, 06:46 PM | #8 |
what do you mean ill have a leak for each one? |
| 12-31-2006, 09:17 PM | #9 |
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 |
... it works, but bewarned not to put it in the beginning. -Av3n |
