ID:150355
 
this is my code:

mob/verb/Attack(mob/M in oview (1))
var/damage=rand(1,12)//This will be a rand-random number between 1 and 12 (45,54)
M.hp-=damage
M.deathcheck
if (usr hp==0)
src<<"[M] has died!"

and this is the error:

Knights n' Wizards.dm:61:error: hp: missing comma ',' or right-paren ')'

Vegetto5748 wrote:
this is my code:

mob/verb/Attack(mob/M in oview (1))
var/damage=rand(1,12)//This will be a rand-random number between 1 and 12 (45,54)
M.hp-=damage
M.deathcheck
if (usr hp==0)
src<<"[M] has died!"

and this is the error:

Knights n' Wizards.dm:61:error: hp: missing comma ',' or right-paren ')'

Just a few things about your code:
  • Why do you have the (45,54)?
  • You should have src changed to usr because you're using a verb
  • You should have <=0 instead of == because in most cases the health will goto negs and using == will do nothing if it goes below 0 and <= will
  • if(usr hp==0) should be if(M.health<=0) because you want it to check the victum's hp and not the usr and the space (M hp) should be (M.hp)

    and
  • usr<<("[M] has died!") should be indented over one to the right.
In response to Nadrew

mob/verb/Attack(mob/M in oview (1))
var/damage=rand(1,12)//This will be a rand-random number between 1 and 12 (45,54)
M.hp-=damage
M.deathcheck
if(usr.hp==0)
src<<"Bonzi Bonzi Bonzi Bonzi"

Add period between usr and hp