Difference between Real variable, and Integer variable

b_ray210

Active Member
Reaction score
1
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
 

Squishy

You can change this now in User CP.
Reaction score
127
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.
 

DiFm

New Member
Reaction score
35
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
 

b_ray210

Active Member
Reaction score
1
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
 

b_ray210

Active Member
Reaction score
1
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 :)
 

cowmenace

New Member
Reaction score
22
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
 

b_ray210

Active Member
Reaction score
1
:eek::confused:
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.
 

cowmenace

New Member
Reaction score
22
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.
 

b_ray210

Active Member
Reaction score
1
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)
 

b_ray210

Active Member
Reaction score
1
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?
 

R@i_no_Wyrm

New Member
Reaction score
43
in integer, you can't divide it even you can choose the operator. Change the var to real then reconvert it to integer.
 

b_ray210

Active Member
Reaction score
1
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.
 

R@i_no_Wyrm

New Member
Reaction score
43
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.
 

DiFm

New Member
Reaction score
35
LOl how annoying i cant attach files if im editig a post. Well here it is. Using a real variable.
 

Attachments

  • Trigger.w3x
    17.2 KB · Views: 199

b_ray210

Active Member
Reaction score
1
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 :)
 

Demi666

New Member
Reaction score
127
Integer = 1
Real = 1.00

As in Integer = whole numbers
Real = 1.61 (a decimal)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top