with starcraft 2 beta I started to map and i downloaded a lot of maps. The trigger editor is not so hard to learn but I have a big problem with variables.
I dont kow anything about them! I saw tons of variables in many maps and the only thing i thought is WTF!!!
How do they work? What are they good for????? What do they do??????
I would be glad if somebody can help me or give me a tutorial!!!!!!!!!!!
Variables are just what they are when you program something, or even do a simple math problem (2+X=6 | X=4)
Variables are data stored as a name.
An example of a trigger:
Action - Create 1 Marine at location of barracks for player 1.
Action - Set Unit_Marine = last created unit.
Action - Remove Unit_Marine from the game
What happened there?
I created a marine with a trigger, simple right?
now I created a variable type unit named Unit_Marine, and I used an action to store the variable as that specific unit i created.
Then i removed the unit, instead of removing the last created unit, i simply removed the unit in the variable, which in this case is the exact same unit.
Say you want that unit removed far later in the game, but you have no way to refer to it, with a variable you can.
Variables dont just store units, they can store numbers, sounds, and much more.
To understand variables, you must resort to math.
Variables are simply something(symbols or letters) that represents something.
For example, Variable Y represents an unit. Instead of using Triggering Unit over and over again in a trigger, you set variable Y = Triggering Unit and use Y as the unit in your triggers instead. Variables are important because they stay as what you set them to be. Triggering Unit changes whenever your trigger goes off again because the event was met so your trigger messes up if there was a wait action involved. Variables also make your trigger much more readable and easier to understand and saves time if you need to use the same insanely long math function in your trigger repeatedly.
If you still don't understand what a variable is, first learn (or relearn which would be completely ...) simple algebra since computer and math logic is related then start on some wc3 trigger editing then play around with sc2.
everything u said sounds good except for playing with wc3 triggers first. hell, why not just go ahead and suggest some going back to 'basic / qbasic' programming then? maybe im a cynic though- :)
one thing to add though; when you call a function its slower / takes more processor than just calling a variable. so instead of using 'triggering unit' (even if you dont have to set it to a variable due to a wait tim interefering the 'triggering unit' with other triggers) by setting it to a variable and using the variable many times over instead of recalling the functions OVER and OVER of 'triggering unit' (this is a form of optimization)
heres an analogy;
say you have a trigger that using 'position of triggering unit' as a function. and it uses it like 10 times in the trigger. now humans, would think once, what is the position of the triggering unit? hmmm, its at location 101.34, 105.62. then every time we saw that we would automatically assume or know that the location is 101.34, 105.62 without having to relook at the actual position, as we just memorize it short term wise. but computers are only as smart as you make them. so every time you just use the function the computer is having to 'relook' at the location like its a fresh unit/ location every time you use it in the trigger, even though its the SAME one / position the whole time.
by setting it to a variable, you are putting it in computer memory so the computer doesnt have to run a function to determine the location of the triggering unit over and over in the same trigger. it will just know when it sees the variable TRIGUNITLOC (w/e you make it called) it will recall out of its memory instead of relooking at the unit location every time so its much faster and less work on your processor. its negligible to some extent, but with tons of triggers, especially with triggers ran on fast loops, it helps.
Now i know what a variable is. It is "thing" which stores information for some later actions. So far so good!
I also understand how you all describe variables but i´m still not in the shape to create variables whose request something or something like that.
Its about time (in my learn stage) to show me how they look like in the editor.
For sure I saw a couple of them in the maps i downloaded. But it was very confusing to me!
The best for Quick Success is to Play with Dialog Boxes to Build a own Interface, every Action is visible at the Screen.
Work with Timer
Let the Timer change Variables
Use the Variables in a Screen Image ... voila a own "Movie"
So you can simple Move Dialog Boxes etc. ...
I dont like variables but in sc2 its very easy and the editor is a big Tutorial playground.
This is the Tutorial i used for my first steps in sc2 editor.
Dialog Boxes are like Play Cards you put on a table.
Every new Dialog Box covers a older Box at the same Place. The Interface is nothing more (simple version) than many Cards at the Border (or in the middle but is not good to play ;) )
Create Dialog Boxes like in the Tutorial and create two variables as Integer (A and B) . Insteed of die Dialog Size (xxx,xxx) you use (Integer A, Integer B).
Now you have many ways
You can simple Modify the variables
You can use the Modify variable order
you can use a Timer loop in combination with the Modify order to resize or move a screen image ...
Thats my "personal" Start in Galaxy Editor, i like the UI because its good motivation to see the Result.
You may be right but wc3 seems like the easier and more senseful route he can take to at least understand what a variable is since well, you noe, variables are from algebra anyways.
thanks for the vid!!! In fact it is very easy to understand and a very good beginning for me to learn Variables!!!!
Now i can practice all time long :P
Thanks!!!
Not to be annoying, but variables in programming are math variables + state. In math, a variable is just an identifier for a value; the value never changes. In programming you can change the value of a variable. In math...it's just an identifier for an unknown value.
Doh, in maths you also change values of variables. Especially if you have them as input "parameters".
Constants are unchangable values. Variables are variable values. Hence the name.
PS:
Wikipedia for some more:
Quote:
A variable (pronounced /ˈvɛəriəbəl/; VAIR-ee-ə-bəl) is a symbol that stands for a value that may vary; the term usually occurs in opposition to constant, which is a symbol for a non-varying value, i.e. completely fixed or fixed in the context of use.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello,
with starcraft 2 beta I started to map and i downloaded a lot of maps. The trigger editor is not so hard to learn but I have a big problem with variables. I dont kow anything about them! I saw tons of variables in many maps and the only thing i thought is WTF!!! How do they work? What are they good for????? What do they do??????
I would be glad if somebody can help me or give me a tutorial!!!!!!!!!!!
@Aztec666: Go
Variables are just what they are when you program something, or even do a simple math problem (2+X=6 | X=4) Variables are data stored as a name. An example of a trigger:
Action - Create 1 Marine at location of barracks for player 1.
Action - Set Unit_Marine = last created unit.
Action - Remove Unit_Marine from the game
What happened there? I created a marine with a trigger, simple right? now I created a variable type unit named Unit_Marine, and I used an action to store the variable as that specific unit i created. Then i removed the unit, instead of removing the last created unit, i simply removed the unit in the variable, which in this case is the exact same unit. Say you want that unit removed far later in the game, but you have no way to refer to it, with a variable you can.
Variables dont just store units, they can store numbers, sounds, and much more.
If something is still blurry, please ask :)
try look for some tutorial about variables, i know there are made tons of tutorials about it in warcraft 3 and is it completly the same way they work.
To understand variables, you must resort to math. Variables are simply something(symbols or letters) that represents something. For example, Variable Y represents an unit. Instead of using Triggering Unit over and over again in a trigger, you set variable Y = Triggering Unit and use Y as the unit in your triggers instead. Variables are important because they stay as what you set them to be. Triggering Unit changes whenever your trigger goes off again because the event was met so your trigger messes up if there was a wait action involved. Variables also make your trigger much more readable and easier to understand and saves time if you need to use the same insanely long math function in your trigger repeatedly. If you still don't understand what a variable is, first learn (or relearn which would be completely ...) simple algebra since computer and math logic is related then start on some wc3 trigger editing then play around with sc2.
@raydude714: Go
everything u said sounds good except for playing with wc3 triggers first. hell, why not just go ahead and suggest some going back to 'basic / qbasic' programming then? maybe im a cynic though- :)
one thing to add though; when you call a function its slower / takes more processor than just calling a variable. so instead of using 'triggering unit' (even if you dont have to set it to a variable due to a wait tim interefering the 'triggering unit' with other triggers) by setting it to a variable and using the variable many times over instead of recalling the functions OVER and OVER of 'triggering unit' (this is a form of optimization)
heres an analogy;
say you have a trigger that using 'position of triggering unit' as a function. and it uses it like 10 times in the trigger. now humans, would think once, what is the position of the triggering unit? hmmm, its at location 101.34, 105.62. then every time we saw that we would automatically assume or know that the location is 101.34, 105.62 without having to relook at the actual position, as we just memorize it short term wise. but computers are only as smart as you make them. so every time you just use the function the computer is having to 'relook' at the location like its a fresh unit/ location every time you use it in the trigger, even though its the SAME one / position the whole time.
by setting it to a variable, you are putting it in computer memory so the computer doesnt have to run a function to determine the location of the triggering unit over and over in the same trigger. it will just know when it sees the variable TRIGUNITLOC (w/e you make it called) it will recall out of its memory instead of relooking at the unit location every time so its much faster and less work on your processor. its negligible to some extent, but with tons of triggers, especially with triggers ran on fast loops, it helps.
hopefully that made sense.
Ok thank you all!
Now i know what a variable is. It is "thing" which stores information for some later actions. So far so good! I also understand how you all describe variables but i´m still not in the shape to create variables whose request something or something like that. Its about time (in my learn stage) to show me how they look like in the editor. For sure I saw a couple of them in the maps i downloaded. But it was very confusing to me!
So thanks a lot for your help by then!!!
Learning by Doing
The best for Quick Success is to Play with Dialog Boxes to Build a own Interface, every Action is visible at the Screen. Work with Timer Let the Timer change Variables Use the Variables in a Screen Image ... voila a own "Movie" So you can simple Move Dialog Boxes etc. ... I dont like variables but in sc2 its very easy and the editor is a big Tutorial playground.
Ok I will do it!! But nevertheless i would have some examples which show me exactly how the look like :P
This is the Tutorial i used for my first steps in sc2 editor.
Dialog Boxes are like Play Cards you put on a table. Every new Dialog Box covers a older Box at the same Place. The Interface is nothing more (simple version) than many Cards at the Border (or in the middle but is not good to play ;) ) Create Dialog Boxes like in the Tutorial and create two variables as Integer (A and B) . Insteed of die Dialog Size (xxx,xxx) you use (Integer A, Integer B).
Now you have many ways You can simple Modify the variables You can use the Modify variable order you can use a Timer loop in combination with the Modify order to resize or move a screen image ...
Thats my "personal" Start in Galaxy Editor, i like the UI because its good motivation to see the Result.
@ ezbeats
You may be right but wc3 seems like the easier and more senseful route he can take to at least understand what a variable is since well, you noe, variables are from algebra anyways.
@Caipa
thanks for the vid!!! In fact it is very easy to understand and a very good beginning for me to learn Variables!!!! Now i can practice all time long :P Thanks!!!
Not to be annoying, but variables in programming are math variables + state. In math, a variable is just an identifier for a value; the value never changes. In programming you can change the value of a variable. In math...it's just an identifier for an unknown value.
@ThinkAboutItMore: Go
Doh, in maths you also change values of variables. Especially if you have them as input "parameters".
Constants are unchangable values. Variables are variable values. Hence the name.
PS:
Wikipedia for some more: