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 [M.str] damage!"
if(M.hp <= 0)
src << "You killed [M]!"
M.Death()
else
M.Battle2()
mob
proc
Battle2(var/mob/M)
M.hp -= src.str
M << "You were attacked by [src] for [src.str] damage!"
if(M.hp <= 0)
view(10) << "[M] was killed!"
M.Death()
else
M.Battle()
mob
proc
Death(var/mob/M)
if(!M.client)
M.hp = M.maxhp
oview(10) <<"[M] has been killed!"
del(src)
else
src << "You killed [src]!"
del(M)
Problem description: I really don't see what I'm doin wrong but apparently it's something. Your help would be greatly appreciated.
Errors:
runtime error: Cannot read null.hp
proc name: Battle2 (/mob/proc/Battle2)
source file: battle.dm,19
usr: Mecha Destroyer JD (/mob)
src: Goop (/mob/Monsters/Goop)
call stack:
Goop (/mob/Monsters/Goop): Battle2(null)
Mecha Destroyer JD (/mob): Battle(Goop (/mob/Monsters/Goop))
Mecha Destroyer JD (/mob): Start Battle(Goop (/mob/Monsters/Goop))
runtime error: Cannot read null.client
proc name: Death (/mob/proc/Death)
source file: procs.dm,20
usr: Mecha Destroyer JD (/mob)
src: Goop (/mob/Monsters/Goop)
call stack:
Goop (/mob/Monsters/Goop): Death(null)
Mecha Destroyer JD (/mob): Battle(Goop (/mob/Monsters/Goop))
Mecha Destroyer JD (/mob): Start Battle(Goop (/mob/Monsters/Goop))
[edit]You're also abusing usr in a proc! oview, view, range, orange, etc. default to usr