ID:138698
 
(See the best response by LordAndrew.)
Mob
var
health = 20

verb
Attack(mob/M as mob in oview(1))
set category = "Commands"
if (usr.dir == NORTH)
if (M.loc = locate(usr.x,usr.y+1,usr.z))
var/damage = rand(1,10)
M.health -= damage
usr << "You hit [M] for [damage] damage!"
M:deathcheck()

proc
deathcheck()
if (src.health <= 0)
world << "[src] has been killed by [usr]!"
src.Move(locate(1,1,1))


it says that i am missing a left-hand argument to >> and when i did it, it says same thing
if (M.loc == locate(usr.x,usr.y+1,usr.z))

You forgot an equals sign.
In response to Unwanted4Murder
i added what u sayd in my code, same error came up :(
In response to Smilies
Post the error you're having and copy/paste the code within <d/m> (without the slash) tags. I'm having a little trouble understanding what exactly your problem is.
In response to Unwanted4Murder
i did the code you did and still says i am missing a >


Mob
var
health = 20

verb
Attack(mob/M as mob in oview(1))
set category = "Commands"
if (usr.dir == NORTH)
if(M.loc==locate(usr.x,usr.y+1,usr.z))

it is talking about the >var, when i added the > it keeps saying the same thing
In response to Smilies
...Is that literally what your code looks like? If so, you should be using indents (TAB key), not brackets (>).
In response to Unwanted4Murder
so you are telling me it should look like this?

Mob
var
health = 20

verb
Attack(mob/M as mob in oview(1))
set category = "Commands"
if (usr.dir == NORTH)
if(M.loc==locate(usr.x,usr.y+1,usr.z))
var/damage = rand(1,10)
M.health -= damage
usr << "You hit [M] for [damage] damage!"
M:deathcheck()

proc
deathcheck()
if (src.health <= 0)
world << "[src] has been killed by [usr]!"
src.Move(locate(1,1,1))


now it says i have 3 problems
M.health: undefined var
M/:/deathcheck: undefined proc
src.Move: undefined proc
In response to Smilies
NVM i got it !!!
Best response
Manually checking the player's direction and then checking if their target is offset for every single direction is a rather circuitous way of handling things. This can all be easily simplified by using get_step():

mob
verb
attack()
// mob/m as mob is redundant by the way, just mob/m works.
var/mob/m = locate() in get_step(src, dir)

if(m)
m.hit(src)

proc
hit(mob/attacker)
world << "[attacker] hits [src]."

do_damage(attacker, damage)

do_damage(mob/attacker, damage)
health -= damage

if(health <= 0)
die(attacker)

die(mob/attacker)
world << "[attacker] kills [src]!"