• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Decimal Points

Status
Not open for further replies.
Level 19
Joined
Jun 16, 2007
Messages
1,574
Ok, i've been wondering about this for a while, i know its probably possible in jass, however i don't have the time to start learning jass and working with it.

So to quickly jump to the question, is it possible in GUI, to multiply a Hero's attribute by eg; "1.6" without having to do this:

  • Hero - Modify Strength of Characters[1]: Set to (((Strength of Characters[1] (Exclude bonuses)) / 5) x 8)
Because i know Integers round decimals to the closes digit, so is there any chance some how to get around this without doing the trigger i've listed above, or using jass ?

Thanks in advance,
Robot-dude
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
Because i know Integers round decimals to the closes digit
Wrong, they always round down due to the way computers work, or atleast they should. Floating point calculations are totally different from iteger. Integer is always exact whereas floating point (reals) only an approximation of a number.

The fraction method is probably the best (not what you have done there as that is inaccurate). Basically multiply the value by 8 and then divide by 5 (not what you did in the above trigger).
  • Hero - Modify Strength of Characters[1]: Set to (((Strength of Characters[1] (Exclude bonuses)) * 8) / 5)
Do note that the above will always round down due to what I mentioned eariler.
 
Status
Not open for further replies.
Top