mob/Stat(mob/player/M)
statpanel("[src]\s Stats") // title of the tab, shows your name, then the word stats.
stat("Name:","[usr.name]")
stat("Class:","[usr.class]")
stat("Gender:","[M.Gender]")
stat("Level:","[usr.level]")
stat("--------------------")
stat("MaxHp:","[M.HP]/[M.MAXHP]")
stat("MaxMp:","[M.MP]/[M.MAXMP]")
stat("Physical Damage:","[M.MinDmg]/[M.MaxDmg]")
stat("Magic Damage:","[M.MagicDmg]")
stat("Critical Damage:","[M.CritDmg]")
stat("Critical Rate:","[M.CritRate]%")
stat("Defense:","[M.defense]")
stat("Dodge Rate:","[M.Dodge]%")
stat("Cooldown Reduction:","[M.Cooldown]%")
stat("--------------------")
stat("Str:","[M.Str]")
stat("Int:","[M.Int]")
stat("Dex:","[M.Dex]")
stat("Sta:","[M.Sta]")
stat("Statpoints:","[M.StatPoints]")
Problem description:
This is the statpanel i created and when i have compiled the code there are no errors or warnings. But once i start the game i get a repeated runtime error:
runtime error: Cannot read null.Gender
proc name: Stat (/mob/Stat)
usr: (src)
src: Guest-3019109090 (/mob/player)
src.loc: LightGrass01 (10,9,1) (/turf/Ground/Grass/LightGrass01)
call stack:
Guest-3019109090 (/mob/player): Stat(null)
Once i del M.Gender to see if the other declared variables with M. got this they do the same thing. The statpanel also does'nt show the rest of the statpanel after classes ofcourse.
I know this is a simple problem but for some reason i'm not seeing what i've done wrong :$
Oh and the variables are defined under:
mob/player
var
Str=0
Int=0
Dex=0
Sta=0
StatPoints=10
Gender="Male"
HP=100
MAXHP=100
MP=100
MAXMP=100
defense=0
MinDmg=1
MaxDmg=5
MagicDmg=5
CritDmg=1
CritRate=1
Dodge=1
Cooldown=0
exp=0
expneeded=10
oldexp=0
expgive=0
If someone could help me with this i would be very happy ;)
Thank you in regard ^^
You're using M, usr and src for the same mob. This is a no-no. I don't use usr in any of my code since src does essentially the same thing and won't bring about issues.
Turn all M's and usr to src, stat(mob/M) is unnecessary.
Also your Stat() should be under player so it can pickup all the necessary variables.
Even that may be wrong though. I could be mistaken, but I believe this might be the proper format: