mob/var
Rank = 1
Exp = 0
reqExp = 100
GiveExp = 1000
isTraining = 0
showingtraining = 1
class as text
list/unlockedclasses = list("Dark Hand","Spell Slinger", "Snake Son")
Hp = 100
maxHp = 100
Str = 5
Def = 5
Mag = 5
Agi = 5
mob
player
icon = 'player.dmi'
icon_state = "Male"
mob/proc
levelCheck()
if(src.Exp >= src.reqExp)
src.Exp = src.Exp - src.reqExp //set src's exp to 0
src.reqExp = (src.reqExp*2) //set req exp to twice what it is
src.Rank += 1
src.maxHp += rand(10,50) ; src.Hp = src.maxHp
src.Str += rand (1,3)
src.Def += rand (1,3)
src.Mag += rand (1,3)
src.Agi += rand (1,3)
src.GiveExp += rand (10,50)
//raise rank
if(showingtraining == 1)
src << "You ranked up! Rank: [src.Rank]"
Problem description:
The first code is the base player code I have so far. Procs and verbs are a different dm file. The second code is my level up code. I need to know how to implement classes in the game. Should I put them in a variable as text and if so how would I go about setting specific starting stats and stat gains to each class. I'm new to coding in byond. I understand most of what I'm doing but I feel I can implement it better, some comments were made to help me remember before I got used to the program.
To be more specific. How would I make a warrior a mob with more str starting out and during leveling how would I give him more str and def .
By the way, all those:
are unnecessary. Procs default to the src who called them unless otherwise stated.
On another note, your if statement can(and should) also be simplified to
unless said variable can take inputs other than 0 and 1.
To give you some ideas in regards to handling classes:
You can have each class be a separate mob(and give them their own stats, techniques and whatnot), then set the client's mob to said /mob/class when choosing a class.
You can also do something like a /class datum and separate them that way, grouping them by melee/long-range/mid-range etc. Point is, you should probably think about it then write it out in pseudocode. Post it here when you've got something to show, and we'll help ya out.