Staredit Newtork
Community
StarCraft
Games
Site
Favourites
Help me!, Switches...

Creator: Oo.HavoK.oO
Time: Nov 1 2007, 8:43 pm

Post #1     Oo.HavoK.oO Nov 1 2007, 8:43 pm

[Avatar]
 offline contact
I still don't fully undserstand Switches, so if you could write up and example of on and thoroughly explain it, that would be awesome! Thanks! :D
(user posted image)
Top

Post #2     who Nov 1 2007, 8:50 pm

[Avatar]
someone09
 offline contact
First of all, this is in the wrong forum.

Switches are basically conditionals. Setting them and clearing them actually don't do anything, but they allow you to start and disable things whenever you want.
heres an example:

C:
Switch 1 is clear
P1 brings a civilian to location
A:
Set Switch 1
preserve trigger

C:
Switch 1 is set
A:
create marine at spawn
wait 500ms
preserve trigger

C:
Switch 1 is set
P1 brings 0 civ to location
A:
Clear switch 1

This is an example of using switches to start something. It's pretty simple. If P1 brings a civilian to a preset location, then it'll set a switch. In the next trigger, it creates a marine, but only if the switch is set. The third trigger clears the switch if the civilian is not at the beacon, so it'll stop creating marines.
Triggers that rely on switches are easy to start and stop - that's why they're useful.
:bye1:
(user posted image)
Top

Post #3     Kenoli Nov 2 2007, 3:03 am

[Avatar]
 offline contact
QuoteC:
Switch 1 is clear
P1 brings a civilian to location
A:
Set Switch 1
preserve trigger

C:
Switch 1 is set
A:
create marine at spawn
wait 500ms
preserve trigger

C:
Switch 1 is set
P1 brings 0 civ to location
A:
Clear switch 1

Here's a revised version of your trigger.
QuoteConditions:
Player 1 brings exactly 1 Civilian to 'Location'.
Actions:
Preserve trigger.
Create 1 Marine at 'Spawn' for Player 1.
Wait 500ms.
Top

Post #4     who Nov 2 2007, 3:05 am

[Avatar]
someone09
 offline contact
That's the most efficient way, but I'm showing him an example of switches. If it was something more complicated, then switches would be better.
(user posted image)
Top

Post #5     Akar Nov 2 2007, 3:46 am

[Avatar]
Peaceful Warrior
 offline contact
Switches are fairly simple to understand, they work like a light switch. There is an ON, and an OFF. Those are the only 2 positions. Now if you walk a room after you've been gone the lights are usually off right? Well the same principle works with maps. The switch will be in the off position when you start it. StarEdit refers to OFF as CLEAR, and ON as SET.
Now realizing that little tidbit, how about I show you some practical uses:

1. Halting Preserve Trigger.

This generally works by having that when the switch is SET, the trigger will run, however, if the switch is put into the CLEAR position, the trigger will not run:
Trigger
Players:
¤ Player 1

Conditions:
¤ Always
¤ Switch1 is SET

Actions:
¤ Create 1 Terran Marine at location "Marine Spawn"
¤ Preserve Trigger


Now if we were to turn it off all you would have to do is:

Trigger
Players:
Player 1

Conditions:
¤ Player 1 commands 0 Marine Spawner
¤ Switch1 is SET

Actions:
¤ CLEAR Switch1
¤ Preserve Trigger



2. Separating Wait Blocks.

