ID:144067
 
Code:
mob
Login()
usr.loc = locate(6,6,4)
if(usr.key == "Shomone")
world << "<b><font color=blue>Owner [usr] has entered the world!"
switch(alert("Which one whould you like to choose?","","New","Load","Quit"))
if("New")
if (fexists("players/[usr.ckey].sav")) // Check if they have a save file
switch(alert("If you continue with a new character, your previous character will be erased. Do you wish to continue?","[world.name]","Yes","No"))
if ("Yes")
usr << "... Ok... Beginning character process now."
usr.loc = locate(17,6,4)
return ..()
if ("No")
usr << "Ok, Please reconnect for you are being disconnected now"
del(usr)
return ..()
else
return ..()
usr.loc = locate (17,6,4)
if("Load")
LoadCharacter() // The load character proc
if("Quit")
usr << "Bye bye."
del(src)

mob
proc
LoadCharacter() // The load character proc
var/savefile/F = new("players/[src.ckey].sav") // define the location of the save file
var/X // Defines a temporary X variable
var/Y // Defines a temporary Y variable
var/Z // Defines a temporary Z variable
var/mob/newmob = new() // Initialize a new mob
F["name"] >> name // Load the name from the list into the character's name
F["X"] >> X // Load the X variable from the savefile to the temporary X variable
F["Y"] >> Y // Load the Y variable from the savefile to the temporary Y variable
F["Z"] >> Z // Load the Z variable from the savefile to the temporary Z variable
F["Mob"] >> newmob // Load all the mob data into the initialized mob
newmob.loc = locate(X,Y,Z) // Move the initialized mob to the last saved location
newmob.client = src.client // Set the mob's client to players client

Problem description:
When i click load the menu is still there everything else works apart from load and when i click load again there i a new mob of me standing there
Try not to make 2 of the same topics.
In response to Revojake
i didnt mean to, i made the one in developer how-to then realized i did it worng so i did one in here
In response to Shomone
Show me the save verb and save proc, if you have one
So you see the newmob standing around, but you're not connected to it? Seems to be a problem with your very last line then.


You really don't need to create a new mob though. That is a technique usually used for creating new players. But since they already have an established character, it'd be easier to do it like this:

        LoadCharacter() // The load character proc
var/savefile/F = new("players/[src.ckey].sav") // define the location of the save file

/*
You don't need these here. just use src.x, src.y, and src.z.
var/X // Defines a temporary X variable
var/Y // Defines a temporary Y variable
var/Z // Defines a temporary Z variable
*/


// var/mob/newmob = new() // Initialize a new mob
/*
You don't need this since you're saving/loading the mob directly.
F["name"] >> name // Load the name from the list into the character's name
*/

F["X"] >> src.x // Load the X variable from the savefile to the temporary X variable
F["Y"] >> src.y // Load the Y variable from the savefile to the temporary Y variable
F["Z"] >> src.z // Load the Z variable from the savefile to the temporary Z variable
F["Mob"] >> src // Load all the mob data into the initialized mob
src.loc = locate(src.x,src.y,src.z) // Move the initialized mob to the last saved location
// newmob.client = src.client // Set the mob's client to players client