Wednesday, April 18, 2012

Simple Problem HELP

im new to the W3 editor, looks tough compared to SC which i used a lot for UMS.

How do I make it so that if Player 2 isn't in the game when it starts his units don't spawn on the board when the game starts?

Thanks

Shek|||Events:

Map initialization

Conditions:

Player 2 (blue) slot status equal to is playing equal to true

Actions:

Unit - Create 1 unit#1 at location#1

Unit - Create 1 unit#2 at location#2

etc

etc

If you need a more complicated trigger, like for all players, I'm happy to help further|||Say I wanted to place units for them on the map before i load triggers, is there a way to make those disappear when the game begins.|||Yes.

First you put the units you (may) want to remove in a Unit Group. Do this by:

Events:

Map Initialization

Conditions:

Actions:

Unit Group - Add Unit #1 to <MyUnitGroupVariable>

Unit Group - Add Unit #2 to <MyUnitGroupVariable>

___________________________________________

Then, in a second trigger you could do:

Events:

Elapsed Game time equal to 1.00 seconds

Conditions:

Player 2 (blue) slot status equal to playing equal to false

Actions:

Unit Group - Pick every unit in <MyUnitGroupVariable> and do Actions:

Loop - Actions: Remove Picked Unit from the game.

_____________________________________________

Or you could do it all in one trigger:

Events:

Map Initialization

Conditions:

Actions:

Unit Group - Add Unit #1 to <MyUnitGroupVariable>

Unit Group - Add Unit #2 to <MyUnitGroupVariable>

If / Then / Else:

If Player 2 (blue) slot status equal to playing equal to false

Then:

Unit Group - Pick every unit in <MyUnitGroupVariable> and do Actions:

Loop - Actions: Remove Picked Unit from the game.

Else:

Do Nothing

You're welcome|||Although Firetruck's way will work, it will get annoying if there's a lot of units on the map, or if you're often changing them. A better way is this:


Code:
Events:
Map Initialization
Conditions:
Actions:
If / Then/ Else, Multiple Functions:
If Player 2 (Blue) slot status Equal to Is unused
Then:
Custom Script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in Units owned by Player 2 (Blue) and do Actions:
Unit - Remove (Picked Unit)
Else Actions:
Do Nothing (Or just put nothing at all in Else)



The bj_wantDestroyGroup just prevents a unit group from leaking, you can find Custom Script near the top of the trigger actions list.

No comments:

Post a Comment