ID:169867
 
I'm having a little trouble with classes.. I've tried coding a Rogue class in, but when I start the game with that class, my HP and MaxHP aren't shown, along with my str and defense..


This is the what I did:

mob
var
MHP
HP
MP
MMP
MSP
SP
str
def
Level = 1
gold = 50
class = ""
exp = 0
expn = 20
guardtalk = 0
attackadd = 0
defenseadd = 0
weaponon = 0
armoron = 0
PK = 0
team = null
lastplace = /area/Places/Newbie_City

mob
player
MHP = 0
HP = 0
MP
MMP
str = 0
def = 0
exp
expn
Level = 1


I have no errors anywhere (atleast I don't when I compile)

I have set all of the Rogue's class stats, they are:

if(a=="Rogue")
usr.icon = "Players.dmi"
usr.icon_state = "Male Rogue"
usr.HP = 25
usr.MHP = 25
usr.MP = 10
usr.MMP = 10
usr.str = 10
usr.def = 5
usr.class = "Rogue"
usr.exp = 0
usr.expn = 20


When I run the game, the HP,MHP,MP,MMP,str, and def, are not listed in game, or they are not shown..

I have Male and Female genders.. Would I need to take them out to make this all easier, or just fix this somewhere?

I'm probably just stupid and have probably missed something that's common sense..


mob/Stat()
statpanel("Stats!")
stat("HP/MHP:","[src.HP] / [src.MHP]")
stat("MP/MMP:","[src.MP] / [src.MMP]")
stat("Strength:","[src.str]")
stat("Defense:","[src.def]")
stat("Exp/Exp Needed:","[src.exp] / [src.expn]")
stat("Class:","[src.class]")


You would need to add
stat("Whatever:","[src.varhere]")

for extra things.

~>Jiskuha
In response to Jiskuha
I have the stat panel and all that..

Screen looks like this:



-----------------
<< screen

-----------------

___________

HP: /
MP: / <<<stat panel
str:
def:
exp: 0/20
____________

That's what my screen/stat panel looks like

Just HP and that other stuff isn't showing up..
Maybe you don't have your variables identified correctly in the Stat panel, or you have similar variables that are of no use?

In any case, I would assign variables to the mob/character/Rogue directory and have the person who picked that character become the mob.

It would look something like this(do try to forgive me for not using your variables, I am in a hurry, and I want to help you out before I go):

mob/Characters
Rogue
icon='Rogue.dmi'
icon_state = "Rogue"
density = 1
health=10
maxhealth=10
magic=12
maxmagic=12
if ("Rogue")
src = new /mob/Characters/Rogue


I don't know if I set it up right, but I am sure it could work with a few simple fixes.
In response to Luchipher
Where's the if(a=="Rogue") snippet located? You could be suffering from usr abuse.
In response to Jp
Jp wrote:
Where's the if(a=="Rogue") snippet located? You could be suffering from usr abuse.


This is the code down to the end of the "Rogue" class:

proc/CreateCharacter()
var/prompt_title = "New Character"
var/help_text = "What is your name?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

var/list/classes = list("Male", "Female")
help_text = "What Gender Are You?"
default_value = "Male"
var/usr_gender = input(src, help_text, prompt_title, default_value) in classes
var/a = input("What class do you wish to be?")in list("Rogue")
if(a=="Rogue")
usr.icon = "Players.dmi"
usr.icon_state = "Male Ninja"
usr.HP = 25
usr.MHP = 25
usr.MP = 10
usr.MMP = 10
usr.SP = 5
usr.MSP = 5
usr.str = 10
usr.def = 5
usr.class = "Rogue"
usr.exp = 0
usr.expn = 20


As you can see, I have "var/a = input" then if (a=="Rogue), so that's where that is..

I dunno, I will try to use some of you guys' advice, thanks :).
In response to Luchipher
It's usr abuse. Don't use usr in procedures: http://www.byondscape.com/ascape.dmb/LummoxJR.2002-1104/

What you should be doing is giving the CreateCharacter() procedure an argument, like this:

proc/CreateCharacter(var/mob/m)


Then, when you call it, pass the person who you want to create a character for into the procedure, like this:

CreateCharacter(src) // It's probably src, but I'd need to seriously mess around with your code to tell, and I'm not going to.


Then use m instead of usr.

Alternatively, define CreateCharacter() as a mob procedure (mob/proc/CreateCharacter()), then use src instead of usr.
In response to Jp
A CreateCharacter() proc needs no argument, since src should be the mob of the client who's using it. (Or, src could be the client. But whatever.)

Lummox JR