Logout()
var/player_sav = "players/[ckey].sav"
var/savefile/F = new(player_sav)
F["version"] << VERSION
F["mob"] << src
F["loc"] << src.loc
del src
Loading Code (In Client):
client/New()
if(usr) return ..() //reconnecting to existing mob
else
var/player_sav = "players/[ckey].sav"
if(length(file(player_sav))) //if player savefile exists
var/savefile/F = new(player_sav) //open it
var/version = ""
F["version"] >> version
if(version==VERSION)
F["mob"] >> usr
F["loc"] >> usr.loc
else
return 0
return ..() //creates a new mob if necessary
Problem description:
Hey guys, working on my own project lately and i have a weird bug i'm having problems with.
When i save the player's mob and load it back up it also saves and loads any objs in the same location as the player. if they are objects set by the map editor they disappear if the player saved on top of them
anyone know how to avoid this?
I assume that they only disappear when the player is loaded back into the square, but i don't have a second account to verify
Another problem i'm having is the player has an object that is supposed to follow them and i have it set to make it's loc the same as the players when the player's mob calls Move() and when the player's mob has Read() called so it should move to where the player is when the player logs in, it does not. It moves to the player as soon as the player moves, but it doesn't appear near the player when the player is read from the file.
Code associated with the object described:
Read()
..()
if(overworld)
EnterOverworld()
action_bar.loc = loc
New()
..()
if(overworld)
EnterOverworld()
action_bar = new(loc);
ActionFill()
Move()
..()
action_bar.loc = loc
I'll post more code if necessary but I feel like i gave enough description to receive an answer.