Help me!
Nov 1 2007, 8:43 pm
By: HavoK  

Nov 1 2007, 8:43 pm HavoK Post #1



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



None.

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



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:



None.

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



Quote
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
Here's a revised version of your trigger.
Quote
Conditions:
Player 1 brings exactly 1 Civilian to 'Location'.
Actions:
Preserve trigger.
Create 1 Marine at 'Spawn' for Player 1.
Wait 500ms.




None.

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



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.



None.

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



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.



    None.

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



    Quote from Akar
    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.

    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



    None.

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



    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



    None.

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



    Quote from HavoK
    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
    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.



    None.

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



    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:
    Example - Randomization.scm
    Hits: 0 Size: 39.57kb



    None.

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



    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



    None.

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



    Would you by chance saying 1 anyunit?
    If so is there a beacon owned by player 1 in that location?



    None.

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



    Nope, just tested using anyunit, it doesn't create a unit.



    None.

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



    I was asking for the conditional statement.



    None.

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [2024-4-27. : 9:38 pm]
    NudeRaider -- Ultraviolet
    Ultraviolet shouted: NudeRaider sing it brother
    trust me, you don't wanna hear that. I defer that to the pros.
    [2024-4-27. : 7:56 pm]
    Ultraviolet -- NudeRaider
    NudeRaider shouted: "War nie wirklich weg" 🎵
    sing it brother
    [2024-4-27. : 6:24 pm]
    NudeRaider -- "War nie wirklich weg" 🎵
    [2024-4-27. : 3:33 pm]
    O)FaRTy1billion[MM] -- o sen is back
    [2024-4-27. : 1:53 am]
    Ultraviolet -- :lol:
    [2024-4-26. : 6:51 pm]
    Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
    [2024-4-26. : 6:50 pm]
    NudeRaider -- Vrael
    Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
    sounds like moisture control is often a pressing concern in your city
    [2024-4-26. : 6:50 pm]
    Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
    [2024-4-26. : 6:49 pm]
    Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
    [2024-4-26. : 6:48 pm]
    Vrael -- On this Topic, I could definitely use some Introductions.
    Please log in to shout.


    Members Online: micahemurphy, DarkenedFantasies