Hi there Hive
I was trying to make a spell which makes the unit dash to the target point with a dynamic speed, which means he will always take a specific amount of time (1 second) to reach the destination, no matter the distance. The triggered movement would take place every 0.04 seconds, This meant that the unit would be moved 25 times (1 second). Then I took the distance between caster and target and divided it by 25, getting the distance to move the unit each interval
All simple and pretty obvious until now, i just made a loop that would move the unit every 0.04 seconds 'Distance/25' units towards the target loc and in theory the unit would reach destination within a second. The problem is than in practice it was not so, the unit was taking way longer than a second (More than the cooldown of the spell, which was 3 seconds or so).
Since my knowledge in JASS is even less than basic I used a GUI version with loops with waits (According to the one who wrote it, it'd be MUI and all that)
Is my math faulty in some way or it is just the method I used being faulty? Because i can't seem to make it work the intended way
I was trying to make a spell which makes the unit dash to the target point with a dynamic speed, which means he will always take a specific amount of time (1 second) to reach the destination, no matter the distance. The triggered movement would take place every 0.04 seconds, This meant that the unit would be moved 25 times (1 second). Then I took the distance between caster and target and divided it by 25, getting the distance to move the unit each interval
All simple and pretty obvious until now, i just made a loop that would move the unit every 0.04 seconds 'Distance/25' units towards the target loc and in theory the unit would reach destination within a second. The problem is than in practice it was not so, the unit was taking way longer than a second (More than the cooldown of the spell, which was 3 seconds or so).
Since my knowledge in JASS is even less than basic I used a GUI version with loops with waits (According to the one who wrote it, it'd be MUI and all that)
Is my math faulty in some way or it is just the method I used being faulty? Because i can't seem to make it work the intended way