ID:139341
 
=
mob/proc
LevelCheck()
if(src.Exp>=src.MaxExp)
src.Exp=0
src.MaxExp+=125
src.Dokuri+=1
src.MaxHealth+=rand(5,10)
src.Defense+=rand(1,4)
src.Attack+=rand(1,4)
src<<"Your power has grown to [src.Dokuri]"
if(src.Exp==src.MaxExp)
src.Exp=0
src.Dokuri+=1


I dont seem to have any errors reporting, but this code is not doing what i'd like..with my other code I gain exp, but once Exp=MaxExp...ie: 200/200..Level does not increase.(Dokuri)

What's calling LevelCheck() ?
Why do you have that second if() statement? It says "if exp is equal to maxexp", when the first if() statement already includes that?
You really should use a while() loop just in case they get so much experience that it warrants them gaining 2 or more levels.
mob
var
level = 1
exp = 0
next_xp = 100
proc
level_up()
while(src.exp >= src.next_xp)
src.exp -= src.next_exp
src.next_xp += 100
src.level ++
src<<"You are now level [src.level]"
In response to Chowder
i have another state ment to call M.LevelCheck()

at the end of my deathcheck i believe...or maybe my attack code


Anyways i messed with it some so it works now, but not exatly how i hope. But it seems to be adding exp normally and leveling but, I still need some work with it.

This is what I did, and it works well, but its kinda... strung together ..if you look at it i really dont know what i was doing but it works....

    Login()
icon_state = gender //when a player logs in, get them the right icon state for
..() //the gender of their key. Then call the parent!
Del()
var/obj/Gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand(1,100) //set its amount variable randomly
..() //call the parent
proc
DeathCheck()
if (Health <= 0)
world << "[src] dies!"
del(src) //delete whatever just died
LevelCheck()
if(src.Exp>=src.MaxExp)
src.Exp=0
src.MaxExp+=125
src.Dokuri+=1
src.MaxHealth+=rand(5,10)
src.Defense+=rand(1,4)
src.Attack+=rand(1,4)
src<<"Your power has grown to [src.Dokuri]"
else
src.Berri+=1

verb
attack(mob/M as mob in oview(1))
if (M.Health <= 0) //if M's HP are at or below 0...
usr << "[M] is already dead!"
else //otherwise...
usr << "You attack [M]!"
src.Exp+=10
oview() << "[usr] attacks [M]!"
var/damage = src.Attack
world << "[damage] damage!"
M.Health -= damage
M.DeathCheck()
src.LevelCheck()
icon='person.dmi'
icon_state="attack"


This is excluding the vars and other such things though
In response to Komuroto