attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= damage //take away the damage from M
Problem description: I got the above code from the zbt tutorial which works fine but I'd like to modify it a bit by attacking a mob only if its 3 tiles above (x same, y + 3). So, maybe I will have to replae oview(1) with something else but I don't know what...
Thanks
http://www.byond.com/forum/?post=2090200
If you want it to always be 3 tiles above regardless of direction you're facing, you can use locate(x, y+3, z) to grab the turf 3 tiles above.
So the code would change to: