i wanted to make a modded dnd server with my friends but adding all the effects each time someone dies just seems like it would be to tedious, especially when were doing boss fights. i was wondering if someone knew how to automatically give someone certain potion effects when they spawn?
Hello, if you want to do that, you have to create a scoreboard that will store the time until last die. When this score matches 1, it means players have resurected, and you can give it potion effect. Here the code :
scoreboard players add @a time minecraft.custom:minecraft.time_since_death
execute as @a if score @s time matches 1 run effect give @s [potion effect you want]
For the first command, you just need to activate it once, so either you type it in you chat, or you put a command block on Impulse, inconditionnal and with Redstone and activate it with a button.
The second one has to be placed in a command block on repeat, inconditionnal and always active.
If you want for exemple give absorption 4 for 10sec to a player who just died, you write in your command block :
execute as @a if score @s time matches 1 run effect give @s minecraft:absorption 10 4
Old post but thank you this worked. now if only you could make it the effect time goes up every time they die. as I use this command line as a debuff for every time they die.
i wanted to make a modded dnd server with my friends but adding all the effects each time someone dies just seems like it would be to tedious, especially when were doing boss fights. i was wondering if someone knew how to automatically give someone certain potion effects when they spawn?
Hello, if you want to do that, you have to create a scoreboard that will store the time until last die. When this score matches 1, it means players have resurected, and you can give it potion effect. Here the code :
I like trains... OF CHAIN COMMAND BLOCKS !
do you think you could exlpain how i would actually put this into the game. i dont normally use command blocks
For the first command, you just need to activate it once, so either you type it in you chat, or you put a command block on Impulse, inconditionnal and with Redstone and activate it with a button.
The second one has to be placed in a command block on repeat, inconditionnal and always active.
If you want for exemple give absorption 4 for 10sec to a player who just died, you write in your command block :
execute as @a if score @s time matches 1 run effect give @s minecraft:absorption 10 4
I like trains... OF CHAIN COMMAND BLOCKS !
This didn't work for me, you need to put a score after the time variable
Like they say, never trust anime girls. This doesn't work.
I'm a little late to this party, but I'd like to help anyone who sees this in the future. dalor_homer was close, but not quite right.
You're going to need to type this in chat:
Then, put this into a repeating command block on always active:
There you go! Hope this helped!
Old post but thank you this worked. now if only you could make it the effect time goes up every time they die. as I use this command line as a debuff for every time they die.