How do i get a npc to move?

I want a exsisting npc (not a snpc) to move to a point.

The code:

    ent:SetSchedule( SCHED_FORCED_GO_RUN )

Does indeed make the npc move.

But there is a problem, if the npc walk close to a enemy, it attacks while running.
It should stand and shoot.
And then continue to run.

What is the different ways to make a npc move?
What is the best way?


Uh, how do you use it?

I don’t get where i should place the file (when making gamemod)

And do you have a code example on how i make a npc walk (as described) to a point, using this?

I actually don’t need a advanced pathfinder, while i don’t have any obstacles between point A and point B (but i would like to know how to use it, for use in other maps or for adding cool thingies to the current map). I only need a movement system that works as described.

But thanks for the reply =)
It looked interesting (but also confusing)

Is there a way to use lua to trigger on-the-run-set-up Hammer move entitys?