When you have 2 waits that you want to run at the same time there is a dilemma, you must wait for one to complete before you allow the other one to even begin.
However, the wait block only applies for that one type of player. So what we need to do is make the 2 wait times execute for 2 different players so they do not affect each other.
Kenoli showed a good example how to split up a trigger using switches (a method I've named Web Triggering). Now all of those triggers execute for 1 player, but what if you made one of them execute for a different player instead?
Let's say we want to create a zergling every two second and a hydralisk every five. Now other than using messy and complicated DCs (Death Counters), let's use our Web Trigger method.

Trigger
Players:
¤ Player 2

Conditions:
¤ Always

Actions:
¤ Create 1 Zerg Zergling at location "Spawn" for Player 1
¤ Wait 2000 milliseconds
¤ Preserve Trigger


Trigger
Players:
¤ Player 1

Conditions:
¤ Always
¤ Switch 1 is CLEAR

Actions:
¤ Create 1 Zerg Hydralisk at location "Spawn" for Player 1
¤ SET Switch 1
¤ Preserve Trigger


Now look carefully at the player of this next one.

Trigger
Players:
¤ Player 2

Conditions:
¤ Switch 1 is SET

Actions:
¤ Wait 5000 milliseconds
¤ CLEAR Switch 1
¤ Preserve Trigger


As you can see, both wait times won't affect each other, and you get the affect you desire.
If you need more help or perhaps an Example Map simply ask.
(user posted image)
Top

Post #6     Oo.HavoK.oO Nov 2 2007, 5:11 am

[Avatar]
 offline contact
Quote from AkarSwitches are fairly simple to understand, they work like a light switch. There is an ON, and an OFF. Those are the only 2 positions. Now if you walk a room after you've been gone the lights are usually off right? Well the same principle works with maps. The switch will be in the off position when you start it. StarEdit refers to OFF as CLEAR, and ON as SET.
Now realizing that little tidbit, how about I show you some practical uses:

1. Halting Preserve Trigger.

This generally works by having that when the switch is SET, the trigger will run, however, if the switch is put into the CLEAR position, the trigger will not run:
Trigger
Players:
¤ Player 1

Conditions:
¤ Always
¤ Switch1 is SET

Actions:
¤ Create 1 Terran Marine at location "Marine Spawn"
¤ Preserve Trigger


Now if we were to turn it off all you would have to do is:

Trigger
Players:
Player 1

Conditions:
¤ Player 1 commands 0 Marine Spawner
¤ Switch1 is SET

Actions:
¤ CLEAR Switch1
¤ Preserve Trigger



2. Separating Wait Blocks.

When you have 2 waits that you want to run at the same time there is a dilemma, you must wait for one to complete before you allow the other one to even begin.
However, the wait block only applies for that one type of player. So what we need to do is make the 2 wait times execute for 2 different players so they do not affect each other.
Kenoli showed a good example how to split up a trigger using switches (a method I've named Web Triggering). Now all of those triggers execute for 1 player, but what if you made one of them execute for a different player instead?
Let's say we want to create a zergling every two second and a hydralisk every five. Now other than using messy and complicated DCs (Death Counters), let's use our Web Trigger method.

Trigger
Players:
¤ Player 2

Conditions:
¤ Always

Actions:
¤ Create 1 Zerg Zergling at location "Spawn" for Player 1
¤ Wait 2000 milliseconds
¤ Preserve Trigger


Trigger
Players:
¤ Player 1

Conditions:
¤ Always
¤ Switch 1 is CLEAR

Actions:
¤ Create 1 Zerg Hydralisk at location "Spawn" for Player 1
¤ SET Switch 1
¤ Preserve Trigger


Now look carefully at the player of this next one.

Trigger
Players:
¤ Player 2

Conditions:
¤ Switch 1 is SET

Actions:
¤ Wait 5000 milliseconds
¤ CLEAR Switch 1
¤ Preserve Trigger


As you can see, both wait times won't affect each other, and you get the affect you desire.
If you need more help or perhaps an Example Map simply ask.


Thanks, but how come when I try this... It doesn't work... This is what I did...

TRIGGER 1:

-Players:
Player 1

-Conditions:
Switch 1 is Cleared

-Actions:
Create 1 unit for player 1
Wait 500 milliseconds
Preserve Trigger

TRIGGER 2:

-Players
Player 1

-Conditions:
Player 1 bring one unit to...

-Actions:
Switch 1 is Set
Preserve Trigger

TRIGGER 3:

-Players:
Player 1

-Conditions:
Player 1 brings exactly 0 units to location

-Actions:
Switch 1 is Cleared
Preserve Tigger
(user posted image)
Top

Post #7     Oo.HavoK.oO Nov 2 2007, 5:13 am

[Avatar]
 offline contact
Also... How do u make a Randomize Switch... My friend Oo.Twitch.oO @ USEeast said that each switch has a probability of 2 or 4, I can't remember exactly what he said, lol! :D
(user posted image)
Top

Post #8     Oo.Twitch.oO Nov 2 2007, 5:53 am

[Avatar]
Person Of All Kinds
 offline contact
Quote from HavoKAlso... How do u make a Randomize Switch... My friend Oo.Twitch.oO @ USEeast said that each switch has a probability of 2 or 4, I can't remember exactly what he said, lol! :D

No No No
I said the switches have a combo of 2 usally.AlSo you have to get them all figured out.
meaning if switch 1 randomized
u say
c:
switch 1 set

a:
create marine
presrve

c:
switch e cleared

a:
create medic
presrve


More info can be in that map I gave you :P .
Top

Post #9     Akar Nov 2 2007, 1:36 pm

[Avatar]
Peaceful Warrior
 offline contact
You're in luck with randomizing my friend.
I don't have time to help you with your trigger now, but I'll take a deeper look at it later.
Attachments:
scm file
Example - Randomization.scm (39.57 kb)
0 hits.
(user posted image)
Top

Post #10     who Nov 2 2007, 9:38 pm

[Avatar]
someone09
 offline contact
It's simply a lot of randomized switches:
if you wanted some combinations, then it would be something like this:

C:
P1 brings 1 civ to randomize
Switch 1 is clear
A:
Move civ to reset
Set Switch 1

C:
Switch 1 is set
Switch 2 is clear
A:
Clear Switch 2
Randomize Switch 10
Randomize Switch 11
Randomize Switch 12

C:
Switch 1 is set
Switch 10 is set
Switch 11 is set
Switch 12 is set
A:
Clear Switch 1
Create marine at spawn

C:
Switch 1 is set
Switch 10 is set
Switch 11 is set
Switch 12 is clear
A:
Clear Switch 1
Create medic at spawn

C:
Switch 1 is set
Switch 10 is set
Switch 11 is clear
Switch 12 is clear
A:
Clear Switch 1
Create bc at spawn

C:
Switch 1 is set
Switch 10 is clear
Switch 11 is clear
Switch 12 is clear
A:
Clear Switch 1
Create firebat at spawn

... and so on.
lets say we had 1 as set, and 0 as cleared. Since 3 switches are randomized, all of the combos would be like this:

111
110
101
100
011
010
001
000
(user posted image)
Top

Post #11     Akar Nov 3 2007, 6:15 am

[Avatar]
Peaceful Warrior
 offline contact
Would you by chance saying 1 anyunit?
If so is there a beacon owned by player 1 in that location?
(user posted image)
Top

Post #12     who Nov 3 2007, 3:01 pm

[Avatar]
someone09
 offline contact
Nope, just tested using anyunit, it doesn't create a unit.
(user posted image)
Top

Post #13     Akar Nov 3 2007, 7:28 pm

[Avatar]
Peaceful Warrior
 offline contact
I was asking for the conditional statement.
(user posted image)
Top
0 members in this topic: None
+ 0 guest(s)


[03:03 pm]
chuiu -- thats not an opinion, they really are a crappy band
[02:52 pm]
NerdyTerdy -- learn to state your opinions as such, rather than facts
[02:40 pm]
chuiu -- fusetv*
[02:39 pm]
chuiu -- that and its the mtv website, spears is going to win
[02:38 pm]
chuiu -- linkin park is a crappy band
[01:21 pm]
[01:09 pm]
Obama.Paravin. -- Hoyl shit, mafia clan is now Obama. I <3 Obama. :3
You must log in to shout.

©2003-2008 Staredit Network.
Starcraft & Starcraft II are trademarks of Blizzard Entertainment.
Site Index   |   Terms of Service   |   Privacy Policy   |   Contributions