Runtime error: "runtime error: Cannot modify null.level.
proc name: LoadProc (/mob/proc/LoadProc)
usr: LastB (/mob)
src: null
call stack:
LoadProc()
LastB (/mob): loadcharacter()
the load (10,3,1) (/turf/load_options/load): Click(the load (10,3,1) (/turf/load_options/load), "MainWindow.MainMap", "icon-x=14;icon-y=16;left=1;scr...")
Load Character Proc:
mob
proc
loadcharacter()
if(!fexists("Players/[ckey(src.key)].sav"))
src << "You don't have a character on this server."
else
src.LoadProc()
Save/Load Procs:
mob/proc/SaveProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F=new(FileName)
F["mob"] << src
F["Level"]<<src.level
F["Exp"]<<src.exp
F["Nexp"]<<src.nexp
F["HP"]<<src.health
F["MaxHP"]<<src.mhealth
F["Str"]<<src.str
F["Def"]<<src.def
F["Spi"]<<src.spi
F["Agi"]<<src.agi
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
src<<"Character Saved..."
mob/verb
Save()
src.SaveProc()
mob/proc/LoadProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName))
var/savefile/F=new(FileName)
F["mob"] >> src
F["Level"]>>src.level
F["Exp"]>>src.exp
F["Nexp"]>>src.nexp
F["HP"]>>src.health
F["MaxHP"]>>src.mhealth
F["Str"]>>src.str
F["Def"]>>src.def
F["Spi"]>>src.spi
F["Agi"]>>src.agi
src.loc=locate(F["LastX"],F["LastY"],F["LastZ"])
src<<"Character Loaded..."
return
Login/Logout:
mob
Login()
if(src.LoadProc())
world<<"[src] has Returned"
else
src.loc=locate(9,10,1)
world<<"[src] has logged in."
spawn(-1) winset(src,"default","size=640x640; pos=100,100; is-maximized=true")
//The above winset() line is new
Logout()
world<<"[src] has logged out."
src.SaveProc()
del src
Turfs:
turf
load_options
layer = 6
mouse_opacity = 2
create
Click()
usr.newcharacter()
load
Click()
usr.loadcharacter()
delete
Click()
usr.deletecharacter()
Any help on this would be much appreciated.
The problem probably comes from how you save the "mob". Since you "load" that first, it may be causing an error with a null src. Considering that the level is modified right after mob, that's my hunch. My advice to you - USE THE READ() AND WRITE() PROCS!