ID:139942
 
Code:
mob/verb/Save()
set hidden=1
if(src.login)
var/savefile/F = new("players/[src.key].sav")
Write(F)
src<<"Character Saved!"
return 1

mob
Write(savefile/F)
..()
F["x"] << x
F["y"] << y
F["z"] << z
savedoverlays = overlays.Copy()
overlays = null
overlays = savedoverlays.Copy()
Read(savefile/F)
..()
loc = locate(F["x"], F["y"], F["z"])
overlays = savedoverlays

mob/verb/Load()
set hidden = 1
if(usr.login)return 0
if(usr.creating)return 0
usr.creating=1
if(fexists("players/[usr.key].sav"))
usr.creating=0
var/savefile/F = new("players/[usr.key].sav")
Read(F)
usr.move=0
usr.Stuff()
else
usr<<"No savefile found on this server!"
usr.creating=0


Problem description:
Ok...basiclly the problem is, when a certain Key logs into the game, another key that is somehow related to that key, gets logged off, but is still on the game...I refer to this as a Save Link bug...really I dont know what else to call it, but oddly when it does this, the person that got "logged out" just reverts their save to an early version, even if it was over-writen...

Ex. 1
World News: XPointblankx has joined the ranks
World News: (Hero) has left us <-- Please note that his Key doesnt know up, but his In game name does...
World News: Joejoe16 has joined the ranks <-- Hero's Key
Hero just reverted to level 300 when he was 500.

Ex. 2
World News: Zach lewis has joined the ranks
World News: (Ace Uchiha) has left us
World News: Ramale has joined the ranks

I am unsure as to why the saves or keys are getting linked...they dont have the same IPs, the events just seem to happen...I have asked my more experinced programmer friends and they see no problem with the system, or any cause to why this is happening. I am not even 100% sure if this falls under the right section (code problems) or if its a bug or what...If you can help, please do.


There's a good chance you're saving a variable that is set to the reference of another player's mob. This means if you're keeping references to players in a list and saving that list it'll save that player, when you load that list the player gets loaded into the newly loaded mob.

You should go through and check for instances where you set variables to a mob or client, change those variables to tmp variables. If you need to save some kind of ownership, base it on ckey instead.
In response to Nadrew
Thanks Nadrew, I use a type of AI system that takes control of a player, and saves M as a Target...this really tells me what I need to change.

Again, Thanks alot.