set difficulty
Set the difficulty level for gameplay.
gameplay.setDifficulty(PEACEFUL);
Parameters
- difficulty: the new difficulty level for the game. The levels are:
peaceful
: monsters cannot spawn and you get more hearts quickly
easy
: easy gameplay level
normal
: normal gameplay level
hard
: the really difficult gameplay level
Example
Spawn a new monster. However, the monster won’t spawn if the game is currently set to peaceful, so change the gameplay to easy
before spawning.
Change it to normal
, or even hard
for a greater challenge!
player.onChat("creeper", function () {
gameplay.setDifficulty(EASY)
mobs.spawn(mobs.monster(CREEPER), pos(0, 0, 0))
})