ID:1831104
 
(See the best response by Superbike32.)
Here's the gist:
I'm building a game that involves permanent death. When the player dies, how would I go about resetting them to default after deleting their save file when they die and go to the game over screen?

Just create a new /mob for the player and set the client to it, it's the easiest to start "fresh"
Make a new mob, and then move their client to that mob would probably be my suggestion. The viability of that may depend on your Login definitions.
die()
if(src.key)
var/mob/Player/M = new/mob/Player
src.canmove=0
src.client=M
M.Move(12,29,4)

else
src.make_corpse()
del src


Well, this isn't right :D There's something I'm missing because when it's a player who dies, I'm not being teleported and monsters around me keep attacking and dealing damage.
Best response
Move() can fail for one, your better off using var/mob/Player/M=new /mob/Player(locate(12,29,4))

Also M.client=src.client to put the player into it.

Also if you want to delete the original mob, just use "del src" after you move the player into the new mob, or else both mobs will stay in existence.

And src.canmove is useless if you have no client in the mob, so I'm not sure why that's there, unless you want to stop the new mob from moving right away or something.
Got it. yea my biggest problem was the M.client=src.client

the canmove was there to prevent the player from walking around on the game over screen, but the var is autoset at creation of a new player mob, so it WAS unnecessary
There is also client.mob which does the opposite of mob.client. Setting client.mob will change that client's connection mob.
Instead of del It's better to set the loc to null and delete any references.
Yeah, Kozuma's right. If there are no remaining references to the mob, moving it offscreen will delete it. Soft deletion is always better than hard deletion when you can use it, because it doesn't have to search for references.