# Difference between Real variable, and Integer variable

Discussion in 'World Editor Help' started by b_ray210, Aug 3, 2008.

1. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Hey, i was just wondering if someone can tell me the difference between the ral variable type and the integer variable type and when i should use either. Thanks

2. ### SquishyYou can change this now in User CP.

Ratings:
+127 / 0 / -0
An integer is any number that doesn't have a decimal place, like 54 or -7. Real numbers, for purposes of Warcraft 3, include 3 decimal places. It doesn't really matter which you use, unless you need a number with a deciml, in which case, you would use Real.

3. ### DiFmNew Member

Ratings:
+35 / 0 / -0
Yea real are decimals and integer is whole numbers. IF you gonna store damage/Life you should use real since its not only whole numbers.

You can check in conditions each of there options you get. If you can use int then use it i say otherwise real. Where ever you type a integer/real you can convert it its at the top of the list

4. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Ohhhhh thanks guys, but that may help me with a different problem. here is a code for an ability that has a chance to deal bonus damage according to how much agility the triggering unit has.
Code:
```Swift Blade
Events
Unit - A unit Is attacked
Conditions
(Level of Swift Blade  for (Attacking unit)) Greater than or equal to 1
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 100) Less than or equal to ((Level of Swift Blade  for (Attacking unit)) x 5)
Then - Actions
Unit - Cause (Attacking unit) to damage (Attacked unit), dealing ((Real((Agility of (Attacking unit) (Include bonuses)))) x (((Real((Level of Swift Blade  for (Attacking unit)))) x 0.10) + 0.10)) damage of attack type Hero and damage type Normal
Floating Text - Create floating text that reads (String(((((Real((Level of Swift Blade  for (Attacking unit)))) x 0.10) + 0.10) + (Real((Agility of (Attacking unit) (Include bonuses))))))) above (Attacking unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 10.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
Else - Actions
Do nothing
```
Everytime the ability goes into affect the amount of bonus damage is shown but it is always a decimal and in the game it looks like a comma so it looks like it does in the 10's of thousands of damage. Can you help me make it so that it is not a decimal when it pops up and is rounded to the nearest integer?

props for the code writing goes to demotry241

Ratings:
+1,487 / 0 / -0
Set SomeIntegerVariable = Integer( <your calculation here> ) (comes with "conversion - convert real to integer")

6. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Well i'm pretty sure that would work if i knew what in the hell you were talking about haha. Is there any way you could actually write it out as a proper code?

PS. i love your maps especially tales from the north

7. ### cowmenaceNew Member

Ratings:
+22 / 0 / -0
it is hard to word this....
when choosing what to say, do this
conversion - convert integer to string
then
conversion - convert real to integer
then the real is converted into an integer so it doesn't have .000 then it is displayed.
hope it works

8. ### b_ray210Active Member

Ratings:
+1 / 0 / -0

Thank you for trying but i am soooo lost right now haha. I guess it doesn't really matter if there's a decimal or not.

9. ### cowmenaceNew Member

Ratings:
+22 / 0 / -0
lol I'll try to make it sound easier.

When you are able to type in what it says to the players, go to Conversion - Convert Integer into String. Once you have done that, you are going to do the same thing, but have it do Conversion - Convert Real into Integer. Then you can put the real value you had in there and it will come out with no decimals.

10. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Okay so im probably doing it wrong and i tried that but since it is under integer now it doesn't let me do decimals For Example: (level of swift blade for (attacking unit)) x 0.1)

11. ### cowmenaceNew Member

Ratings:
+22 / 0 / -0
then for .1 do 1/10

12. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Okay i think im done finally... would this be it?
Code:
```Floating Text - Create floating text that reads (String(((((Integer((Real((Level of Swift Blade  for (Attacking unit)))))) x (1 / 10)) + (1 / 10)) x (Integer((Real((Agility of (Attacking unit) (Include bonuses))))))))) above (Attacking unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 10.00% transparency
```
EDIT!: THIS WAS A HORRIBLE FAILURE!, everytime the spell goes into effect it just shows a zero. what'd i do wrong?

13. ### R@i_no_WyrmNew Member

Ratings:
+43 / 0 / -0
in integer, you can't divide it even you can choose the operator. Change the var to real then reconvert it to integer.

14. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
K i officially give up on this, waaaaayy too confusing for me.
If someone could write it for me it would be VERY helpful so i could see how it is supposed to be done.

15. ### R@i_no_WyrmNew Member

Ratings:
+43 / 0 / -0
Geh, why should you make the floating text in integer? make it in real and it'll be a lot easier w/o any conversion.

I don't get what r u trying to do so i can't help much.

16. ### DiFmNew Member

Ratings:
+35 / 0 / -0
lol I'll do the Trigger For you, you gonna intend to have more lvls?

17. ### DiFmNew Member

Ratings:
+35 / 0 / -0
LOl how annoying i cant attach files if im editig a post. Well here it is. Using a real variable.

File size:
17.2 KB
Views:
118
• Like x 1
18. ### b_ray210Active Member

Ratings:
+1 / 0 / -0
Thank you for making that and i will give plus rep but i thought to make it have no decimals it was supposed to be an integer variable :S

And can someone explain how to import spells into my map?

EDIT: nevermind it works just fine thank you so much! +rep

19. ### Demi666New Member

Ratings:
+127 / 0 / -0
Integer = 1
Real = 1.00

As in Integer = whole numbers
Real = 1.61 (a decimal)