How are we supposed to "know" if you need 'em? Please be more specific in your description! You can also check out Death Counters and the such, which work just as well. They work well, for example, if you need to have a guy get a key then walk across the map to open the door!
Condition: Player 1 bring D00d to location "Key"
Action: Set SWITCH "Key found"
Condition: Player 1 brings D00d to location "Door"
-SWITCH "Key found" is set
Action: Disable door at location "Door" (disabling opens, enabling closes)
See? For a trigger to occur every condition must be met! Therefore, if he doesn't find the key, then he cannot open the door. Do you get it?
I'd try to figure out switches before death counters. Anyways, here you go, this is much more accurate than a lot of stuff.
QUOTE
Say you want a pause 20 seconds long. It is of course not a good idea to use a wait as we have established. So what we do for our element of time is we rely on the refresh rate in witch triggers fire. Triggers fire about once every 1.5 seconds. (about 11 times per second with hyper triggers). What we do is create a loop that subtracts or adds to a number until it gets to the point we need it at. I'll using adding for my example.
Players:
-Force 1
Condtions:
-Current player accumulates at least 1 minerals
Actions:
-Add one mineral for current player
-Preserve trigger.
This of course will keep adding minerals. So now back to our 20 seconds and how to incorperate it.
Say you have this trigger
Condtions: switch "storyline" is set
Actions: Display "hello" / wait 20,000milli / Display "Huh?"
To avoid this wait we can use these triggers
Conditions:
-Switch 'storyline' is set
Actions:
-Display "Hello"
-Set resources to 1 mineral for current player.
Conditions:
-Current player accumulates at exactly 15 minerals
Actions:
-Display "Huh?"
And of course you use the trigger above that adds minerals. You might have to play with the values to get them exactly how you want. It is more accurate if you use hyper triggers with larger values.
Now most likely your using minerals and gas for your map so we can't just use that. That is where death counters (or custom score) comes in handy. There are over 200 units in Starcraft (i always forget the exact number) and you can set deaths for each of them. First thing you need to do when selecting a death coutner is to find a unit that is not used in your map or it is impossable for it to die. This is because if the unit dies while the counter is being used it could cause problems (not so much for your trigger). I personaly use critters, powerups, and minerals alot. To use them just replace my example of minerals with the Set Deaths action and the Deaths condition.
Some other uses for counters.
-Setting deaths is sometimes used a kind of supper switch. Rather than createing a switch for each player. Deaths are individual to each player, unlike switches.
-Another example is to store a numbered value of information. Such as the obstical number in a bound. or the Upgrade level of a hero in a RPG. Useing one counter for things like this rules out dozens of switches that might of been used.
Some Helpfull hints:
-Counters are really helpfull because they work indpendantly for each player.
-I personaly like to use 0 as a null state for a trigger like this. Since i use the conditions "at least 1 mineral" for the counter trigger then it doesn't count until i set it to 1 or higher. Then when your done you can set the value back to 0 untill you need to use the counter again.
-Make sure you don't use the same counter at the same time.
-Counters for your purpose are better when used with hyper triggers.
Lastly, Death Score / Counters are something you get more and more accustomed to the more you use them (like switches). If you have any more questions about them feel free to ask.
--(U)Bolt_Head
EDIT: 31 May, 2004 @ 4:04 PM EST
Don't forget that switches start off as cleared!