• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

what's a variable?

Status
Not open for further replies.
Level 5
Joined
Jun 28, 2008
Messages
127
Lol I know what it is ... but how do I use one. Don't link me a tutorial i've read them all.

The main question is ... when you make a variable there is variable type or whatever ... wtf do i select there there's like unit group and umm .. well can't remember there's like 40.

Cheers.
 
Level 6
Joined
Sep 13, 2008
Messages
261
It all depends what you are using it to store.

If you have some units you want to call up later. You can make a variable group and put them in it with triggers.

If you have a hero that you will use often, you can set him as a unit variable making calling him easier.

Just figure out what variable your triggers need and make that type.
 
variable makes your trigger easier if you use a lot of actions that contains (lets just say) triggering unit, so if you don't have a variable you have to scroll and search for "triggering unit", but if you have variable, that stores triggering unit, you simply click on it :)

Its all bout making triggers easier, less messy and for clearing handles
 
Level 24
Joined
Oct 18, 2008
Messages
942
example: u can give a player a variable value like this:

make a variable thats type integer and make it array (12)

well name the variable seppo

now u want to make someones value 3:
action: set seppo(player number of <player>) = 3

then u need the value somewhere. lets say u will want to give him some gold

add seppo(player number of<player>) gold to <player>.

it will give the player his variable worth of gold.

EDIT: not sure if u need to use real instead of integer to give gold
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
an instance that can have a value of its type
like LOLOLOL is an integer variable and it can be any integer-it can be changed etc
 
Level 6
Joined
Mar 15, 2005
Messages
112
Heres a very basic one. If Variable [IntegerVariable] = 1 then (Something) Else (Something). So many uses for variables actually I couldn't live without them =P. Or..
A unit dies
if owner of killing unit = player 1
set variable: ((player1kills)=(player1kills)+1)) <"player1kills" would be a integer variable>
Then later you could put that in say a leader board. ((LeaderBoard-Set Player 1 Value = (Player1Kills))

Variables can be useful to refer to units you created during a game. If you create a unit set it as a variable and you can manipulate that unit later on without doing it instantly after you created it with last created unit. Set variable: ((Hero) = (Last Created Unit)). <"Hero" is a Unit Variable.>
 
Level 5
Joined
Jun 28, 2008
Messages
127
Yes I know the definition for variable. And I was talking about warcraft 3 variables. But hey thanks for the useless answers! :D

The bit I don't get is all the groups and stuff ... don't have we on atm .. but like before it has unit group, unit, player ... ahh you name it. There's quite a few. How do you know which one to select?
 
Level 6
Joined
Mar 15, 2005
Messages
112
Player Group: Add a custom list of players that you want to refer to later. Example add player 1/4/7/12 to player group(cool players) later on you could pick every player in (cool Players) and do functions.
Unit group: custom list of units you want to refer to later. Add peon/blademaster/shaman to unit group(myunits) later you could pick every unit in unit group(myunits) and do funtion.
Unit: Refer to a specific unit later. This is helpful if you want to refer to a specific unit that was created during the game. Normally you would have to use event response (example: triggering unit-entering unit-dying unit) -select unit (unit placed on the map in the WE) or random unit in unit group.
For say a dialog variable you must have one to build a dialog. and a dialog button array (amount of the array would be the amount of buttons you want in your dialog). heres an example.
Create dialog button for (Mydialog) named Start
set variable (diablogButton(1)) = last created dialog button
Create dialog button for (Mydialog) named Stop
set variable (diablogButton(2)) = last created dialog button

Later build a trigger like:
event:dialog button pressed for (MyDialog)
condition:Dialog button = (dialogButton(1))
Action:Whatever

Special effect variables: Set special effect you created to a variable so maybe 10 minutes later or whatever you could destroy that special effect.

I'm not gonna list them all but I hope this helps.
 
Status
Not open for further replies.
Top