mob/Write(savefile/s)
s["loc_x"] << src.x
s["loc_y"] << src.y
s["loc_z"] << src.z
return ..()
mob/Read(savefile/s)
if(!src.Move(locate(s["loc_x"],s["loc_y"],s["loc_z"])))
src.loc = locate(s["loc_x"],s["loc_y"],s["loc_z"]) //whatever you want it to locate to in case of failure
return ..()
mob/proc
Savee()
src.update = 116
var/index = "Savefiles/[src.ckey].sav"
if(fexists(index)) fdel(index)
var/savefile/s = new(index)
src.Write(s)
Loadd()
var/index = "Savefiles/[src.ckey].sav"
if(fexists(index))
var/savefile/s = new(index)
src.Read(s)
else
usr << "You have no save file!"
Problem description:
When I host the game and other people join, I keep getting an error (not pasting it cuz I don't seem to get the error when only I'm in the game, thus I can't make myself get it to paste it right now) whenever people save. I believe the line it mentioned is actually the very first line of that code above. How do I go about fixing it?
And when someone loaded the game once, it made a clone of him appear ... I got some error about the items he had in his inventory when that happened too ...
Sometimes, every player in the game, and the NPCs that walk, all stop moving suddenly too.. But that might be because of that saving error.
Note: when loading with >>, a new mob is always created, so you need to ensure that the player either doesn't have a mob (by doing it in client/New() before the ..()) or that you clean up their old mob.