I have a multiplayer map and I noticed I've been using a bit of the Trigger - Turn Trigger On/Off. These actions would effect all players, correct? How would I set the trigger up so that the trigger only toggles on/off for the triggering player? Is it possible?
Yes as they have to execute deterministically. Turning it "off" on one client and leaving it "on" on the others will cause an out of sync game split.
Quote:
How would I set the trigger up so that the trigger only toggles on/off for the triggering player? Is it possible?
It is impossible as it violates the cross-client determinism and certainly not something you want to ever purposely do anyway. In WC3 it was possible using the GetLocalPlayer native which returned the player the client was running when called (different for each client) however SC2 has no such equivalent as far as I can tell.
Are you sure you could not leave the trigger on and simply filter inappropriate players marked as "off"? This would be as simple as adding all players which it is "on" for into a player group and then checking in a condition if the triggering player is inside the player group. When you want it to no longer run for a certain player you remove them from the player group. If the player group is empty then you turn the trigger off to save resources (as it will still generate events and run galaxy code unless turned off).
There is also such a thing as 'Action Definitions' which basically run like any other action, with input parameters.
To Use one, right click under your list of triggers, go to 'New >' and go to new action definition. From there, configure what kind of parameters you want, which are basically like variables that work for this specific action. Then you go to the trigger you want to call the action, find your action in the action list and put it in. In the ( ), you put your parameters you want to pass off to the action.
Unit - Create 1 Unit for player Triggering Player at Spawn facing 270.0 degrees (No Options)
And this is your trigger:
Quote:
Make Marine for player
Events
Local Variables
Conditions
Actions
Spawn Marine(1, Marine)
Spawn Marine(2, Ghost)
Spawn Marine(3, Banana)
In this example, the trigger (named 'make marine for player') spawns a marine for player 1, a ghost for player 2, and a banana for player 3.
In the ( ), I have an Integer and a Unit Type as the parameters, so to call it, I put the player number in for the integer and a unit type in for the unit, and the action will create that unit for that player.
You can of course, use this to pass 'triggering player' to an action, which would act like a trigger just for that player.
Starcraft2 mapping is an art. It is inspired by the soul and crafted from within and brought out, but not all artists have the skills to create it, which is why I need data/trigger editors. Come find me if you want to be part of something great.
To post a comment, please login or register a new account.
I have a multiplayer map and I noticed I've been using a bit of the Trigger - Turn Trigger On/Off. These actions would effect all players, correct? How would I set the trigger up so that the trigger only toggles on/off for the triggering player? Is it possible?
Yes as they have to execute deterministically. Turning it "off" on one client and leaving it "on" on the others will cause an out of sync game split.
It is impossible as it violates the cross-client determinism and certainly not something you want to ever purposely do anyway. In WC3 it was possible using the GetLocalPlayer native which returned the player the client was running when called (different for each client) however SC2 has no such equivalent as far as I can tell.
Are you sure you could not leave the trigger on and simply filter inappropriate players marked as "off"? This would be as simple as adding all players which it is "on" for into a player group and then checking in a condition if the triggering player is inside the player group. When you want it to no longer run for a certain player you remove them from the player group. If the player group is empty then you turn the trigger off to save resources (as it will still generate events and run galaxy code unless turned off).
@ImperialGood: Go
This helped a lot, thank you!
I'm going to get started on trying to do this.
There is also such a thing as 'Action Definitions' which basically run like any other action, with input parameters.
To Use one, right click under your list of triggers, go to 'New >' and go to new action definition. From there, configure what kind of parameters you want, which are basically like variables that work for this specific action. Then you go to the trigger you want to call the action, find your action in the action list and put it in. In the ( ), you put your parameters you want to pass off to the action.
Here's an example:
This is your action definition
And this is your trigger:
In this example, the trigger (named 'make marine for player') spawns a marine for player 1, a ghost for player 2, and a banana for player 3. In the ( ), I have an Integer and a Unit Type as the parameters, so to call it, I put the player number in for the integer and a unit type in for the unit, and the action will create that unit for that player.
You can of course, use this to pass 'triggering player' to an action, which would act like a trigger just for that player.