ID:146183
 
Code:
mob
proc
Levelsystem()
if(src.Exp>=30)
src.Level=2
src<<"<center><b>Congrats! You are now Lvl 2!</b></center>"
else
..()
if(src.Exp>=95)
src.Level=3
src<<"<center><b>Congrats! You are now Lvl 3!</b></center>"
else
..()
if(src.Exp>=200)
src.Level=4
src<<"<center><b>Congrats! You are now Lvl 4!</b></center>"
else
..()
if(src.Exp>=350)
src.Level=5
src<<"<center><b>Congrats! You are now Lvl 5!</b></center>"
else
..()
if(src.Exp>=550)
src.Level=6
src<<"<center><b>Congrats! You are now Lvl 6!</b></center>"
else
..()
if(src.Exp>=805)
src.Level=7
src<<"<center><b>Congrats! You are now Lvl 7!</b></center>"
else
..()
if(src.Exp>=1120)
src.Level=8
src<<"<center><b>Congrats! You are now Lvl 8!</b></center>"
else
..()
if(src.Exp>=1500)
src.Level=9
src<<"<center><b>Congrats! You are now Lvl 9!</b></center>"
else
..()
if(src.Exp>=1950)
src.Level=10
src<<"<center><b>Congrats! You are now Lvl 10!</b></center>"
else
..()

mob
verb
Addexp()
set category="Comm."
src.Exp+=15
src.Levelsystem()


Problem description: This is just for testing my game, but soon i'll change this into a more.. suitable Level Up() system. Anyhow, right now when I start the game and use the Addexp() verb, it does everything right, because once I reach 30 exp, it would say, "Congrats! You are now Lvl 2!". The problem is, once that happends and I add more EXP, it repeats that saying as many times as I use the Addexp(). How can I prevent that? I'm doing a level up system this way because I have a sheet with specific EXP. Once you reach that amount, you are rewarded. Any help would be great! Thanks.

i see ur problem. Its because as soon as u pass the 30 xp mark, it will always be more than 30 (45,60 all greater than 30). I implemented a new more advanced lvlup sys just cuz i hate this long if stuff. The base xp thingy is 30, and it multiplys by 1.5 each lvlup

mob/var
Exp
Level=0

mob
proc
Levelsystem()
if(src.Exp>=30*1.5**src.Level)
src.Level++
src<<"<center><b>Congrats! You are now Lvl [src.Level]!</b></center>"


mob
verb
Addexp()
set category="Comm."
src.Exp+=15
src.Levelsystem()
You could so something like:
var/list/levels=list("1"=30,"2"=95,"3"=200,....)
mob/proc/levelup()
if(exp>=levels["[lvl]"])
lvl++
src<<"You are now level [lvl]."
In response to Ol' Yeller
Ol' Yeller wrote:
You could so something like:
> var/list/levels=list("1"=30,"2"=95,"3"=200,....)
> mob/proc/levelup()
> if(exp>=levels["[lvl]"])
> lvl++
> src<<"You are now level [lvl]."


Thank you so much. I like this style of doing things. Much more organized, and less lines. ^_^;