how to store difficulty to change it in an aerea and change back if leaving that aerea
tryed : /execute as @a store result score @s schwierigkeitt run data get entity @s difficulty
Difficulty isn't something you can find in an entity.
The best alternative will be storing as a flag in your scoreboard. Here's an example:
When the game starts, set a scoreboard to 1. That indicates that the game is in normal mode. When a player enters the area, change the difficulty (note that this change applies to player outside the area, so it's better to warp them all into the area if it's multiplayer) to hard and set the scoreboard value to 2. When players leave the area, change back to normal and set the value to 1.
Something like this. Hope you get it. Or at least I hope that's what you wanted.
how to store difficulty to change it in an aerea and change back if leaving that aerea
tryed : /execute as @a store result score @s schwierigkeitt run data get entity @s difficulty
Unlike entity/block data (such as tags, inventory...), the difficulty of a world is stored as a global variable. You can store its value into a scoreboard objective like this:
/execute store result score global <objective> run difficulty
I used a "fake player" called "global" so it's easily accessible but you can use whatever you want. You can then revert the difficulty back to what it was by testing for each value:
/execute if score global <objective> matches 0 run difficulty peaceful
/execute if score global <objective> matches 1 run difficulty easy
/execute if score global <objective> matches 2 run difficulty normal
/execute if score global <objective> matches 3 run difficulty hard
how to store difficulty to change it in an aerea and change back if leaving that aerea
tryed : /execute as @a store result score @s schwierigkeitt run data get entity @s difficulty
Difficulty isn't something you can find in an entity.
The best alternative will be storing as a flag in your scoreboard. Here's an example:
When the game starts, set a scoreboard to 1. That indicates that the game is in normal mode. When a player enters the area, change the difficulty (note that this change applies to player outside the area, so it's better to warp them all into the area if it's multiplayer) to hard and set the scoreboard value to 2. When players leave the area, change back to normal and set the value to 1.
Something like this. Hope you get it. Or at least I hope that's what you wanted.
Thank u
Unlike entity/block data (such as tags, inventory...), the difficulty of a world is stored as a global variable. You can store its value into a scoreboard objective like this:
I used a "fake player" called "global" so it's easily accessible but you can use whatever you want. You can then revert the difficulty back to what it was by testing for each value:
Command block engineer // Developer // #TeamTrees
very nice thank u