ID:2412518
 
Code:
client
proc
Load_Mob()
if(fexists("Saves/[src.ckey].sav"))
var/savefile/Save = new("Saves/[src.ckey].sav")
var/mob/loaded_mob
Save["player"] >> loaded_mob
if(loaded_mob)
var
loaded_x = Save["player/X"]
loaded_y = Save["player/Y"]
loaded_z = Save["player/Z"]
loaded_mob.loc = locate(loaded_x,loaded_y,loaded_z)
var/mob/old_mob = src.mob
mob = loaded_mob
old_mob.loc = null


Problem description:
So here's what's happening, I'm working on the save/load system, I've got my character creation working in the way I want it to, but whenever I load a saved character I get a black screen with the null coordinates. If I remove the last three lines the code works, however it leaves behind an invisible mob from when the player was loading their character.

TL;DR Basically I'm trying to either get that invisible mob to be moved off the map, or to be deleted when loading in.
Hi Black,

Could you show me your Save_Mob() proc?
In response to UchihaSasuke_Leaf_NiN
Save_Mob()
var/savefile/Save = new("Saves/[src.ckey].sav")
Save["player"] << src.mob
Save["player/X"] << src.mob.x
Save["player/Y"] << src.mob.y
Save["player/Z"] << src.mob.z
Save["player/Verbs"] << src.mob.verbs
src << output("Character Saved!","default.OOC")


I added the save/load verbs more recently, which is why it wasn't in the first one. I also seemed to find a work around for the black screen by moving the creation screen to a different starting location from the spawn, but it's not exactly an ideal fix.
Rather than use slashes in the savefile paths, I suggest you use the cd var.

Save.cd = "player"
Save << mob
Save["X"] << mob.x
Save["Y"] << mob.y
Save["Z"] << mob.z

You'd do something similar with the load. However if you don't need the savefile broken into paths like that, I'd avoid the "player" path altogether and just save the mob directly to the file.