ID:2090200
 
(See the best response by Lummox JR.)
Code:
mob/verb/Attack(mob/M as mob in oview(1))
if(Resting) return
icon_state = "Attack"
sleep(2)
icon_state = ""
M.Health = M.Health - (usr.Strength / M.Durability)+(usr.Battle_Power/(M.Battle_Power*10))*rand(1,1.5)


Problem description: I'm trying to make things like "Grab", "Push", "Punch", etc. only be able to affect someone in the three tiles in front of you, but all I've seen on this is being able to do this in all directions.

Best response
Instead of giving the verb an argument, just make it a generic attack verb with no argument.

mob/verb/Attack()
if(busy) return // just a generic is-busy check
busy |= BUSY_ATTACKING
flick("Attack", src)
spawn(2) busy &= ~BUSY_ATTACKING

for(var/mob/M in get_step(src, dir))
M.TakeDamage(Strength / (M.Durability||1) +\
(Battle_Power / (M.Battle_Power||1)) * (0.1+0.05*rand()),\
src)
Lummox JR wrote:
src
In response to Zagros5000
Zagros5000 wrote:
Lummox JR wrote:
src

I have no idea what the point of that comment was.
Neither do I, but I tested it and it seems to work, thxs.
rnt u always preaching not to use src in verbs
In response to Zagros5000
Zagros5000 wrote:
rnt u always preaching not to use src in verbs

usr in procs
In response to MDC
oh lol


awkward
rnt u always preaching not to use src in verbs