ID:142608
 
Code:
mob
verb
A(mob/M as mob in oview(1))
set category= "Fighting"
set hidden=1
flick('basepunch.dmi',usr)
if(usr.pk==0)
usr<<"your in a non pk place"
return
var/damage = usr.Str/3
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.Hp -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()


Problem description:

hi , im trying to make it so that when i use my attack verb it still shows my icon punching even when there is no1 to punch, right now my guy only siwtch icons to the punching icon when there is a mob beside him.. can someone midify my coding so that it punchs anywhere and hurts a mob if there beside him aswell
Instead of taking an argument, use locate() to find a mob in oview(1). If there's one there (if(M)), hurt them. Whether you find one or not, punch.

Also:

                M:deathcheck()


That's a red flag, you should not be using the colon operator and you should be passing it an argument.. You've screwed up your deathcheck() proc, post it so I can fix that.
mob
verb
A()
set category= "Fighting"
set hidden=1
flick('basepunch.dmi',usr)
if(usr.pk==0)
usr<<"your in a non pk place"
return
for(var/mob/M in get_step(usr,usr.dir)) //attack every mob in the turf in front of you
var/damage = usr.Str/3
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.Hp -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()