So I am trying to make a map, there is a scoreboard objective called anger that when a player’s anger is greater than 300, player will sometime floats. when the player’s anger is greater than 1000, he randomly explodes, but I do not know how to use command blocks to calculate if the player's anger is greater or smaller, anyone can help?
Minecraft Java Edition – How to Calculate Greater and Smaller Player Scoreboard Values with Commands
minecraft-commandsminecraft-java-edition
Related Topic
- minecraft-java-edition – How to Check If a Scoreboard Objective Is Not Greater Than a Certain Integer in Minecraft Command Blocks
- Minecraft-Java-Edition-Minecraft-Commands – How to Set a Dummy Scoreboard Objective to Another Dummy in Minecraft
- Minecraft Java Edition Commands – How to Find a Player with a Score in Version 1.13.1
- Minecraft Java Edition – How to Set Scoreboard When Player Stands on a Half Slab
- Minecraft – quicker alternative for the [name=!] command
Best Answer
The way to test for scores you can do with this command:
This will give all players with the
Anger
score a levitation effect for 1 second with the amplifier of 1, the0
at the end is the amplifier, i.e.0
will give you an amplifier of 1,1
will give you an amplifier of 2, etc.You can also add
true
at the end to hide the effect particles:The first command will test for when a player has an
Anger
score from 300 to 1000. I don't really know how to make a randomizer but if you use anotherscoreboard
you can add the levitation effect every 20 seconds or whatever delay you'd like.Then you can put this in a repeating command block:
This will add 1 point every 20:th of a second to the score, so 20 points a second. Using this you can test for how many seconds you'd like the delay to be by just testing for a score 20 times bigger, lets say we want a 20-second delay:
After this you put a chain command block with a command that resets the
Random
score:You can do the same with the above 1000 scenario, and you can add another dummy score if you'd like the delay to be different from your first.
About the
score
testing:When you test for a score you do that within the target selector,
@a[scores={"here"}]
. You specify the score's name first,@a[scores={Anger=}
, then you add the score you'd like to test for using 2 dots..
. In front of the dots is the minimum score, and after is the maximum score, If I'd like to test for a score from 0 to 347 I'd write:And if I'd like to test for a score of 1000 or more I'd write:
Make sure to add the
if entity @s
after the selector@a[]
. This makes sure the command only runs when the players' scores actually are correct, so the player doesn't get stuck in a loop.