mob
proc
TakeDamage(mob/attacker)
if (istype(src, /mob/characters))
var/damg =max(1, min(attacker.strength-src.defense * rand(1.1,1.3), 50))
var/dodge = (attacker.level-src.level)
if(dodge<=0)
var/r=rand(1,100)
if(r<=10)
attacker <<"<i>You hit nothing but air</i>"
else if(r<=15)
attacker <<"<i>[src] vanishes from sight</i>"
attacker.stamina -=3
attacker.fatigue +=3
else if(r<=25)
attacker <<"<i>[src] blocks your attack</i>"
src.icon_state="block"
sleep(20)
src.icon_state=""
src.hp-=damg/2
src.powerlevel-=damg * rand(20,200)
src << "<fontcolor=red><i>[attacker.name] hits you for [damg] damage</i></font>"
attacker << "<fontcolor=red><i>You hit [src] inflicting [damg] damage</i></font>"
src.KO()
else
src.hp-=damg
src.maxpowerlevel += rand(100,1000)
attacker << "<fontcolor=red><i>You hit [src] inflicting [damg] damage</i></font>"
src.powerlevel-= damg * rand(10,100)
src << "<fontcolor=red><i>[attacker.name] hits you for [damg] damage</i></font>"
src.KO()
else
src.hp-=damg
src.powerlevel-=damg*rand(10,250)
src.maxpowerlevel+=rand(500,1000)
src << "<fontcolor=red><i>[attacker.name] hits you for [damg] damage</i></font>"
attacker << "<fontcolor=red><i>You hit [src] inflicting [damg] damage</i></font>"
src.KO()
else
var/damg =max(1, min(attacker.powerlevel-src.powerlevel, 100))
src.hp-=damg
if(src.hp<=0)
del(src)
Problem description:
runtime error: Cannot read null.strength
proc name: TakeDamage (/mob/proc/TakeDamage)
source file: Procedures.dm,146
usr: Tales2008 (/mob/characters/cell)
src: Tales2008 (/mob/characters/cell)
call stack:
Tales2008 (/mob/characters/cell): TakeDamage(null)
Tales2008 (/mob/characters/cell): Attack(Tales2008 (/mob/characters/cell))
I have run out of ideas on how to approach this problem
Where do you attempt to access any object's "strength" variable?
var/damg =max(1, min(attacker.strength-src.defense * rand(1.1,1.3), 50))
This is the only place.
This error indicates [attacker] is null at runtime.
This is further proven by the stack trace:
Attack(Tales2008) is calling TakeDamage() with a null value for the first argument.
attacker is null in TakeDamage().