PDA

View Full Version : Preserve Trigger


Kawagata
05-27-2007, 10:03 PM
What exactly is preserve trigger? I think it might be something to keep the trigger active at all times. I'm guessing. If it isn't what can make the triggers active after a certain time always?

cykotek
05-28-2007, 1:43 AM
The "Preserve Trigger" command means the trigger stays in the list.

Normally, whenever a trigger is executed, it is deleted from the script - it will only ever run once. But, if "Preserve Trigger" is included in the actions, the trigger will remain, waiting for its conditions to be matched again. And when the conditions are matched again, it executes again.

And again... and again... just be careful how you word the conditions, because otherwise you could create an infinite-loop trigger that is constantly executing.

TheDriver
05-28-2007, 6:26 PM
Preserve Trigger makes a reoccuring trigger.
For Example, if you want to create a unit after a unit dies (used commonly in cat vs. mouse)
Player X has one death of Unit X

Create one X at Location X for Player X.
Without a preserve, it will occur only once with one it keeps occurring.
Now with one,

Player X has one death of Unit X

Create one X at Location X for Player X.
Preserve Trigger.
Note that there is no death resetting so the unit would keep being created.
The correct trigger (or at least a version)would be The following:
Player X has one death of Unit X

Create one X at Location X for Player X.
Set Deaths of unit X to 0.
Preserve Trigger.
Thus the trigger keeps occuring whilst at the right time :D
This was a quick tutorial. Although preserve Trigger is easy, it gets more advanced when used with switches, loop/web triggers, hyper triggers but that my friend is another story.

wakiki
05-28-2007, 7:42 PM
Create one X at Location X for Player X.
Set Deaths of unit X to 0.
Preserve Trigger.

Thus the trigger keeps occuring whilst at the right time :D
This was a quick tutorial. Although preserve Trigger is easy, it gets more advanced when used with switches, loop/web triggers, hyper triggers but that my friend is another story.

That's cool. I never really knew what set deaths did.

Is there any way to set unit amounts? I'm trying to find a way to give resources to a play when a building is built at a location, and for those resources to stop once the building is destroyed? I looked in the map editor just now and couldn't figure it out.