ID:146104
 
Code:
mob
Login()
usr.loc = locate(5,5,2)
Rules()
..()

mob
proc
CreateChar(mob/M)

var/prompt_title = "Character Creation"
var/help_text = "What is your Character's name?"
var/default_value = "[usr.ckey]"
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
alert("You have not chosen a name, please go back and do so now.")
src.CreateChar()
return

help_text = "What gender do you wish to be?"
var/list/gender = list("Male","Female")
default_value = "Male"
var/char_gender = input(src, help_text, prompt_title, default_value) in gender
switch(char_gender)
if("Male")
icon = 'boy.dmi'
level = 1
hp = 50
maxhp = 50
mp = 25
maxmp = 25
strength = 15
defense = 15
magicattack = 10
magicdefense = 10
speed = 1
gold = 2000
exp = 0
maxexp = 200
modlevel = 0
focus = 0
weapon = 0
armor = 0
access = 0
style = "Young Boy"
style_level = 0
style_exp = 0
style_maxexp = 100
if("Female")
icon = 'girl.dmi'
level = 1
hp = 50
maxhp = 50
mp = 25
maxmp = 25
strength = 10
defense = 10
magicattack = 15
magicdefense = 15
speed = 1
gold = 2000
exp = 0
maxexp = 200
modlevel = 0
focus = 0
weapon = 0
armor = 0
access = 0
style = "Young Girl"
style_level = 0
style_exp = 0
style_maxexp = 100

usr.loc = locate(5,2,1)
usr.sight = 0
char_name = name
world<<"<font color=red><b>[usr.name] has entered the stuggle for power.</b></font>"
..()

SaveChar()
var/savefile/F = new("players/[src.ckey].sav")
F["char_name"] << name
F["X"] << usr.x
F["Y"] << usr.y
F["Z"] << usr.z
F["Mob"] << usr.client.mob

verb
Save()
set category = "Chat"
usr.SaveChar()
usr << "Please Standby..."
sleep(5)
usr << "Your character has been saved."

mob
proc
LoadCharacter()
var/savefile/F = new("players/[src.ckey].sav")
var/X
var/Y
var/Z
var/mob/newmob = new()
F["char_name"] >> name
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> newmob
usr.loc = locate(usr.x,usr.y,usr.z)
world << "<font color=red><b>[usr.name] has entered the struggle for power.</b></font>"

mob
Logout()
world<<"<font color=red><b>[usr.name] has left the world.</b></font>"
del(src)


Problem description: Okay, first off, when you load a character it doesn't relocate the mob to its previous locate, like it should in the "usr.loc = locate(usr.x,usr.y,usr.z"). The second problem is that when you load a game, it says "(Your Byond Key Here) has left the world." instead of saying "([usr.name] has entered the struggle for power.". Now, the beginning piece works fine, I mean creating the character and so forth. The problem I guess is just basically the load proc. Any help is greatly appreciated.

If you want to..
Think you could try out my libary for your game? It's basicly whta you have here, you just have to overwride the NewGame(), and everything else is done for you.

http://developer.byond.com/hub/FlameSage/SavingLibary

If you can, this would help me out alot!
            F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> newmob
usr.loc = locate(usr.x,usr.y,usr.z)


I think this is your problem. Capitalization is all wrong here.


something else:

In the Words of Lummox Jr. "No usr in procs Ungh"
In response to Crzylme
That wont work,
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> newmob


usr.loc = locate(usr.x,usr.y,usr.z) //you're not setting the vars to the uploaded ones.

//Instead do..
newmob.loc=locate(X,Y,Z)


*note*
Thats not the only thin wrong with that code.
(but its all you asked for help on)
In response to Flame Sage
If you guys would like to point out other things that are wrong with it, I would be very greatful. Thanks for the help so far. :D
In response to Plagu3r
FlameSage, I've tried your's lib, and I still get the same problem, at the loading scrreen, nothing happens. The character is loaded, but is loadng at the loading screen.
In response to Plagu3r
Problem fixed, new hometown system inplemented. :D