ID:882868
 
(See the best response by Boubi.)
Code:
        NewMob(client/c, F as file)
var/mob/NewMob
var/mob/Oldmob = c.mob
var/MobPath = "/mob/Player/[lowertext(F["Class"])]"
NewMob = new MobPath
NewMob.Read(F)
NewMob.cansave = 1
c.mob = NewMob
del(Oldmob)


Problem description:

(TELNET) xxx.xxx.xxx.xxx - kal-el FOUND
runtime error: Cannot create objects of type null.
proc name: NewMob (/mob/proc/NewMob)
source file: Procs.dm,91

Happens when a player logs in trying to create a new mob based on saves class.

Can you use ExportText() and show me the savefile data?
sure

Password = "nothing"
Class = "Human"
ClassX = 180
ClassY = 193
ClassZ = 1
Location = "Earth"
ClassColor = "{y"
GenderColor = "{c"
AlignmentColor = "{B"
Alignment = "Good"
Gender = "Male"
last_x = 146
last_y = 341
last_z = 1
PowerLevel = 826
MaxPowerLevel = 826
Energy = 100
Zenni = 100
DamageReduction = 4
good = 1
LearnPunch = 1
LearnSweep = 1
LearnRoundhouse = 1
LearnDuck = 1
LearnDodge = 1
LearnJump = 1
LearnBlock = 1
nearby = ""
inview = list("")
fighting = list("")
skills = "* {cpunch{x * {csweep{x * {croundhouse{x * {cparry{x\n* {cdodge{x * {cjump{x * {cduck{x * {cdeflect{x\n* {csnapneck{x * {ckamehameha{x {R*{x {Delbow{x {R*{x {Dblast{x\n{R*{x {Ddestructio disk{x {R*{x {Dtri-beam{x {R*{x {Dsolar flare{x {R*{x {Dspirit burst{x\n{R*{x {Ddodonpa{x {R*{x {Dkaioken{x"
dir_text = list("north","south",null,"east","northeast","southeast",null,"west","northwest","southwest")
name = "kal-el"
text = "{y*{x"
density = 0
EKills = 14
countnearby = 130
Scouter = 1
actionblocked = 0
LearnTravel = 1
LearnBlast = 1
LearnKamehameha = 1
charging_ki = 0
charge_tick = 0
sent_blast = 0
charging_kamehameha = 0
attack_mod = 0
Eye = "{GScouter{x"
OnEye = 1
contents = list(object(".0"),object(".1"))
.0
type = /obj/Item/Scouter
equip = 1
suffix = "Equipped"
.1
type = /obj/Item/Scouter
key = "Telnet @x"
Anyways I expected something different but you need to use text2path() on MobPath because it's just a text string, not a path.
Alright I think that did fix it thanks a lot.
Best response
Also I'm pretty sure you can shorten your code by a line or two. It's all based on the order of operations though. I'm also pretty sure there's a better way to set all of the variables from the old mob to the newer one.

NewMob(var/client/m, var/f as file)
var/mob/a
var/mob/b = m.mob
// you need the parenthesis around text2patht() based on the OOP
a = new (text2path("/mob/Player/[lowertext(f["Class"])]"))
// there's probably a better way of doing this, calling this directly isn't preferred
a.Read(f)
a.cansave = TRUE
m.mob = a
del(b)
Thanks.
var/MobPath=/mob/Player
var/NewMob = new MobPath(loc)


you can use this to create objects from stored type vars, i use this for my game building tiles system, just replace MobPath to the variable that contains the path of the object you want to create.
plus there is no need to use text2path and causing unecessary use of computer memory.
In response to Karffebon
He's taking a certain race from the savefile to create a specific mob path. Your way doesn't allow him to customize it the way he wants to. There was a need to use text2path().