ID:148236
 
Heres the bug i get when i run into a monster:

runtime error: Cannot modify null.lib.
proc name: Battle (/mob/proc/Battle)
source file: BattleRevised.dm,8
usr: Metroid (/mob/blue)
src: Dark Slime (/mob/monster/Dark_Slime)
call stack:
Dark Slime (/mob/monster/Dark_Slime): Battle(null)
Dark Slime (/mob/monster/Dark_Slime): Bumped(Metroid (/mob/blue))
Metroid (/mob/blue): Bump(Dark Slime (/mob/monster/Dark_Slime))
Metroid (/mob/blue): Move( (36,82,4) (/turf/grass2), 1)
Metroid (/mob/blue): Move( (36,82,4) (/turf/grass2), 1)

If you need My Battle() then here it is
mob
proc
Battle(mob/M)
M.lib = 1
M.battle = 1
if(M.defend == 1)
M.defense /= 2
M.defend = 0
switch(alert("[src] encountered! Command?",,"Commence Battle","Defend","Run"))
if("Commence Battle")
CommencedBattle(M)
if("Defend")
M.defense *= 2
M.defend = 1
NPCDeathCheck(M)
if("Run")
Run(M)


Whats wrong?
The null.lib error comes from the line where you change M.lib, which means M is null in this proc. That means when you called Battle(), you forgot to call it with an M like Battle(themob).

Lummox JR
In response to Lummox JR
Oh yea, thanks
In response to Metroid
Now I got Monsters.dm:747:error:M:undefined var for all the Battle(M)s for each monster. Heres an example.
Warrior
icon = 'slimes.dmi'
icon_state = "ragnar"
name = "Warrior"
hp = 23424
mp = 0
expreward = 4012
jobexpreward = 100
gold = 8000
attack = 4233
defense = 3523
intelligence = 4000
agility = 1000
Bumped(O)
if(src.islocked == 1)
usr << "<font color = blue><b>Someone is already fighting this monster!"
else
usr.islocked=1
src.islocked=1
Battle(M)

Any way to fix it?
In response to Metroid
Try calling Battle(O) instead of M
In response to Jon88
I use M for my replacement of usr if thats what u want to call it
In response to Metroid
I know that, but that's just what Battle() uses internally, it needs to be called with what the current proc has replaced usr with.
            Bumped(O)
if(src.islocked == 1)
usr << "<font color = blue><b>Someone is already fighting this monster!"
else
usr.islocked=1
src.islocked=1
Battle(M)

Because Bumped(O) thinks O is the replacement for usr you need to call Battle(O) there. No need to change your Battle proc though.
In response to Jon88
You still have usr in there a couple of places.

Lummox JR