• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Variables

Status
Not open for further replies.
Level 7
Joined
Dec 29, 2008
Messages
252
Hello, i am trying to figure out how to use variables. I have experience with the world editor and triggers (not that much for triggers) but, currently, im clueless when it comes to variables.

What are they for? I dont even know where and when they are used

Are they important? is it a necesity to have a good map?

How can i use them? I know how to make them, but i dont know what to make them into.

Halp meh plox? If you could post your tips or links to threads that could help, thanks ;)

I realize that i should experiment with it, but right now i dont have alot of time to do that in. i would love to spend all day figuring these things out, but i have stuff to do, so if you can help me, thank you so much
:grin:
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
Variables allow you to save data or objects. They are very important.
Creating good custom spells is impossible without variables, and it's helpful for everything else as well.

When you, for example, create a unit in your map (triggered), you can set this unit to a variable (Set Variable), so you can use the unit later on with other triggers.
 
Level 8
Joined
Aug 2, 2008
Messages
193
Like Ramza said before, they are very important when you use custom spells to store the caster or other things. But they are also very important when you use locations oder other "handle-types" (like units, groups, items and so on) in triggers to prevent memory leaks, which would make the game to lag as hell over time.
You may have a look at this.
This tutorial explains what are variables and for what they can be used for pretty well.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Variables are Data that are saved in trigger/game through triggers
It often uses for future uses such as Point and Unit Group
It is VERY essential to save data (variable = save data) for everything you've done through trigger so that the system knows WHICH unit that is referred to
Example:
  • Set Caster = (Casting unit)
This trigger shows that you already saved it and will be used in the future
Let's say you want to deal damage per second to enemy:
  • Example
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Cause Caster to damage *EnemyVariable*, dealing 500.00 damage of attack type Spells and damage type Normal
As you can see, the system had already understand that the unit is referred to the Casting unit, so it may fire the trigger with no problem
Basically:
Variable = Save Data -> Use Data -> Clean Data (for Point and Unit Group variables, and others too)
 
Status
Not open for further replies.
Top