Varibals

Darimus

BattleForums Addict
Joined
Oct 2, 2003
Messages
681
Reaction score
0
Website
www.spaceman.vze.com
It's "variables" first off...

They're data-types and are used for storing data that you might want to keep. Booleans are for true or false, integers are for numbers between 0 and 4294967295 (without decimals), "real"s are for numbers with decimals, such as 4.25, and 2.00.

For example, you might have it so that after 4 town halls are killed, the player wins... to do this, you would make an integer (number without a decimal point), and increment (increase) by 1 each time a town hall was killed... then you could use an If statement to check if it was 4, and declare victory.
 

Darimus

BattleForums Addict
Joined
Oct 2, 2003
Messages
681
Reaction score
0
Website
www.spaceman.vze.com
You could do that in a multitude of ways... you could do an integer and check for 2, or you could set a boolean to true if a town hall is killed, or declare victory if it's already true when the town hall is destroyed
 

x42bn6

Retired Staff
Joined
Nov 11, 2002
Messages
15,150
Reaction score
2
Location
London, United Kingdom
MyNameIsMonky said:
uhggg sorry i still dont understand :doh ...whats interger?or however u spell it
Integers are numbers without decimal places, without the mantissa. So 1 would be an integer, and 1.00 a real number.

Use integers for, predictably, discrete data like 'number of sheep entered region' or 'number of heroes doing stupid things'. Use real numbers for things like 'Every 1.50 seconds kill target unit' or 'Remove 1.7HP from target hero every second he stays in the enemy base'.*
 

MyNameIsMonky

BattleForums Junior Member
Joined
Feb 24, 2004
Messages
137
Reaction score
0
Location
No place
Website
Visit site
ohhhhh......so its a # with out decmal...i see

ok i get it...can somone help me with a trigger two..like theres this
unit that dont come up to often i need it to not come up two often...like randomly spawn. not liek every 60 seconds can ne one help?
 

Darimus

BattleForums Addict
Joined
Oct 2, 2003
Messages
681
Reaction score
0
Website
www.spaceman.vze.com
It was hard to discern from your explanation what you meant, but I think you mean a unit that rarely, and randomly spawns. If so, you could do that using Math - Random Number (and choose 2 high numbers), and just have it spawn using a Timer or a perodic event. [Note: If you choose to do a random number, using a perodic event, the number will be randomly chosen at the start, but only once... If you choose a timer, you should remake the timer each time the unit is killed to have another random number]
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
Variables are variables really. They are used to store data on a computer for future use and have a temporary address on your physical memory. You assign types such as.

Integer, Boolean, Real (decimal numbers), a unit, unit group etc.

You then make a trigger to declare what they want to equal, eg.

Set X = (Player 1's Current Gold) will make X whatever player 1's gold is. However, you may need to put a event to keep the variable constantly updated.

Then there are arrays, which is a variable which stores multiple values into one and are called by an index. eg.

hi[7] = 1, 155, 24, 234, 123243, 56, 645, 93

However, note that there are 8 elements compared to the [7]. That's because 0 is an active index. If i call hi[0], I get 1. Why do you this?

Say in a Hero Line Wars map, you would want income[11] rather than making 12 seperate variables. Note that although 0 may be an active index, it may not be in Warcraft III editor.

MyNameisMonky said:
ok i get it...can somone help me with a trigger two..like theres this
unit that dont come up to often i need it to not come up two often...like randomly spawn. not liek every 60 seconds can ne one help
Make a random number as Dari said, but it needs to be re-chosen when the player who commanded that unit died. Set a range for the random number function and it should work properly.
 

Darimus

BattleForums Addict
Joined
Oct 2, 2003
Messages
681
Reaction score
0
Website
www.spaceman.vze.com
Hellwolf_36, when you declare something like hi[7], it goes from 0 to 6, not 0 to 7... There's 7 variables when you declare it as 7, it just doesn't go up to 7 (Goes up to 6).
 

ChrisH36

Guy with Most Posts on Quiet Board.
Joined
May 20, 2003
Messages
15,042
Reaction score
4
Location
Temple Prime, Sarajevo
Ok, 0 is an active index like in C. I kinda got the two mixed up
 

NewPosts

New threads

Top