Page 1 of 1

can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 11:53 am
by frankie_tang
It's going to be a defense map, I want your opinon, and I need some help as well, the question is; how am i going to set the levels up?

There is going to be 28 rounds/levels/waves of enemy units that Force 1 has to defend against. . . I need help on developing the triggers to start each round and keep it going from there... does anybody have any idea on what i should do? The whole idea of it makes my head spin. . .

Re: can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 12:17 pm
by Lavarinth
Switches will be your life saver.

Before attempting to explain them, do you know what they are or how they work?

Re: can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 12:29 pm
by frankie_tang
no, could you help me out here?
I have no idea how  to use switches ><

Re: can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 1:29 pm
by Lavarinth
Alright, switches are viewable under the Condition "SWITCH" and the Action "SET SWITCH."

A switch is basically an indicator for StarCraft to know "if this then that." Example: "If Switch 'Wave 1' is enabled and Switch 'All enemy units dead' is enabled then enable 'Wave 2'." Of course that's just an example, it's not how easily it works.

We'll make an example of a fictional map to introduce how to really do it, maybe this alone will help.

First we need to create the switches the disable them, simply as a precaution. You'll note when you enter the Switches pop-up window, you have various options such as "Enable, Disable, Toggle, Random" and a selection of switches in a drop down menu as well as the Rename option.

We'll create our first trigger, for a map that will have three waves. In this scenario, Player 1 will be the defender, Player 2 will be the computer AI.

Our first trigger:

Players:
- Player 2
Condition:
- (ELAPSED TIME) Elapsed scenario time is at least 0 game seconds.
Action:
- (SET SWITCH) Clear 'Enemy Clear' (I renamed 'Switch 1' to 'Enemy Clear' and selected Clear as the setting in the pop up the same will follow with Switch 2, Switch 3, etc.)
- (SET SWITCH) Clear 'Wave 1 End'
- (SET SWITCH) Clear 'Wave 2 End'
- (SET SWITCH) Clear 'Wave 3 End'
- (SET SWITCH) Clear 'Start Waves'

Okay, now that our switches for our three wave map is set, I wanted to give players 30 seconds to prepare, so I created a Start Waves trigger as well. This, is optional, create everything as you please, again this is just to give you an idea of how switches work.

I now want to create a trigger that, as soon as the map starts, creates a countdown and when the countdown finishes, will make the waves start. I will make this for all players as I want all players playing to be able to see the countdown.

Players:
- All Players
Condition:
- (ELAPSED TIME) Elapsed scenario time is at least 0 game seconds.
Action:
- (SET COUNTDOWN TIMER) Modify Countdown Timer: Set to 30 seconds.
- (WAIT) Wait for 30000 milliseconds. (1000 milliseconds = 1 second)
- (SET SWITCH) Set 'Start Waves'

Now that I have triggered Start Waves to be set, also known as On, enabled, etc. I can create a trigger that initiates the first wave. I want text to display it is the first wave as well. I will have two separate triggers, one for the players (Force 1 will be my players) and one for the enemy wave (Player 2, my computer AI)

Players:
- Force 1
Condition:
- (SWITCH) 'Start Waves' is set.
Action:
- (DISPLAY TEXT MESSAGE) "WAVE 1 - 10 ZERGLINGS"

And now to create the enemies, and have them go from location "START" to location "END."
Players:
- Player 2
Condition:
- (SWITCH) 'Start Waves' is set.
Action:
- (CREATE UNIT) Create 10 Zerg Zergling at 'START' for Player 2. (Instead of Player 2, 'this player' is also an option since we have only Player 2, the AI, selected. Otherwise, if it was two players, or a force, it would create them for all of them.)
- (WAIT) Wait for 100 milliseconds. (Just a precaution so that all units are created.)
- (ORDER) Issue order to all any unit owned by Player 2 at 'START': Move to 'END'.

Alright, with this set, the Zerglings will now move towards the end location.

Now, I'll make a trigger that tells the map to start the next phase when the first wave ends. I'll use Player 2, the AI, again. I am using the Switch set again as a condition so that it will not spawn the next wave simply because there are no Zerglings when the map starts.

Players:
- Player 2
Condition:
- (SWITCH) 'Start Waves' is set.
- Player 2 commands exactly 0 Zerg Zergling.
Action:
- (SWITCH) 'Wave 1 End' is set.

This'll trigger the following triggers:

Players:
- Force 1
Condition:
- (SWITCH) 'Wave 1 End' is set.
Action:
- (DISPLAY TEXT MESSAGE) "WAVE 2 - 10 HYDRALISKS"

Players:
- Player 2
Condition:
- (SWITCH) 'Wave 1 End' is set.
Action:
- (CREATE UNIT) Create 10 Zerg Hydralisks at 'START' for Player 2.
- (WAIT) Wait for 100 milliseconds.
- (ORDER) Issue order to all any unit owned by Player 2 at 'START': Move to 'END'.

As you can see, it's sort of rinse in repeat from here on out:

Players:
- Player 2
Condition:
- (SWITCH) 'Wave 1 End' is set.
- Player 2 commands exactly 0 Zerg Hydralisk.
Action:
- (SWITCH) 'Wave 2 End' is set.

Players:
- Force 1
Condition:
- (SWITCH) 'Wave 2 End' is set.
Action:
- (DISPLAY TEXT MESSAGE) "WAVE 3 - 10 ULTRALISK"

Players:
- Player 2
Condition:
- (SWITCH) 'Wave 2 End' is set.
Action:
- (CREATE UNIT) Create 10 Zerg Ultralisk at 'START' for Player 2.
- (WAIT) Wait for 100 milliseconds.
- (ORDER) Issue order to all any unit owned by Player 2 at 'START': Move to 'END'.

Players:
- Player 2
Condition:
- (SWITCH) 'Wave 2 End' is set.
- Player 2 commands exactly 0 Zerg Ultralisk.
Action:
- (SWITCH) 'Wave 3 End' is set.

And that's the basis of switches. Any questions?

Re: can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 2:13 pm
by frankie_tang
THANKS A MILLION!
Helped me a lot! i gave you PIE xD

Re: can somebody help me with my map? [triggers]

Posted: Sat Jan 02, 2010 2:22 pm
by Lavarinth
Haha, thanks. Glad I could help.