• 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!

Arithmetic comparison fails D:

Status
Not open for further replies.
Hello there :D

I've run into a strange problem here... An arithmetic comparison simply fails:

JASS:
set Time = Time + 0.05
if Time >= TrainingTime then
    call this.Finish() // This will create a unit
endif

This portion of code is run every 0.05 second. However the method Finish is only called then Time > TrainingTime (noticed that by using game messages)

If I change the comparison to

JASS:
if Time == TrainingTime then

Then it works as it should...
What could be causing it and how to solve it?

Thanks!
Hossomi
 
I have tried using integers like InfinateAnswers said. However that way I get another problem:

JASS:
local integer Percent = Time/TrainingTime*50
//50 is the size of a life bar, let's say

That will always return 0 or 1 no matter what value that division results. I've also tried using R2I in all possible ways xD
Even if the variable was real, the result was the same. Looks like dividing integers will always return only the integer part of the result, so I tried converting both values to real using R2I. Same result, though...
 
Status
Not open for further replies.
Back
Top