So I've been using find and replace a lot when copying triggers, especially when I need to copy a set of triggers for each player. I've been able to find and replace parameter values such as replacing one region with another and switching one variable out with another. My problem is that I can't seem to figure out how to replace the player number.
I want to be able to replace Player 1, with Player 2 with one fell swoop...
-Unit - Create 1 Ghost for player 1 at (Center of Team1Spawn) using default facing (No Options)
-Variable - Set P1 = (Last created unit)
-Unit Selection - Select (Last created unit) for player 1
-Unit Group - Add all units in (Any units in Team1Spawn owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) to P1CamGroup
-Variable - Set P1alive = true
-Camera - Follow for player 1 P1CamGroup with the camera and Clear Current Target
Well, player numbers are integers, unfortunately, so if you want to replace all player 1s and 2s you probably have to go through carefully using the "find next" and not the "replace all", unless you don't have any other 1s in your trigger that are integers.
What you want to do is create a player group variable and a player ID variable (int). Set the player id value to 1 for player one and set the player group value to function "convert player to player group". In the player value, put in the player ID variable.
In many events such as key presses, you can't simply plug in a "1" value, for the player. Instead you have to use "player from player group". For player group plug in the player group variable you created earlier and leave it set to player 1 (this never changes).
Plug your int value wherever a player number is asked for. Between these 2 variables you should never have to put a value for a player, always use one of these two variables.
Isolate all your player specific triggers into one folder including the 2 variables you made above, the player group and the int value (of the player number). Now just copy and paste that folder for every player in the game. Because the player group is linked to the player int value, just change the value of the int and everything should update to be for the new player id number.
So I've been using find and replace a lot when copying triggers, especially when I need to copy a set of triggers for each player. I've been able to find and replace parameter values such as replacing one region with another and switching one variable out with another. My problem is that I can't seem to figure out how to replace the player number.
I want to be able to replace Player 1, with Player 2 with one fell swoop...
-Unit - Create 1 Ghost for player 1 at (Center of Team1Spawn) using default facing (No Options) -Variable - Set P1 = (Last created unit) -Unit Selection - Select (Last created unit) for player 1 -Unit Group - Add all units in (Any units in Team1Spawn owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) to P1CamGroup -Variable - Set P1alive = true -Camera - Follow for player 1 P1CamGroup with the camera and Clear Current Target
Is this possible? Any help is appreciated. (=
@Southpaw444:
Well, player numbers are integers, unfortunately, so if you want to replace all player 1s and 2s you probably have to go through carefully using the "find next" and not the "replace all", unless you don't have any other 1s in your trigger that are integers.
@Graagh56: Go
I see, thank you for the input.
I just tried it, it works great!! Thanks for pointing that out, it's gonna save me tons of time. :D
What you want to do is create a player group variable and a player ID variable (int). Set the player id value to 1 for player one and set the player group value to function "convert player to player group". In the player value, put in the player ID variable.
In many events such as key presses, you can't simply plug in a "1" value, for the player. Instead you have to use "player from player group". For player group plug in the player group variable you created earlier and leave it set to player 1 (this never changes).
Plug your int value wherever a player number is asked for. Between these 2 variables you should never have to put a value for a player, always use one of these two variables.
Isolate all your player specific triggers into one folder including the 2 variables you made above, the player group and the int value (of the player number). Now just copy and paste that folder for every player in the game. Because the player group is linked to the player int value, just change the value of the int and everything should update to be for the new player id number.