ID:139404
 

Code:
    
mob
proc
LevelUp()
if (usr.Exp <= MaxExp)
usr.level += 1
// usr.MaxExp
usr << output("You have leveled!","world")
DeathCheck()
if (Hp<= 0)
world << output("[M] killed [src]!","world")
usr << output("You gained [src.Exp] Exp!","world")
usr.Exp += src.Exp
del(src)


im beginning to learn how to code,but im having trouble with my leveling sys,every time i kill a mob i gain exp....once the MaxExp reached it doesn't run lvl proc,also
how do i make MaxExp increase help(i want it to multiply by 1.5 every lvl),Did i code this wrong?
Hmm, one of the promblem may because you put if(usr.Exp<= MaxExp). I'm pretty sure it's if(usr.Exp => MaxExp).

Now for multiplying the experienced needed? I'll let you look at this code.

    proc
lvlcheck()
if(usr.exp >=usr.expn)
usr.KiControl +=1
usr.exp = 0
usr.expn = usr.expn * 2
In response to Gtgoku55
Gtgoku55 wrote:
Hmm, one of the promblem may because you put if(usr.Exp<= MaxExp). I'm pretty sure it's if(usr.Exp => MaxExp).

Now for multiplying the experienced needed? I'll let you look at this code.

    proc
> lvlcheck()
> if(usr.exp >=usr.expn)
> usr.KiControl +=1
> usr.exp = 0
> usr.expn = usr.expn * 2

thanks ill try that and for exp max inc what does the "expn" mean?"if(usr.exp >=usr.expn)" is it a new var i must add?
In response to MademanOne
expn basicly is expmax, the var is just different to what you're using.
In response to MademanOne
No, I just defined my own variables. Here's what it'd look like with your variables. EDIT: Replaced all the 'usr' with 'src'

proc
lvlcheck()// This the proc's name.
if(src.Exp >=src.MaxExp)// This is saying if my experience passes the Exp needed.
src.KiControl +=1 // This just some stat I programed to increase by 1 each level
src.Exp = 0 // This tells the proc to reset your exp to 0 after you level up.
src.MaxExp = src.MaxExp * 2 // This tells the proc that your max exp (Exp needed) is multiplied by 2 once you level up. If you want it to be 1.5x the boost, simply replace that with 1.5 "*" is multplication sign in DM.
Don't use usr in procs.
Here's why.
In response to Emasym
Oh right, my mistake, I tend to forget. Also, how do I close of the DM tag? Everytime I do it to post a code, I can't seem to cut it off to post underneath it.
In response to Gtgoku55
Thank you both for the help :)
In response to Gtgoku55
Aww its not working player don't lvl and the max exp doesn't multiply,Gwwaa codings hard
In response to MademanOne
What? Repost the code <.< again. Hell, and show the code about gaining exp when the monster dies.
In response to Gtgoku55
proc

LevelUp()
if(usr.Exp >= usr.MaxExp)
src.level += 1
src.Exp = 0
src.MaxExp = usr.MaxExp *1.5
usr << output("You have leveled!","world")
DeathCheck()
if (Hp<= 0)
world << output("[M] killed [src]!","world")
usr << output("You gained [src.Exp] Exp!","world")
usr.Exp += src.Exp // player + monster Exp
del(src)

mob/Monsters
icon='Npc.dmi'

Malboro
icon_state = "Malboro"
Hp = 50
Def = 5
Att = 5
Evade =15
Exp = 3
Del()


(this is the code with the new changes)
when i kill a monster i gain EXP but when the max Exp is reached LvLUp doesn't occur just keeps stacking up exp
In response to MademanOne
1) You never call the LevelUp() proc in your code
2) Your if() is wrong in LevelUp(), it checks whether the current EXP is LOWER than the Max.
3) You're still abusing usr
4) Please use the <dm> tags.
In response to Emasym
sorry bout that i just used reply and copy/paste

I see now why thanks for telling me why it wasnt being used