ID:1206378
 
(See the best response by Kaiochao.)
Code:
mob
verb
Punch()
flick("PunchR",usr)
for(var/mob/m in get_step(src, dir))
usr<<"[m]"


Problem description:

Okay, what I need some help with, is this. Eventually, I'm going to set "Punch" to the A Key Macro, and work out all the damage, but I don't want to do that all just yet.

The issue with this, is when I'm running and punching at the same time, I register as punching myself. Another thing, is I want to make it a 50/50 chance of either flicking the state PunchR or PunchL..
Could anyone help?

mob/verb/A()
flick(pick("PunchR","PunchL"), src)
var/mob/m = locate() in get_step(src, dir)
if(m){ your conditional block here; }


Here's your very basic example, I made the name under the key to press, change it to your likings.
In the above code, if you can't spot it right away when you use it he had a small typo. "in get_step" is the correction on line 3.

Do you need help with setting up damage and subtracting health, etc? Or do you have that covered?
Best response
The only way you could be hitting yourself by checking a turf that isn't your own loc would be that you're using pixel movement. Pixel movement will cause you to take up multiple turfs at once, so your detection will have to account for that.

This might be the basic idea.
mob
verb/Punch()
flick("Punch[pick("L", "R")]", src)
// 16 is a pixel distance away from your bounding box in all directions.
// You can change it to whatever you think is best, of course.
for(var/mob/m in obounds(16))
// Make sure you're facing the mob we've detected.
if(dir == get_dir(src, m))
src << m

This code will work with tile movement too, actually.