ID:265227
 
i wanted to make a system that you would only have to set the rquired exp for a level once then it would multiply and add etc...based on certain stats, however i have no idea on how to go about doing this
War_master66 wrote:
i wanted to make a system that you would only have to set the rquired exp for a level once then it would multiply and add etc...based on certain stats, however i have no idea on how to go about doing this

This is my form-letter snippet that demonstrates a basic framework for a level-up system. It's well commented, so you could probably figure out which line you need to tweak to make it random.

//Preliminary Design: Dan of Dantom
//Credit to: Spuzzum
//Contributed by: Spuzzum

mob
var
exp = 0
exp_next = 1000
level = 1

max_hp = 20

proc
AddExp(experience = 0)
exp += experience

//Uses 'while' to allow multiple level-ups
// in case of tons of experience points.
while(exp >= exp_next)
GainLevel()

/* Alternate Implementation:
//allow only one level up
if(exp >= exp_next)
exp = exp_next
GainLevel() */


GainLevel()
//INCREASE LEVEL
level++

//INCREASE EXPERIENCE REQUIRED FOR NEXT LEVEL
// (Change the formula as desired!)
exp_next += round((level * 0.75) * 1000)

//ADD/INCREASE STATS HERE
max_hp += rand(1,3)

//ANNOUNCE SUCCESS
world << "<b>[src] gained a level!</b>"
src << "<b>You are now level <font color=\"red\">[level]</font>!</b>"
In response to Spuzzum
thnx spuzzum