I have made set stats for certain classes when they get a new character, but when I log in to see if it works, all the stats like, hp etc, they are all at their defaults. Here is the code:
client
base_num_characters_allowed = 3
var/mob
mob/create_pc
Login()
var/mob/newchar = new /mob/player()
newchar.name = input("Your name?")as text
var/characterselect = input("Please select a class.","Class Selection",) in list ("Twin Blade","Heavy Blade(Female)","Blade Master","Wave Master")
if(characterselect=="Twin Blade")
newchar.Class = "Twin Blade"
newchar.icon = 'chars.dmi'
newchar.icon_state = "kite"
usr.HP = 25
usr.MaxHP = 25
usr.SP = 5
usr.MaxSP = 5
usr.Spell_Power = 5
usr.Strength = 3
usr.Exp = 0
usr.ExpNeed = 20
if(characterselect=="Heavy Blade(Female)")
newchar.Class = "Heavy Blade"
newchar.icon = 'chars.dmi'
newchar.icon_state = "Black Rose"
usr.HP = 26
usr.MaxHP = 26
usr.SP = 4
usr.MaxSP = 4
usr.Spell_Power = 3
usr.Strength = 4
usr.Exp = 0
usr.ExpNeed = 20
if(characterselect=="Blade Master")
var/genderselect = input("Please select a gender.","Gender Selection",) in list ("Male","Female")
if(genderselect=="Male")
newchar.Class = "Blade Master"
newchar.icon = 'chars.dmi'
newchar.icon_state = "blade master1"
usr.HP = 28
usr.MaxHP = 28
usr.SP = 5
usr.MaxSP = 5
usr.Spell_Power = 4
usr.Strength = 6
usr.Exp = 0
usr.ExpNeed = 20
if(genderselect=="Female")
newchar.Class = "Blade Master"
newchar.icon = 'chars.dmi'
newchar.icon_state = "Female BM"
usr.HP = 28
usr.MaxHP = 28
usr.SP = 5
usr.MaxSP = 5
usr.Spell_Power = 4
usr.Strength = 6
usr.Exp = 0
usr.ExpNeed = 20
if(characterselect=="Wave Master")
var/gender_select = input("Please select a gender.","Gender Selection",) in list ("Male","Female")
if(gender_select=="Male")
newchar.Class = "Blade Master"
newchar.icon = 'chars.dmi'
newchar.icon_state = "wm"
usr.HP = 28
usr.MaxHP = 28
usr.SP = 5
usr.MaxSP = 5
usr.Spell_Power = 4
usr.Strength = 6
usr.Exp = 0
usr.ExpNeed = 20
if(gender_select=="Female")
newchar.Class = "Blade Master"
newchar.icon = 'chars.dmi'
newchar.icon_state = "Female WM"
newchar.loc = locate(9,16,1)
src.client.mob = newchar
del(src)
mob/player
HP = 0
MaxHP = 0
SP = 0
MaxSP = 0
Strength = 0
Exp
ExpNeed = 25
Level = 1
Click()
usr << "\red Name: [name] HP: [HP] MaxHP: [MaxHP] Class: [Class] Level: [Level]"
mob/var
HP = 25
MaxHP = 25
SP = 5
MaxSP = 5
Strength = 3
Spell_Power = 0
Class = ""
Exp = 0
ExpNeed = 25
Level = 1
sp = 20
reason = "None"
description = null
host = ""
Gold = 50
expplus = 0
mob/player
verb
Attack()
for(var/mob/M in get_step(src,src.dir))
var/damage = rand(1,Strength)
usr << "You attack [M] for [damage] damage!!"
M << "[src] attack you for [damage]!!!"
M.HP -= damage
M.Death()
usr.Check()
Stat()
statpanel("Status")
stat("Name:",usr.name)
stat("Class:",usr.Class)
stat("Level:",usr.Level)
stat("HP:","[usr.HP] / [usr.MaxHP]")
stat("SP:","[usr.SP] / [usr.MaxSP]")
stat("Exp:","[usr.Exp] / [usr.ExpNeed]")
stat("Spell Points:",usr.sp)
stat("Srength:",usr.Strength)
stat("Spell Power:",usr.Spell_Power)
stat("Gold:",usr.Gold)
statpanel("Inventory")
stat(usr.contents)
mob
proc
Death(mob/M)
if(src.type == /mob/player)
PlayerDie()
else
if(src.HP <= 0)
range() << "[src] has been killed by [usr]!!"
del(src)
PlayerDie(mob/M)
if(src.HP <= 0)
view() << "[src] died!"
src.loc = locate(5,5,1)
src.HP = MaxHP
src.SP = MaxSP
mob
proc
Check(mob/player/M)
if(usr.Exp>=usr.ExpNeed)
usr.LevelUp()
mob/proc
LevelUp(mob/Player/M)
if(usr.Class=="Heavy Arm(Female)")
if(usr.Exp>=usr.ExpNeed)
usr.Level += 1
usr.Strength += rand(3,5) * usr.Level
usr.HP += rand(3,5) * usr.Level
usr.MaxHP += rand(4,7) * usr.Level
usr.ExpNeed += src.Level * 23
usr.HP = usr.MaxHP
usr<< " You level up to [usr.Level]!"
else
return
if(usr.Class=="Blade Master")
if(usr.Exp>=usr.ExpNeed)
usr.Level += 1
usr.Strength += rand(1,3) * usr.Level
usr.HP += rand(2,5) * usr.Level
usr.MaxHP += rand(3,7) * usr.Level
usr.SP += rand(4,9) * usr.Level
usr.MaxSP += rand(5,11) * usr.Level
usr.ExpNeed += src.Level * 23
usr.HP = usr.MaxHP
usr<< " You level up to [usr.Level]!"
else
return
if(usr.Class=="Twin Blade")
if(usr.Exp>=usr.ExpNeed)
usr.Level += 1
usr.Strength += rand(2,4) * usr.Level
usr.HP += rand(3,5) * usr.Level
usr.MaxHP += rand(1,6) * usr.Level
usr.SP += rand(4,9) * usr.Level
usr.MaxSP += rand(5,10) * usr.Level
usr.ExpNeed += src.Level * 23
usr.HP = usr.MaxHP
usr<< " You level up to [usr.Level]!"
else
return
if(usr.Class=="Wave Master")
if(usr.Exp>=usr.ExpNeed)
usr.Level += 1
usr.Strength += rand(2,4) * usr.Level
usr.HP += rand(3,5) * usr.Level
usr.MaxHP += rand(1,6) * usr.Level
usr.SP += rand(4,9) * usr.Level
usr.MaxSP += rand(5,10) * usr.Level
usr.ExpNeed += src.Level * 23
usr.HP = usr.MaxHP
usr<< " You level up to [usr.Level]!"
else
return
ID:262113
Sep 22 2004, 7:52 am
|
|
Second, you need to excise your code of usr abuse. With that in place, there are any number of reasons it could be failing. Your Death() proc is the worst example of this. It has an argument, M, that it needs but never uses; instead you're using usr everywhere. M should be the killer, and usr should be ignored because you can't easily predict it here. When you call Death(), pass on the killer as an argument so Death() has all the information it needs.
Likewise most of your Login() code could stand to lose usr. Granted it's semi-safe in Login(), but src is always correct whereas usr is still slightly iffy.
After those things are taken care of (and likewise in other procs), it'll be easier to get to the bottom of the actual problem--if indeed this doesn't fix it.
Lummox JR