ID:167528
 
After having the user put in thier race id like them to select thier class. Selecting a class adds a few points to hp, str, ect. I'm stuck tho as how to do it. i tried doing something like

switch(input("Please choose your class") in list("paladin"))
if("paladin")
character +=1 /mob/var/hp

But that doesnt seem to work. Here is my code.

mob/var
hp
str
dex
int
ac


mob/create_character
var/mob/character
Login()
var/charactername = input("Please choose a name" , src.key)
switch(input("Please choose your class") in list("human","wood elf", "half elf","barbarian","Comunian","dwarf","gnome","kenian"))
if("human")
character = new /mob/human() // make char human
if("wood elf")
character = new /mob/wood_elf() //make char elf
if("half elf")
character = new /mob/half_elf() // make char half elf
if("barbarian")
character = new /mob/barbarian() // make char barbarian
if("comunian")
character = new /mob/comunian() // make char comunian
if("dwarf")
character = new /mob/dwarf() // make char dwarf
if("gnome")
character = new /mob/gnome() // make char gnome
if("kenian")
character = new /mob/kenian() // make char kenian
character.name = charactername
src.client.mob = character //change player to race
del(src)
switch(input("Please choose your class") in list("paladin"))
if("paladin")
character +=1 /mob/var/hp
Try changing
 character +=1 /mob/var/hp

to
 src.hp+=1
In response to Artekia
I'll try that. thanks
Should i put
switch(input("Please choose your class") in list("paladin"))
if("paladin")
src.hp+=1

before or after

character.name = charactername
src.client.mob = character
del(src)
In response to Punkitten
After.
And make del(src) into del(character).
In response to Artekia
Humm..ok well it compiled. By when i run after entering the race the map disapears along with the stat pannels :/

Sorr yim being a pain but im still learning lol.
In response to Punkitten
Please use
<dm>
tags.
mob/create_character
var/mob/character
Login()
..() // Do the normal first (map creation, ...)
var/charactername = input("Please choose a name" , src.key)
var/a=(input("Please choose your class") in list("human","wood_elf", "half_elf","barbarian","Comunian","dwarf","gnome","kenian"))//Just make a nonsense var that'll help later on
var/b=text2path("/mob/[a]")//Set b to a path (mob/[a]). As the name says, it changes text to a path.
character = new b() // since b will be a path, create it
switch(input(src,/*Add src, here. Else it will default to usr*/"Please choose your class") in list("paladin"))
if("paladin")
src.hp+=1
character.name=charactername
src.client.mob=character //change player to race
del(src)


Shortened, added '..()' (VERY important!), fixed some usr abuse (check input()).
In response to Mysame
Hum..I'm so confused lol

Do i start a new switch statement for the class selection?

What does at a= and b= do?

and new b?
In response to Punkitten
You need to understand how objects work.

/mob/paladin/ is a type path, and is not something actually physically IN the world. You can CREATE a physical entity by doing something like this:
new /mob/paladin/()


If you want to do anything to that particular entity, you'll need a variable to reference it by:
var/mob/paladin/P = new()


Now 'P' will be how you can identify that particular paladin. You can then tweak its variables:

P.hp += 1
In response to Alathon
Thanks I will try that. I'm stil learning the language. I forgot to note that i have some other relate code on a diffrent list so it doesnt get to bundles up I have

// character races

mob/human

hp = 10
str = 10
dex = 10
int = 8
ac = 2


mob/wood_elf

hp = 10
str = 8
dex = 8
int = 10
ac = 2

mob/half_elf

hp = 10
str = 9
dex = 8
int = 8
ac = 2

mob/barbarian

hp = 12
str = 10
dex = 12
int = 5
ac = 3

mob/comunian

hp = 8
str = 8
dex = 8
int = 12
ac = 1

mob/dwarf

hp = 8
str = 10
dex = 10
int = 7
ac = 2

mob/gnome

hp = 8
str = 8
dex = 8
int = 10
ac = 2

mob/kenian

hp = 12
str = 10
dex = 10
int = 8
ac = 3


mob
Stat()
statpanel("Stats")
stat("Health: [hp]")
stat("Strength: [str]")
stat("Dexerity: [dex]")
stat("Intelligence: [int]")
stat("Armor Class: [ac]")
statpanel("Inventory",usr.contents)
statpanel("Spells")
In response to Mysame
Some people need to figure out how to display the <dm> tags in plain text. Here's how you do it.

&lt;dm> which will turn out as <dm>. &lt; is the ASCII representation for the < symbol and &gt; is the ASCII representation for the > symbol. You can find a full list here.
In response to Punkitten
Hm...well it skips over the class selection completely. It doesnt even ask what class id'd like to be. I think im going to told off of that part till i learn some more about the lnaguage
In response to Punkitten
Well there are plenty of tutorials to been found at byond. There are also a few more that i have made found at http://www.riddlersoft.com/ByondPage.htm
In response to The Riddler
Riddler, though some of them are filled with usr abuse / src abuse (in verbs! :| ) and boolean variables. I suggest that you remake those all again. :/
In response to The Riddler
You also handle the hosting tutorial horribly.
In response to Mysame
thxs for the feedback! I will change some them! especial the verbs one. I uploaded the rong tutorial. I made a mess of that one!