ID:157090
 
So I'm wanting to make interactions between an npc and a target, like say a rebel controlled by a player, if he sees the rebel hence, in view() he will walk towards him and when in range attack. How might I do this?
Look up the procs view(), walk_towards(), and get_dist() in the reference.

view() to see if the "rebel" is actually visible, walk_towards() to move the player to the "rebel," and finally get_dist() to check how close the player is from the "rebel," where you will then call some sort of attack procedure if the player is close enough to the "rebel."
In response to Koil (#1)
I know about view() walk_towards, and etc. I'm asking in specific how might I get it so that it knows when specifically a rebel is in it's view and then act based upon that?
In response to CodeWeasel22 (#2)
var/mob/rebel/R = locate() in view(src)
if(R)
step_towards(src,R)