3

I have a command block line set up so that it detects for a players death, then gives them weakness for 600 seconds. It applies weakness to soon before they get out of the respawn time. If there is not way to delay a command is there a way to detect a player respawn?

  • you may try to use the event fired when the player respawn. I don't create an answer as I don't know if it is feasible, but this may be a good start. – Zoma Jul 19 at 7:29
  • If you need a specific timing on the command block, you use redstone. – SF. Jul 19 at 8:17
  • 1
    @Zoma They mentioned command blocks, so this is not about modding. If you want to help with mod development, this is the place for you: gamedev.stackexchange.com – Fabian Röling Jul 19 at 15:49
  • @SF. No, redstone is generally evil for performance, response times, safety and much more. See also here: gaming.stackexchange.com/questions/345884/… – Fabian Röling Jul 19 at 15:51
11

Your real problem is that the players can wait arbitrarily long until they click "respawn", so no fixed delay would help you. What you can instead do is detecting when they have respawned. This can for example be done by checking if they are at a location (because dead players are nowhere):

/execute as @a[scores={deaths=1..},distance=0..] run <command>

This distance=0.. might seem useless, because you're testing for a distance of 0 or more from the command block, but what it does is only activating if you have an alive player in the same dimension. You could also do the same for Nether and End, but since you want to detect respawning, that's not necessary. Dead players have no location, so their distance from the command block isn't 0 or more, it's nothing.

  • Oh this is very good. I tried writing out a commands thing like that but couldn't think of a way to figure out if the player had clicked respawn. – Nik3141 Jul 19 at 17:13
4

Can you use repeaters? If you can, have one command block that detects the player's death and then have a few redstone repeaters lined up to delay the signal to the block that gives the effect.

1

The repeater is a redstone block that when you give a redstone signal from the back, there will be a delay and then will transmit the redstone signal from the front. Try adding a repeater between the redstone source and your command block. Each repeater can be set to give a different delay, and if you need a longer delay, try lining up several.

1

You can make a scoreboard that detects when they spawn back in and set a /execute command when the scoreboard reaches a certain value. Depending on the spawn location, you can use /execute at or execute if to detect when a player spawns and we’re they spawn. There are probably better videos of explaining this but I use this a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.