• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Decimal Points

Status
Not open for further replies.
Level 19
Joined
Jun 16, 2007
Messages
1,572
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
 
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.
Back
Top