ID:142826
 
Code:
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)
                    if(!M)
usr << "No target to attack!"


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.

                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


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()

                        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)


This can deal a negative amount of damage.

                            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)


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.
In response to Garthor
ill post the ENTIRE error code
Tue Feb 26 20:11:11 2008
World opened on network port 5774.
Welcome BYOND! (4.0 Beta Version 412.977)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
usr: Nategrant (/mob/players/Berserker)
src: Nategrant (/mob/players/Berserker)
call stack:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
Nategrant (/mob/players/Berserker): Attack(null)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)
runtime error: Cannot read null.attackable
proc name: Attack (/mob/verb/Attack)

also for the things I did wrong could you tell me how to fix like negative damage?
In response to Nategrant
Under what conditions, exactly, do you get this error?

It also occurs to me that you might've cut out a chunk of the verb, because the indentation is off. Did you?
In response to Garthor
well I was testing something to try and get rid of the error but it didn't do anything so I just got rid of that bit of code.. it happens when you attack mobs and keep attacking or might be when you do more dmg then there health? idk just whenever someone kills a monster.
In response to Nategrant
Well if you're calling Attack() from your code then your problem is that you're trying to attack something that no longer exists. You need to check if it exists before you treat it as if it does.
In response to Garthor
Could it be there clicking so fast they kill it twice? well i gtg to bed hope you can help on the other things as well.
In response to Garthor
ok it happends if you kep clicking attack and kill something... then keep killing it?
In response to Nategrant
Well, show where you are calling Attack().
In response to Garthor
well the verb is the only time it is called.
In response to Nategrant
In which case you haven't shown the entire attack verb. This error would be caused by there being a sleep in the verb somewhere, during which the mob is deleted by something else.
mob
verb
Attack(mob/M in oview(1))
if(!M)
return


This might fix it, I tried this code got an error, Did that and the error was gone, I got the error when the Mob you attacked already died.
In response to Vegetassj9
The thing is that a line like that shouldn't be needed at all, and there's an underlying problem causing Attack() to be called incorrectly.