ID:263188
 
Code:ok, this is my login code, please help fix it -.-
mob/var
full_access
mob/var
HP
MHP
MP
MMP
Str
Mana_Power
Class = ""
Exp
Mexp
Level = 1
host = ""

mob/create_character/Login()
if(client.CheckPassport("14c847b7157ec746"))
var/mob/character
full_access = 1
usr<<sound('opening.mid',1)
var/charactername = input("Hello, Pick a name for your character, something you wish for people to call you in the game. If you use HTML codes for your name you WILL be banned. Multiple abusers will be banned permanently.","Character Name?")
switch(input("What class do you want?")in list("Monk","Sorcerer","Knight"))
if("Monk")
icon = 'Etc.dmi'
icon_state = "monk"
character.HP = 25
character.MHP = 25
character.MP = 5
character.MMP = 5
character.Mana_Power = 10
character.Str = 12
character.Def = 10
character.Class = "Monk"
character.Exp = 0
character.Mexp = 20
if("Sorcerer")
icon = 'Etc.dmi'
icon_state = "sorcerer"
character.HP = 14
character.MHP = 14
character.MP = 25
character.MMP = 25
character.Mana_Power = rand(10,20)
character.Str = 7
character.Def = 9
character.Class = "Sorcerer"
character.Exp = 0
character.Mexp = 13
if("Knight")
icon = 'Etc.dmi'
icon_state = "knight"
character.HP = 20
character.MHP = 20
character.MP = 0
character.MMP = 0
character.Mana_Power = 0
character.Str = 15
character.Def = 12
character.Class = "Knight"
character.Exp = 0
character.Mexp = 27
character.name = charactername
src.client.mob = character
character.loc=locate (2,2,1)
world<<"<B>[character] has logged in!"
del(src)
..()
else
var/mob/character
full_access = 0
usr<<sound('opening.mid',1)
var/charactername = input("Hello, Pick a name for your character, something you wish for people to call you in the game. If you use HTML codes for your name you WILL be banned. Multiple abusers will be banned permanently.","Character Name?")
switch(input("What class do you want? this decides your stats.")in list("Monk","Sorcerer","Knight"))
if("Monk")
icon = 'Etc.dmi'
icon_state = "monk"
character.HP = 25
character.MHP = 25
character.MP = 5
character.MMP = 5
character.Mana_Power = 10
character.Str = 12
character.Def = 10
character.Class = "Monk"
character.Exp = 0
character.Mexp = 20
if("Sorcerer")
icon = 'Etc.dmi'
icon_state = "sorcerer"
character.HP = 14
character.MHP = 14
character.MP = 25
character.MMP = 25
character.Mana_Power = rand(10,20)
character.Str = 7
character.Def = 9
character.Class = "Sorcerer"
character.Exp = 0
character.Mexp = 13
if("Knight")
icon = 'Etc.dmi'
icon_state = "knight"
character.HP = 20
character.MHP = 20
character.MP = 0
character.MMP = 0
character.Mana_Power = 0
character.Str = 15
character.Def = 12
character.Class = "Knight"
character.Exp = 0
character.Mexp = 27
character.name = charactername
src.client.mob = character
character.loc=locate (2,2,1)
world<<"<B>[character] has logged in!"
del(src)
..()


Problem description:When I log in, it works fine until i get to choose my race, after i choose it sends me into this runtime error: runtime error: Cannot modify null.HP.
proc name: Login (/mob/create_character/Login)
usr: Dragon warrior2662 (/mob/create_character)
src: Dragon warrior2662 (/mob/create_character)
call stack:
Dragon warrior2662 (/mob/create_character): Login()


The problem is your not defining who
var/mob/character
is so make it
var/mob/character = src
In response to A.T.H.K
=) ok, that got rid of the runtime error but now it logs me out when i select a class -.-
In response to Dragon warrior2662
For some reason you are delete the player..
del(src)


Delete that and it shall be fine.
In response to A.T.H.K
man your a freaking savior, thanks sooo much.
In response to A.T.H.K
Actually, character should be set to new and del src should stay. That way the players are using /mobs instead of /mob/choosing_characters. I should have noticed this in his last topic. =(