ID:149995
 
why cant i us the lvl check part?(ill highlight it with ////\\\\\)
mob
proc
DeathCheck()
if(HP <=0)
if(src.client)
src.x = 2
src.y = 2
src.z = 2
oview() << "[src] has been KILLED!!!"
usr << "[src] is DEAD!!!"
else
usr.exp += expreward
usr.credits += creditsreward
\\\\checklevel()////
del(src)

mob
proc
checklevel(mob/M as mob)
if (M.exp >= M.expreq)
levelup(M)


levelup(mob/M as mob)
usr << "You gain a level! You are now level [usr.level + 1]!"
usr.spower += 4 + rand(1, 2)
usr.npower += 4 + rand(1, 2)
usr.cpower += 4 + rand(1, 2)
usr.power += 4 + rand(1, 2)
usr.defense += rand(1,3)
usr.MaxHP += 10 + rand (5,10)
usr.MaxMP += 10 + rand (5,10)
usr.level += 1
usr.exp = 0
usr.expreq *= 1.5
usr.HP = usr.MaxHP
usr.MP = usr.MaxMP
p.s. sorry for the bump but this is not a dbz game
One of the parameters of checklevel is a mob so make sure you send it a mob. So that would be checklevel(usr).
In response to SpSpiff
SpSpiff wrote:
One of the parameters of checklevel is a mob so make sure you send it a mob. So that would be checklevel(usr).

That won't work. You need to do usr.checklevel()
In response to Scoobert
Scoobert wrote:
p.s. sorry for the bump but this is not a dbz game

Did you know there is an edit button for your post? Just trying to help.
In response to Skysaw
runtime error: Cannot read null.exp.
proc name: checklevel (/mob/proc/checklevel)
source file: bustahit.dm,86
usr: [King] Scoobert (/mob/player)
src: [King] Scoobert (/mob/player)
call stack:
[King] Scoobert (/mob/player): checklevel(null)
the bug (/mob/enemy/bug): DeathCheck()
[King] Scoobert (/mob/player): slash(the bug (/mob/enemy/bug))

i get that runtime
In response to Scoobert
If you don't send checklevel anything, it will pass null into the proc and then will give you the error of modifying null.exp. Since checklevel is already a mob proc and usr is a mob, all you need to do is checklevel(usr) to eliminate your runtime error, despite what Skysaw said.
In response to SpSpiff
oh ok thx
In response to SpSpiff
SpSpiff wrote:
If you don't send checklevel anything, it will pass null into the proc and then will give you the error of modifying null.exp. Since checklevel is already a mob proc and usr is a mob, all you need to do is checklevel(usr) to eliminate your runtime error, despite what Skysaw said.

Upon looking at this again, I see the main problem is that you have to pass anything at all. This is a proc owned by the mob, so why pass it a mob? In addition, usr needs to be switched to src. The entire last section should be rewritten as follows:
mob
proc
checklevel()
if (exp >= expreq)
levelup()

levelup()
src << "You gain a level! You are now level [level + 1]!"
spower += rand(5, 6)
npower += rand(5, 6)
cpower += rand(5, 6)
power += rand(1, 2)
defense += rand(1, 3)
MaxHP += rand (15, 20)
MaxMP += rand (15, 20)
level ++
exp = 0
expreq *= 1.5
HP = MaxHP
MP = MaxMP