Can I attach a variable to a folder? Mine situation is: i'm making triggers which use variables "player" and "nydus", which depend on player. So i want make triggers for red player, and then copy them into another folder and just change variables.
I'm not exactly sure what you're asking, but I'll try to answer anyway.
A folder doesn't actually do anything, it's just there to keep things more organised. Any gloabl variables you create in a folder will automatically be useable in any other folder.
What do you mean by a folder? You may call a variable from any folder no matter where the trigger is. This is why it is called a "global" variable.
If you wish to make a variable that is different for each player I would personally make a single variable that has an array that is size 16. It would be a lot easier than making a variable for each player, if that is what you were considering doing.
I apologize if I misunderstood but your question was sort of hard to understand.
I have event in each trigger - player(variable) presses button...
Player=1
When I finish all triggers (which I need for player 1), I'll copy them, to make them for player 2. But i planned just change variable "player" to 2, but global variable is ignoring folders, so how can I make something as I want?
do the buttons do different things for each player?
If its the same, just do the event for any player, and then when you need to assign something to that player inside the trigger, use the function TriggeringPlayer.
If this isnt applicable, please disregard :D
EDIT: This is from one of my maps and should show what i mean
Unlock-ProtossAir2EventsDialog-AnyDialogItemisusedbyPlayerAnyPlayerwitheventtypeClickedLocalVariablestrigplayerasgroup=(Playergroup((Triggeringplayer)))<PlayerGroup>Conditions(Useddialogitem)==Buttons[UnlockProtossAir2]ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAvailableUnlocks[(Triggeringplayer)]>=1ThenEnableButtonUnit((Triggeringplayer),Carrier)EnableButtonResearch((Triggeringplayer),ProtossShields3)EnableButtonResearch((Triggeringplayer),ProtossAirAttack3)EnableButtonResearch((Triggeringplayer),ProtossAirArmour3)EnableButtonResearch((Triggeringplayer),FluxVanes)EnableButtonResearch((Triggeringplayer),GravitonCatapult)ElseUI-Display"You do not have any available unloc..."fortrigplayerasgrouptoErrorarea
Is it possible to make variable in one place, and then use it in many of triggers, so i won't need to make same variables in each trigger?
@Swifteg: Go
Of course, just make a variable outside of the trigger, it will be created and listed in the same place as your triggers are.
@DarkShape80: Go
Thanks!
Hmm, now another question:
Can I attach a variable to a folder? Mine situation is: i'm making triggers which use variables "player" and "nydus", which depend on player. So i want make triggers for red player, and then copy them into another folder and just change variables.
Is it possible? Thanks.
I'm not exactly sure what you're asking, but I'll try to answer anyway.
A folder doesn't actually do anything, it's just there to keep things more organised. Any gloabl variables you create in a folder will automatically be useable in any other folder.
To learn more about variables there's a wonderfull tutorial here on mapster: http://forums.sc2mapster.com/development/tutorials/2051-beginners-guide-to-triggers-variables-arrays-constants/
@Swifteg: Go
What do you mean by a folder? You may call a variable from any folder no matter where the trigger is. This is why it is called a "global" variable.
If you wish to make a variable that is different for each player I would personally make a single variable that has an array that is size 16. It would be a lot easier than making a variable for each player, if that is what you were considering doing.
I apologize if I misunderstood but your question was sort of hard to understand.
Ok, in example:
I have event in each trigger - player(variable) presses button...
Player=1
When I finish all triggers (which I need for player 1), I'll copy them, to make them for player 2. But i planned just change variable "player" to 2, but global variable is ignoring folders, so how can I make something as I want?
@Swifteg: Go
do the buttons do different things for each player?
If its the same, just do the event for any player, and then when you need to assign something to that player inside the trigger, use the function TriggeringPlayer.
If this isnt applicable, please disregard :D
EDIT: This is from one of my maps and should show what i mean
@DarkShape80: Go
Thanks again! But same thing i wanted to do with cargo unit.
Example:
So each player has nydus. So again - i planned to change nydus variable in dependence of player. Is there an alternative of mine idea?
@Swifteg: Go
Is this nydus very central for your map? meaning players start with 1 each, and it exists until they lose? If they only ever have 1, its real easy.
If this is correct, the following should work:
Another way would be to use an array variable, with each players nydus in their respective 'slot'
If thats not correct, let me know and im sure I can throw together an example that pertains to your problem.
@DarkShape80: Go
Which function is it??
@Swifteg: Go
start with Unit from Unit Group, then on the fly create your unit group with Units in Region Matching Condition
@DarkShape80: Go
Huge thanks! :)