mob
proc
levelup()
if(src.exp >= src.mexp)
src.level += 1
src.gain()
src << "<font color=red>You gained a level!"
src << "Your level is now [src.level]"
src.exp = 0
if(src.level >= 25)
world << "[src] has gain a level!"
var
level = 1
exp = 0
mexp = 1
maxpowerlevel = 1
maxstrength = 1
maxspeed = 1
maxdefence = 1
powerlevel = 1
strength = 1
speed = 1
defence = 1
maxhealth = 1
health = 1
proc
gain()
if(src.level <= 10)
src.maxpowerlevel += (rand(5,10))
src.maxstrength += (rand(5,10))
src.maxspeed += (rand(5,10))
src.maxdefence += (rand(5,10))
src.maxhealth += (rand(5,10))
src.mexp += (rand(5,10))
src.maxstamina += (rand(5,10))
if(src.level <= 20)
src.maxpowerlevel += (rand(5,20))
src.maxstrength += (rand(5,20))
src.maxspeed += (rand(5,20))
src.maxdefence += (rand(5,20))
src.maxhealth += (rand(5,20))
src.mexp += (rand(5,20))
src.maxstamina += (rand(5,20))
//And more, it goes up to if(src.level <= 200) each time the level is increased by 10.
Yea, I thought I would post it here so that someone with much more programming experience than me can check see if anything is wrong with it, or see if it could be simplified, but do the same thing.
Don't worry about the numbers, I just added them for starters, my co-worker will tune everything up when the game is finished.
First, this is horrible horrible game design. You've made higher-level players gain power at a higher and higher rate, effectively pushing newbies out of the game. If anything the gain should be fairly steady, or it should be less and less as levels increase. Of course, due to a bug in implementation, you're effectively running low-level players through this code 20 times, so they actually do get a greater benefit.
Second, you've implemented that code wrong thrice over. You forgot to put an else in those checks; the end result is that since level<=10 and level<=20 and level<30... well, you get the picture. As I said above, for low-level players you'll be running through that 20 times.
A bigger problem is that you're repeating the same block of code 20 times for the sake of a value that only changes once. So to fix that:
See the difference? But that's still not right.
Any time you see yourself repeating that much code, it's a clue that you should have used a formula.
Lummox JR