1
Having a Problem with "Custom Respawn" (Command Blocks)
Hey Everyone!
A few days ago, I made a "custom respawn" using command blocks. When the player respawns after death, the command blocks will freeze the player in his current position. (exact location where the player dies) Then, the command blocks would play an "animation". (I don't want to give anything away, so we'll leave it at that for now) When the "animation" is finished, the player is unfrozen and free to continue on in the world. I managed to get it working with great success. However, today I discovered a bug. When I am killed by water (drowning), lava, or I die in the Nether or the End; I respawn not where I died, but within the spawn chunks.
So my question is: How can I fix this so that the player respawns where he died no matter what?
Thanks in advance!
TheStoneBrick
A few days ago, I made a "custom respawn" using command blocks. When the player respawns after death, the command blocks will freeze the player in his current position. (exact location where the player dies) Then, the command blocks would play an "animation". (I don't want to give anything away, so we'll leave it at that for now) When the "animation" is finished, the player is unfrozen and free to continue on in the world. I managed to get it working with great success. However, today I discovered a bug. When I am killed by water (drowning), lava, or I die in the Nether or the End; I respawn not where I died, but within the spawn chunks.
So my question is: How can I fix this so that the player respawns where he died no matter what?
Thanks in advance!
TheStoneBrick
9
I actually once did something like this, where a player who dies in the end would appear to "respawn" in that dimension. Lexxer is correct, it wasn't easy to set up, and probably will only work well with the end.
IIRC I did it by using a scoreboard value to track if they were in the end or the overworld. Their spawnpoint was always to to a dark cave underground, and if they died in the overworld I teleported them to where I wanted them to spawn. If they died in the end I teleported them to an end portal I had placed somewhere underground.
The main problems you're likely to run into:
1) If this is going to be in a survival world instead of a custom map, it's very possible that the player will find where you put the portal.
2) Using an end portal is relatively fast and unnoticeable. Nether portals, on the other hand, are time consuming and very visible to a player. Not good.
3) I had lots of problems with tracking where the player was, as my clocks had a tendency to freeze when the player left the dimension. That might not be a problem with 1.9 command blocks, but I've never bothered to test them extensively. I can't remember what I did to fix that problem, or if it ever worked.
4) You could do what Lexxer said and use an armor stand constantly /tp-ing to a player, and then teleport the player to that upon respawn. The problem is that you would then need to build an identical mechanism in each dimension you want to try to get this to work in.
Honestly, I wouldn't even try to make this work in other dimensions. I would detect if a player enters a different dimension, and then make them spawn outside the portal with a message saying their point of death could not be reached or something along those lines. The logistics just don't work out.
IIRC I did it by using a scoreboard value to track if they were in the end or the overworld. Their spawnpoint was always to to a dark cave underground, and if they died in the overworld I teleported them to where I wanted them to spawn. If they died in the end I teleported them to an end portal I had placed somewhere underground.
The main problems you're likely to run into:
1) If this is going to be in a survival world instead of a custom map, it's very possible that the player will find where you put the portal.
2) Using an end portal is relatively fast and unnoticeable. Nether portals, on the other hand, are time consuming and very visible to a player. Not good.
3) I had lots of problems with tracking where the player was, as my clocks had a tendency to freeze when the player left the dimension. That might not be a problem with 1.9 command blocks, but I've never bothered to test them extensively. I can't remember what I did to fix that problem, or if it ever worked.
4) You could do what Lexxer said and use an armor stand constantly /tp-ing to a player, and then teleport the player to that upon respawn. The problem is that you would then need to build an identical mechanism in each dimension you want to try to get this to work in.
Honestly, I wouldn't even try to make this work in other dimensions. I would detect if a player enters a different dimension, and then make them spawn outside the portal with a message saying their point of death could not be reached or something along those lines. The logistics just don't work out.
Well, for another dimension, i am pretty sure that it won't work at all.
But for water and lava, you could summon an ArmorStand at the position, the player died, then just teleport the player to the armor stand and instantly kill the ArmorStand.
For another dimension, you could just teleport the player to the portal, right befor he enters the dimension, however I don't think, there's a easy way to set this up.
But for water and lava, you could summon an ArmorStand at the position, the player died, then just teleport the player to the armor stand and instantly kill the ArmorStand.
For another dimension, you could just teleport the player to the portal, right befor he enters the dimension, however I don't think, there's a easy way to set this up.
I assume you use the /spawnpoint command?
In that case, the problem is, that you can't set the spawnpoint in another dimension, water or lava.
In that case, the problem is, that you can't set the spawnpoint in another dimension, water or lava.
Yes that is what I did. I guess I'll need to come up with another solution. Just curious, do you have any ideas?
bump
you could use scoreboards and executes.
/scoreboard objectives add DeathFreeze (player deaths, idk remember it)
then some stuff
which detects if player has died once he's freezed.
bla bla
to lazy to point things out, aka the whole system
/scoreboard objectives add DeathFreeze (player deaths, idk remember it)
then some stuff
which detects if player has died once he's freezed.
bla bla
to lazy to point things out, aka the whole system
I'm not sure if I understand. I've already got a respawn detector set up that detects when a player respaws. *duh* That detector will then emit two redstone signals. First, to summon an invisible armor stand and constantly tp the player to it (thus creating the "freeze"); second, to activate the "animation". The problem is that it does not work in the Nether, End, in lava, or water.
1. Use /exec to detect if player is in water or lava; if not then /spawnpoint
2. put the same contraption in Nether AND the End. If this doesn't work then Minecraft probably disallowed respawning in those dimensions.
2. put the same contraption in Nether AND the End. If this doesn't work then Minecraft probably disallowed respawning in those dimensions.
Unfortunately, neither thing was fixed. I'm not sure if I understood your first solution but I have done the following:https://drive.google.com/open?id=0B5v5ufQjlEOCVHl4NExTVG0wOWs If I understood correctly, the Idea was to set the spawnpoint above the liquid so the player falls in upon respawn. The Nether and End problem I'm not terribly surprised about and I'd assume theres no fix. It would however be nice if the player respawned near the portal instead of within the spawn chunks.
