ID:262376
 
Code:
mob
verb
Start_Battle()
src.Battle()
mob
proc
Battle(mob/M in oview(1))
switch(input("Battle") in list ("Attack", "Item", "Run"))
if("Attack")
M.hp -= src.str
src << "You hit [M] for [src.str] damage!"
M.Death()


Problem description: I keep getting this error: runtime error:
Cannot read null.hp
proc name: Battle (/mob/proc/Battle)
source file: battle.dm,6
usr: Mecha Destroyer JD (/mob)
src: Mecha Destroyer JD (/mob)
call stack:
Mecha Destroyer JD (/mob): Battle(null)
Mecha Destroyer JD (/mob): Start Battle()


I don't believe you can give that sort of argument to a proc, only in verbs can you do that.

You should do this:

 mob
verb
Start_Battle(mob/M in oview(1))
src.Battle(M)
mob
proc
Battle(var/mob/M)
switch(input("Battle") in list ("Attack", "Item", "Run"))
if("Attack")
M.hp -= src.str
src << "You hit [M] for [src.str] damage!"
M.Death()


I think that should work.
In response to Prodigal Squirrel
Aight thanks, it works..