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

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.
Top