ID:2945357
 
Code:
world
mob=/mob/player
mob/player
icon='icons.dmi'
icon_state="player"
mob/Login()
if(LoadFile())
return
else
src.loc=locate(1,1,1)
mob/Logout()
SaveFile()
mob/proc/SaveFile()
var/savefile/F=new("Players/[src.ckey].sav")
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
src<<"Character Saved..."
mob/proc/LoadFile()
var/savefile/F=new("Players/[src.ckey].sav")
src.loc=locate(F["LastX"],F["LastY"],F["LastZ"])
src<<"Character Loaded..."
return 1

turf
icon='icons.dmi'
snow
icon_state="snow"


Problem description:
In the process of writing my own code from scratch, I discovered two key issues:

When using mob/Login() to create a new mob and swap client.mob, it results in the spawning of infinite mobs.
I adapted Falacy's save/load tutorial to match my own coding style and found that it works with just var/savefile/F = new("[ckey]"). However, I had to include return 1 at the end of the Load procedure for it to function properly.

Login to reply.