Ok,Now im expecting Bolt_head will make a huge pos on switchs... Well my problem is i dont know what the F*** Swtichs are so if you guys give me an idea of what they are and how i use them....

Switches are most commonly used as conditions. Literally used as..switches to trigger other actions. They are also used as a system of randomization. By randomizing multiple switches, you can have probabilities of powers of 2.
what he said.
here is an example:
A:
Switch 1 is Cleared
P1 Commands At Most 0 Terran Marine
C:
Set Switch 1
Preserve Trigger
A:
Switch 1 is Set
P1 Commands At Most 0 Terran Marine
C:
Create 1 Terran Marine at Location 1 for P1
Display Text: You got a Marine!
Clear Switch 1
Preserve Trigger
If it's like this, then its an endless cycle of getting a marine after the one you have dies.
hope this helps.

Switches are... switches. Like light switches. They can either be ON (Set) or OFF (Cleared). You can turn them on, turn them off, randomize them, and toggle them. Mainly used for generating random events (look in tutorials database for more on random triggers).
Err yeah, don't use the light switch annalogy. Has that ever helped anyone who dosen't know what they are?
Switches are easy to learn, the harder part is to understand there uses. Witch come with experiance mainly. I've never seen a good tutorial on switches...
The way i describe them is switches are used to show that a trigger has fired previously, when the actual effect of it only occurs in an instant.
For an example you make a trigger where you need to go to several locations with one unit before a door would open. (maybe your collecting materials or something)
You can't make a trigger saying
"Current player has been to locations 1-10"
for the conditions.
So instead you would make a trigger for each of those location to set a switch. Then if the switch is set then your unit has been there.
But of course they can be used more than once, say you 'dropped' one of the items that you picked up. You would then clear the switch to indicate that you no longer are carrying it.
The uses are almost endless and kind of abstract and you will get better with it with practise.
PS. pimpinelephant's trigger is pointless because the same thing could be done without a switch even easyer than it is done using it.
[/end hugh post]I'm in the process of typing up a Starcraft Mapping Bible (allusion to the Starcraft Editing Bible), which includes a down-to-earth explanation of switches, and some example uses, with example triggers.
UED77
yes i just noticed that, u could just do
A:
P1 Commands At Most 0 Terran Marine
C:
Create 1 Terran Marine at Location 1 for P1
Display Text
Preserve Trigger
for the same effect but i was just trying to show him an example.
An alternative to Switches is Death Counters which can be used the same way as switches.
For example, for simplicity, I'll use clear and set:
In switches there is clear which would be off which is 0.
There is set which is on which is 1.
So to use a death counter, you set an unused unit's deaths to 1 to turn something on. Set it back to 0 to turn that trigger off.
Example 2:
| Trigger |
| Description: |
| Death Counter Example |
|
| Players: |
| ¤ Player X |
| Conditions: |
¤ Player X brings exactly 1 Terran Marine to location: Bob
|
| ¤ Player X has suffered exactly 0 deaths of Uraj Crystal. |
| Actions: |
¤ Modify deaths for Uraj Crystal for Player X, set to 1.
|
¤ Preserve Trigger
|
| ¤ Comment: Spawn Trigger On |
| Trigger |
| Description: |
| Spawning Units From Previous Trigger |
|
| Players: |
| ¤ Player X |
| Conditions: |
| ¤ Player X has suffered exactly 1 death of Uraj Crystal. |
| Actions: |
¤ Create 1 Terran Goliath for Player X at location: Spawn Here
|
¤ Wait 1000 milliseconds
|
¤ Preserve Trigger
|
| ¤ Comment: Spawning Commence |
| Trigger |
| Description: |
| Turn Off Spawn |
|
| Players: |
| ¤ Player X |
| Conditions: |
¤ Player X brings exactly 0 Terran Marine to location: Bob
|
| ¤ Player X has suffered exactly 1 death of Uraj Crystal |
| Actions: |
¤ Modify deaths for Uraj Crystal for Player X, Set to: 0
|
¤ Preserve Trigger
|
| ¤ Comment: Spawn Off |
This will spawn Goliaths at a location you specify as long as the Marine is on the location. This is using Death Counters in the place of switches. In my opinion, a much better way.
Ok.. for an exapmle when the current players kill a unit inside a location and then they go to the door location and then the door opens..
Determaning if a player has killed a unit within a location is a difficult task. Basicly all you can do is make a condition "player X brings exactly 0 units to location"
That is assumeing that the unit can't walk out or new ones walk in.
However even if you do this a switch isn't needed because at the time you would reach the door the unit would STILL be dead and not at that location. Unless you respawned it for the next player or something.
In practical use, Death counts are easier because you can associate Current Player with it, but when you need a universal thing or do random things then that's when Switches are used.
In my opionion death counters are a wait of time unless using it specificly for "current player" uses or if multiple values are needed.
However the discussion of death counters vs switches is beyond the scope of the intent for this thread.
heres some advice: read every tutorial in the tutorial section of the site for triggers and for design. it'll help a lot for basic questions like these.