Well there is no science involved, just call it at the beginning of the function.
To your problem:
"not following correctly" can mean many things, so I have to ask/ guess:
- Does it work with a path attached in WED?
- Does the comparison in if(vec_dist(my.skill2,my.x) < 16) ever evaluate positive?
- Try
my.pan = my.skill8;
instead of
my.pan += clamp(ang(my.skill8-my.pan)*0.25,-5,5)*time_step;


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends