Calculation behaving incorrectly

Started by ShadowPlayer51 on

Topic category: Help with MCreator software

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Calculation behaving incorrectly

Code

This is a calculation I'm trying to have. It is called on an armor on body tick event and is simply for a gui that shows what the value would be if activated. When the armor is undamaged, it behaves normally and says the value would be 30, but if the armor takes any damage, the value is immediately set to 0 with no reason. I've even tired activating at this point and it does, in fact, give 0 as the value. 

The calculation is supposed to be so if the armor has only taken 5 damage, it would be something like 395/400 which is ~0.99, multiplying by the 30 would be ~29.6 and still round up to 30. Despite this, it automatically defaults to 0 if the item's damage is > 0.

Am I just being dumb or is something not working here?

Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Never mind, it didn't like…
Mon, 07/26/2021 - 00:39

Never mind, it didn't like the first value being less than 1. I found a solution.