i dont understand how variables work be cause last created blah blah doesn't work to well (im using a timer and it doest work) how could i assign a variable to a timer or dialog or a unit created with triggers and i made a global variable that i could get to what are the limitations of local/global variables."thats variables"
ok compiling my trigger count i have a simple trigger create dialog / button blah blah do i have to make a new trigger to run a trigger when that button is pressed cause then i will have like 80 triggers for just a hero selection and so on
Create a Timer variable. Then in your trigger, after you make the timer, use "Set Variable" to set your Timer variable to "Last Created Timer". Use similar methods to assign variables of any type of object that you create during runtime - Dialog item: "Set Variable - Blah = Last Created Dialog Item"; etc.
If you're going to create a lot of stuff during runtime and you want to save them to variables, you're going to be using "Last Created" things a lot.
Local variables are variables assigned to specific triggers, and only exist for the duration of that trigger. No other trigger can access them, and they disappear as soon as their parent trigger finishes running. Global variables, however, can be accessed from any trigger at any time, and they retain their value for the duration of the map.
thx that really helped um does the global variable have to be specific type to work for a action that uses that type?
because i had a game and i had a global variable it was a unit type i selected zealot as the unit so just zealot in general was the global variable and i wanted to have a trigger kill a zealot at triggering point with a condition of triggering unit = zealot but i could only selected values on the map and my variable wasn't showing up.
A global variable can only work with functions or triggers that work with that type of variable. For example, the Text Message trigger will create a text message on a player's screen from a Text value. You cannot pass, say, a Region variable to this trigger, because Region and Text are two completely different types of variables.
"Unit Type is UnitTypeVariable == true" would be what the variable would look like, replacing UnitTypeVariable with whatever variable you are using. When Choosing the value for the UnitTypeVariable, there is a row of buttons along the top of the window named Functions, Presets, Variables, etc. Choose the one that says Variables, and your variable should appear.
Unless you are writing in Galaxy code (and maybe not even then), you shouldn't have any problem at all with compiling. The editor should take care of it for you.
You can setup multiple events in one trigger, then it will fire off when any of them occurs.
As for dialogs, use event "any dialog item is used". Then you can specify condition "dialog containing used dialog item == your dialog variable". Then in actions you can put switch depending on used dialog item (to take different actions depending on used button).
thanks guys. Add on question:i have a trigger and i dont under stand why it doesn't work "down blow"
Events:Map initialization
local variables:Ping timer = (Last started timer)<Timer>
Actions:Ping the mini-map at (point 001) for (all players) over 20 seconds using color "white"
Timer-Start (new timer) as a one shot timer that will expire in 12 real time seconds
Timer-create a timer window for ping timer with title "End of Ping!" using remaining time (initially visible)
P.S no conditions
help i dont know whats wrong the window shows up with the timer but its starts at 0 and doesn't do anything
Add on question:how do i make some sort of a randomizer hmm what will be my example oh i have 6 text tags label 1,2,3,4,5,6 how can i be at map inzialtion display test tag but it wont be one it will be at random help?
thanks guys. Add on question:i have a trigger and i dont under stand why it doesn't work "down blow"
Events:Map initialization local variables:Ping timer = (Last started timer)<Timer> Actions:Ping the mini-map at (point 001) for (all players) over 20 seconds using color "white" Timer-Start (new timer) as a one shot timer that will expire in 12 real time seconds Timer-create a timer window for ping timer with title "End of Ping!" using remaining time (initially visible)
P.S no conditions
help i dont know whats wrong the window shows up with the timer but its starts at 0 and doesn't do anything
You need to create a timer before you can do anything with it. Creating a timer variable doesn't create the timer itself - it just acts as a placeholder for timer objects should you need to access them later.
Add on question:how do i make some sort of a randomizer hmm what will be my example oh i have 6 text tags label 1,2,3,4,5,6 how can i be at map inzialtion display test tag but it wont be one it will be at random help?
Events: Map initialization
Local variables: Ping timer = (Last started timer)<Timer>
Actions: Ping the mini-map at (point 001) for (all players) over 20 seconds using color "white"
Timer-Start (new timer) as a one shot timer that will expire in 12 real time seconds
Timer-create a timer window for ping timer with title "End of Ping!" using remaining time (initially visible)
1. Change Ping Timer = (Last Started Timer) to (New Timer)
2. Change Timer-Start (New Timer) to (Ping timer) (the variable you made)
i dont understand how variables work be cause last created blah blah doesn't work to well (im using a timer and it doest work) how could i assign a variable to a timer or dialog or a unit created with triggers and i made a global variable that i could get to what are the limitations of local/global variables."thats variables"
ok compiling my trigger count i have a simple trigger create dialog / button blah blah do i have to make a new trigger to run a trigger when that button is pressed cause then i will have like 80 triggers for just a hero selection and so on
@aczchef: Go
Create a Timer variable. Then in your trigger, after you make the timer, use "Set Variable" to set your Timer variable to "Last Created Timer". Use similar methods to assign variables of any type of object that you create during runtime - Dialog item: "Set Variable - Blah = Last Created Dialog Item"; etc.
If you're going to create a lot of stuff during runtime and you want to save them to variables, you're going to be using "Last Created" things a lot.
Local variables are variables assigned to specific triggers, and only exist for the duration of that trigger. No other trigger can access them, and they disappear as soon as their parent trigger finishes running. Global variables, however, can be accessed from any trigger at any time, and they retain their value for the duration of the map.
I hope I understood the question correctly...
thx that really helped um does the global variable have to be specific type to work for a action that uses that type?
because i had a game and i had a global variable it was a unit type i selected zealot as the unit so just zealot in general was the global variable and i wanted to have a trigger kill a zealot at triggering point with a condition of triggering unit = zealot but i could only selected values on the map and my variable wasn't showing up.
Bump anything about complinig?
@aczchef: Go
A global variable can only work with functions or triggers that work with that type of variable. For example, the Text Message trigger will create a text message on a player's screen from a Text value. You cannot pass, say, a Region variable to this trigger, because Region and Text are two completely different types of variables.
"Unit Type is UnitTypeVariable == true" would be what the variable would look like, replacing UnitTypeVariable with whatever variable you are using. When Choosing the value for the UnitTypeVariable, there is a row of buttons along the top of the window named Functions, Presets, Variables, etc. Choose the one that says Variables, and your variable should appear.
Unless you are writing in Galaxy code (and maybe not even then), you shouldn't have any problem at all with compiling. The editor should take care of it for you.
I meant making less triggers to do one function
So i have a trigger create a dialog with 6 buttons do i have to create 6 more tiggers for each button or all in one trigger or just 2
You can setup multiple events in one trigger, then it will fire off when any of them occurs.
As for dialogs, use event "any dialog item is used". Then you can specify condition "dialog containing used dialog item == your dialog variable". Then in actions you can put switch depending on used dialog item (to take different actions depending on used button).
One trigger for the dialog creation, another for the clicks. Try using a switch function, or just an if-then-else.
thanks guys. Add on question:i have a trigger and i dont under stand why it doesn't work "down blow"
Events:Map initialization local variables:Ping timer = (Last started timer)<Timer> Actions:Ping the mini-map at (point 001) for (all players) over 20 seconds using color "white" Timer-Start (new timer) as a one shot timer that will expire in 12 real time seconds Timer-create a timer window for ping timer with title "End of Ping!" using remaining time (initially visible)
P.S no conditions
help i dont know whats wrong the window shows up with the timer but its starts at 0 and doesn't do anything
Add on question:how do i make some sort of a randomizer hmm what will be my example oh i have 6 text tags label 1,2,3,4,5,6 how can i be at map inzialtion display test tag but it wont be one it will be at random help?
You need to create a timer before you can do anything with it. Creating a timer variable doesn't create the timer itself - it just acts as a placeholder for timer objects should you need to access them later.
Math - Random Integer between 1 and 6.
the timer is the first thing i made i really dont understand
Bump
Bump read all comments by me for add on questions please
1. Change Ping Timer = (Last Started Timer) to (New Timer)
2. Change Timer-Start (New Timer) to (Ping timer) (the variable you made)
tried that and it didn't work...
@aczchef: Go
Your timer variable needs to be global, timers dont work locally
EDIT: make the changes they said too
weird well thx ill try it out
it worked thx
that is not in the trigger action list