client
proc
LoadChar()
var/savefile/S = new("Saves/Player/[src.ckey]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
SaveChar()
var/savefile/S = new ("Saves/Player/[src.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z
mob/pc
Login()
src.Choose_Char()
..()
proc
Choose_Char()
var/list/char_menu = newlist()
var/Create = "Create New Character"
var/Load = "Load Character"
var/Quit = "Exit"
if(fexists("Player/[src.client.ckey]"))
char_menu.Add(Create,Load,Quit)
var/choice = input("What do you want to do?","Welcome back to [world.name]") in char_menu
if(choice == Create)
switch(alert("Creating a New Character will delete your existing character. Continue?","Warning","Yes","No"))
if("Yes")
Create_Char()
return
if("No")
Choose_Char()
return
if(choice == Load)
src.client.LoadChar()
return
if(choice == Quit)
del(src)
else
char_menu.Add(Create,Quit)
var/choice = input("What do you want to do?","Welcome to [world.name]!") in char_menu
if(choice == Create)
Create_Char()
return
if(choice == Load)
del(src)
Create_Char()
var/mob/mob_created
var/world_name = "[world.name]"
var/value = key
mob_created = new/mob/pc()
mob_created.loc = locate(1,1,1)
src.client.mob = mob_created
Problem description:
Every time I run this I get annoying errors, the first of which being that the create new char window keeps reappearing after you select what option you want, I think something's calling it again and again.
Second, I keep getting error messages about src (/mob/pc) not having a client.
It just doesn't work in general. If anyone can give me a better way of saving a mob I'd appreciate it. (btw: I've read deadron's tutorial, I'm just crap at save files)
u have
try