Minecraft-Java-Edition – How to Make a Scoreboard Score Increase by a Percentage in Minecraft 1.10

minecraft-commandsminecraft-java-edition

I am trying to make a map where if you buy something, the price increases by 15%, so a way to do that would be

/scoreboard players operation @p score1 *= @p score2

where score1 would be something like 15, and score2 would be 1.15% to increase score1. This would allow for almost infinite times, but scoreboards can not do decimals.

Best Answer

Add an objective with some fake players to keep track of numbers:

/scoreboard objectives add Numbers dummy
/scoreboard players set 115 Numbers 115
/scoreboard players set 100 Numbers 100

Then, whenever you want to increase it by 15%, multiply the player's score by 115, then divide it by 100:

/scoreboard players operation @p score1 *= 115 Numbers
/scoreboard players operation @p score1 /= 100 Numbers