ID:148133
 
Here's my code for Save/Load

client/proc/Save()
var/savefile/F=new("Save_Files/[src.ckey].sav")
var/mob/characters/V=usr
V.verbstuff()
F<<V
F<<V.x
F<<V.y
F<<V.z
F<<V.verbstuff


client/proc/Load()
var/savefile/F=new("Save_Files/[src.ckey].sav")
var/mob/characters/V=usr
F>>V
F>>V.x
F>>V.y
F>>V.z
F>>V.verbstuff
V.addverbs()

mob
New()
..()
src.verbstuff = new()
mob
proc
verbstuff()
for(var/verb/O in src.verbs)
src.verbstuff.Add(O)
mob
proc
addverbs()
for(var/verb/O in src.verbstuff)
src.verbs.Add(O)


And here's my chooseCharacter mob that's invisible.
mob
other
chooseCharacter
Login()
world << "<i><font color=blue><b>[usr]</b></font> is creating a character.</i>"
usr.loc = locate(7,7,4)
Logout()
..()
var
chooseHair
chooseRace
chooseSkin


Now, here's the code for the "Load" graphic. Once a user clicks this it should load their character.

turf
Load
icon = 'load.bmp'
Click()
usr.client.Load()
..()



The problem I'm having is that the mob doesn't go to his location. I checked the location of the mob after I click "Load" and it's 0,0,0 and the screen is black -_-. Please help.
No put usr in procs. Ungh.

Lummox JR
In response to Lummox JR
Ok, updated code.

client/proc/Save()
var/savefile/F=new("Save_Files/[src.ckey].sav")
src.mob.verbstuff()
F<<src.mob
F<<src.mob.x
F<<src.mob.y
F<<src.mob.z
F<<src.mob.verbstuff


client/proc/Load()
var/savefile/F=new("Save_Files/[src.ckey].sav")
F>>src.mob
F>>src.mob.x
F>>src.mob.y
F>>src.mob.z
F>>src.mob.verbstuff
src.mob.addverbs()


No difference -_-'.
Mli0 wrote:
The problem I'm having is that the mob doesn't go to his location. I checked the location of the mob after I click "Load" and it's 0,0,0 and the screen is black -_-. Please help.

I think the problem (I could be wrong) is that 0,0,0 is not on the map. As far as I know, the smallest possible location (in BYOND) is 1,1,1. Can any BYOND guru correct me on this? (I don't want to give misleading information to anyone.)
The reason your mobs don't return to their old location is that you can't change the x,y,z values one at a time and expect them to become what you need. If you're at null (where x=y=z=0), then changing x to 5 will try to put you at (5,0,0), which ends up at (0,0,0) again. The trick is to change all three at once using locate(). So you have to load the x,y,z values into temporary vars to use them.

Lummox JR
In response to Lummox JR
OMG! Thank you so much! It finally works now. This took like 2 days to figure out. I can finally move on. Thanks a ton!