ID:139046
 
My first issue is this for some reason (Im sure its simple for everyone else) my npc is dies in one hit even if its health is set at 1000 and i am a lowly level 1 player
Code:
mob
proc

DeathCheck()



if(src.NPC|src.health <= 0) // if Hp is zero you die
src.NPC = 1
view() << "[src] dies!" // tells people in the view that the person has died
del(src)
Respawn()
src.health = maxhealth // restores their hp
src.Move(locate(180,282,1)) // moves them to the coordinates

My second issue is this my level up will only go to like level 4 then it will stop leveling the player level and start on the str level
LevelUp()
if(src.exp>=src.max_exp)
src.max_exp+=rand(5,20) //makes it harder to levelup next time
usr.maxhealth += rand(10,15) //increases their maxhp
src.level+=1
src.exp = 0 //resets their exp
usr << "Congrats on makeing level [level] you earned it!"
src.strexp+=rand(10,25) //increases their strength a random amount
strlevl() //gives them their str new level


im havin more issues but I wanna see if I can solve those on my own by consulting the dm guide (yes i printed it out)

For the Deathcheck proc, try using

if(src.NPC&&src.health <= 0)

instead of

if(src.NPC|src.health <= 0).

If that doesn't work, then the problem might be where you assign damage.

As for leveling up, I'm not sure. Double-check the strlevl() proc.
You want ||, not |. || is the OR operator, | is the bit-operator/binary OR.

And watch out for && and &, && = AND operator, & = bit-operator/binary AND
In response to GhostAnime
GhostAnime wrote:
You want ||, not |. || is the OR operator, | is the bit-operator/binary OR.

And watch out for && and &, && = AND operator, & = bit-operator/binary AND
Although this is true, you really do want to use &&, not ||, like Pepper suggested. You are making it so if src.npc is true OR the src's health is 0, it dies. Don't you want it so both have to be true?
In response to Xyphon101
He was only telling him the correct usage for | and ||.
In response to Neimo
the
if(src.NPC&&src.health <= 0)
fixed the death issue now im workin on the level up thing thank u all for the help on that one
In response to Neimo
Neimo wrote:
He was only telling him the correct usage for | and ||.
I realize that, I was just making sure the OP knew what he should have instead of ||.