I currently have a scenario set up where a unit is unmanned. How would I go about triggering an event when someone 'mans' it?
EDIT: Keep in mind that this map will be used in multiplayer, and therefore will need scripts that are multiplayer friendly.
Posted by: VTULCobra - Wednesday, February 8, 2012 3:33:54 AM
If a human player is entering it then use this script:
[code]*** IF ***
Unit 'whatyounamedyourunit' is owned by Player 'player0'
*** THEN ***
Enable your event.
[/code]
The "player0" is human slot 1 in the lobby and "player1" is human slot 2 in the lobby, I learned that from a few people here.
Posted by: NewNightmare - Wednesday, February 8, 2012 11:03:47 AM
is the 'event' player related ? like you get a building as a bonus? or just like 'a weird cash drop appears' ??
It depends, you can make an originally disabled script (scriptX) and use the mention code to enable it.
[code]*** IF ***
Unit 'whatyounamedyourunit' is owned by Player 'player0'
*** THEN ***
Enable scriptX.[/code]
Now, depending on your type of event, you can go
[code]*** IF ***
Unit 'whatyounamedyourunit' is owned by Player 'player0'
OR
Unit 'whatyounamedyourunit' is owned by Player 'player1'
OR
Etc..
*** THEN ***
Enable scriptX.[/code]
[/code]
Or you have to go
[code]*** IF ***
Unit 'whatyounamedyourunit' is owned by Player 'player0'
*** THEN ***
Enable scriptX0.
*** IF ***
Unit 'whatyounamedyourunit' is owned by Player 'player1'
*** THEN ***
Enable scriptX1.[/code]
Etc, and make scripts for each player. you might also have to add a disable script option, so the event does not re-appear when you e.g. re-capture the unit with a Hijacker.
Simply add
[code]
Disable 'Name of the trigger script1'
Disable 'Name of the trigger script2'
Etc. [/code]
at the end of the ***THEN*** path. Ofc with a slight change in names each time.