I'm creating this minigame where two teams will fight on a large lake. One person on each team will have frostwalker boots, and his teammates will have to stay close to him to be able to move. So my question is if it is possible to make a player who is in water take damage over time untill he gets out or dies? I have no previous experience with commands btw. Thanks!
One way is to apply an instant damage effect to the player based on the value of a scoreboard timer.
Create the scoreboard objective:
/scoreboard objectives add timer dummy
Build a command block chain (see included screenshot) and paste these commands in:
/execute as @a at @s if block ~ ~ ~ water run scoreboard players add @s timer 1
/execute as @a[scores={timer=1..}] at @s unless block ~ ~ ~ minecraft:water run scoreboard players reset @s timer
/effect give @a[scores={timer=40..}] minecraft:instant_damage 1 0 true
/scoreboard players reset @a[scores={timer=40..}] timer
All the command blocks should be set to always active and unconditional. You can adjust the time by changing "timer=40..". In case you don't know how time works in Minecraft, 1 real-life second is 20 game ticks. So 40 ticks is 2 seconds.
I'm creating this minigame where two teams will fight on a large lake. One person on each team will have frostwalker boots, and his teammates will have to stay close to him to be able to move. So my question is if it is possible to make a player who is in water take damage over time untill he gets out or dies? I have no previous experience with commands btw. Thanks!
One way is to apply an instant damage effect to the player based on the value of a scoreboard timer.
Create the scoreboard objective:
Build a command block chain (see included screenshot) and paste these commands in:
All the command blocks should be set to always active and unconditional. You can adjust the time by changing "timer=40..". In case you don't know how time works in Minecraft, 1 real-life second is 20 game ticks. So 40 ticks is 2 seconds.
Command block engineer // Developer // #TeamTrees
Thanks, just what I was looking for!