ID:178645
 
Why isn't it working this is my code and it looks fine to me and gets no errors
mob/verb/Hit(mob/M)
if(usr.sword==1 && hitting==0)
hitting=1
flick("sword",usr)
sleep(3)
hitting=0
if(usr.dir==get_dir(usr,M) && M as mob in oview(1))
M.hits-=1
usr << "hit"
else
return 0

The oview doesnt work because I still appear in the list when I hit.

Also is it possible to make oview work only for the direction you are facing. Im remeaking the nes Zelda if that will help you get a better picture of what im looking for.
You're using it in the wrong place, I believe. Try putting it like this:

<code>mob/verb/Hit(mob/M as mob in oview(1))) if(usr.sword==1 && hitting==0) hitting=1 flick("sword",usr) sleep(3) hitting=0 if(usr.dir==get_dir(usr,M)) M.hits-=1 usr << "hit"</code>

Although, for what you're doing I can recommend a better way; use get_step().

<code>mob/verb/Hit() if(usr.sword==1 && hitting = 0) hitting = 1 flick("sword",usr) sleep(3) hitting = 0 for(var/mob/M in get_step(usr,usr.dir)) M.hits-=1 usr << "hit" break</code>

That way, it will automatically hit the first mob it finds in the square one square in whatever direction you're facing. You won't be bothered by menu's that popup if there are multiple targets.