Display float numbers without decimals

Hi, I made that every time my player kills 5 enemies, he gets a grenade to use. I made a count variable such that every time my player kills an enemy, the count variable would add 0.2. Therefore five kills will give 1. And this will be my grenade count. Everything works fine. But when I display this count variable to show the number of grenades he has, it shows with a lot of decimals. I want this count variable to show without decimal. that is if it’s 0.8, then it should show 0 only. How to do it?

You can use round() or maybe floor() too. Just do, change the value = round(value) or floor(value).
A floor changes the 0.8 to 0 1.8 to 1 and like that and round is going to do 0.8 to 1 and 1.8 to 2

2 Likes

Hi, I think it would be better if you made a kill counter variable instead that check if the player kills 5 enemies, then it gives the player 1 grenade and resets the counter.

If you want to display 0.8 as 0 though, just use SubStr(Variable(grenadeAmount), 0, 1) .
It should display as 1

3 Likes