ID:1914014
 
(See the best response by Mr_Goober.)
Code:
world
mob = /mob/character_creation


Problem description:

How can I change the mob path. I have been trying to do it like this but it doesnt seems to work at all
src = 
/mob/player()
. Help much appriciated

var/mob/player/new_player = new()
src.client.mob = new_player
So in order to change the path you need to create a new mob with player path.


My actuall prob is that I want to load the the player from the savefile.

                new_mob = new /mob/player()
new_mob.hp = 100
src.client.mob = new_mob

del src
return



I manage to change the path and login works. But how can I manage loading proc.
I tried something like this but im doing it wrong...

        LoadCharacter()

new_mob = new /mob/player()
new_mob.key = src.key

if(fexists("players/[new_mob.key].sav"))
var/savefile/F= "players/[new_mob.key].sav"
new_mob.Read(F)
src.client.mob = new_mob
Best response
What world.mob does is create a new mob of the specified type for any clients connecting to the world. This happens at the very first step of client creation, in client/New(). You need to call ..() (the parent proc) inside of client/New() for this to happen.

In order to access the client's variables of the specified type, you'll probably need to create a variable that is casted to that specific type, or handle the way it works in its Login proc:
// client new example:
client/New()
..()
var/mob/player/p = mob
// do stuff here

// mob/Login example
mob/player/Login()
..()
// do stuff here

(the latter approach wasn't personally tested by me though, so I am not 100% certain it works).
Thanks I`ll play with it abit :)