mob
verb
Attack(mob/M in oview(1))
if(M.attackable == 0)
usr << "You can't attack this person unless there in The Arena or marked as PK!"
return
if(M.attackable == 1)
usr << "You can't attack this NPC!"
return
else
if(!M)
usr << "No target to attack!"
else
var/randumdmg = rand(1,3)
var/dmg = src.atk * randumdmg - M.def
if(dmg <= 0)
if(prob(5))
usr << "You do [dmg] damage to [M]!"
M << "[src] damages you for [dmg] damage!"
M.hp -= dmg
M.deathcheck(src)
else
src << "You miss [M]!"
M << "[src] misses you!"
else
if(prob(5))
src << "Critical Hit!"
dmg *= 2
src << "You do [dmg] damage to [M]!"
M << "[src] damages you for [dmg] damage!"
M.hp -= dmg
M.deathcheck(src)
else
src << "You do [dmg] damage to [M]!"
M << "[src] damages you for [dmg] damage!"
M.hp -= dmg
M.deathcheck(src)
sleep(20)
Problem description:
Nategrant (/mob/players/Berserker): Attack(null)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
usr: Nategrant (/mob/players/Berserker)
src: Nategrant (/mob/players/Berserker)
call stack:
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
well during the hosting i always get that error (the berserker part is just the class)
This line is pointless where it is. If M is null, then the verb will crash on the if(M.attackable == 0) line, so it will never be reached.
That else should not be there. It will technically work, but logically it makes no sense. Alternatively, remove the return statements and change the second if() to else if()
This can deal a negative amount of damage.
You've repeated some code here. The else statement and everything in it can be nixed, and every line after dmg *= 2 can just be unindented once.
sleep(20)
This sleep() is worthless.
As for the problem you're having... Attack() is being called without an argument somehow. This should generally not be happening under normal circumstances for verbs, but if you're calling it in the code somewhere, that'll happen. However, the fact that you didn't post the error correctly - the call stack is missing - means that I can't say for sure what you did wrong.