HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variables. What the he.............

01-03-2004, 11:57 PM#1
TitanRevamped
can u guys please explain to me what variables are? and give me and example of how to use? they are so confusing:bgrun: :bgrun:
01-04-2004, 12:03 AM#2
Eriond
Variables are very useful, you'll learn more about them when you get to higher math classes.

A variable can be anything, a name, a number, what not. For this example, let's say our example variable is a number (called an integer in Warcraft 3).

A variable can be set to anything. Let's set it to 3.

So the equation 2 + Variable = ?, will equal 2 + 3 = 5.

If we set the variable to 7, the answer will be 9.

A variable is something with a value that is not fixed.

Sorry, It's kind of hard to define a variable. After a while, you just know what it is.... it's really hard to explain...

For a Warcraft 3 style, let's take the following example

We have a unit variable. That means this variable can be any unit on the map. It's kind of like a mask that we put over one unit, to mark it.

Let's say we want player 1's hero, to be removed. You may be thinking, why can't I just select the unit when I place it on the map, instead of going through this variable nonsense.

But what if the hero changes in the middle of the map? Say he evolves into a higher form of being and becomes a completely different unit. When he evovles, you can say Set UnitVariable to (Last Created Unit).

So let's look at the trigger.

Events - Player 1 Types 'Vanish' as an exact match

Actions - Remove UnitVariable

This'll remove the unit that's under the 'mask' that we put on him...

I hope that explains it, somewhat.
01-04-2004, 12:04 AM#3
TitanRevamped
0_o 0_o say what?
01-04-2004, 12:05 AM#4
zotax
http://www.wc3campaigns.com/forums/s...threadid=41499
Has good explanation
01-04-2004, 12:07 AM#5
TitanRevamped
but how do u make the variable target a specific unit? is it tihs way: lets say the guys name is sword man. so would the variable be named swordman? and i would choose from the drop down list unit type? is that right?
01-04-2004, 12:08 AM#6
Eriond
I just edited mine, I added a wc3 exmaple... I hope that clears it up...
01-04-2004, 12:11 AM#7
TitanRevamped
but how exactly do u make them(besides going to the menu and clicking new variable), like choose a specific unit. ive spent alot of hours on tftwe and the only thing i understand from variables now is that its some sort of an equasion or recipe in acookbook or something
01-04-2004, 01:05 AM#8
Eriond
There's an acition called Set Variable... you can set the variable to wahat you wish... that's how you would set it....

Sorry, it's REALLY hard to explain.