First, try to cut-off with "//" vec_diff, result and sentry_turnto and replace wiht the "ugly" code you've have firs, I mean vec_set, vec_sub, vec_to_angle, to check if player is detecting.
Second, have you added to player's action: my.enable_scan =on; my.enable_detect = on; and player = me; ?
Third, maybe change Action Sentry01 to
while(me)
{
if(player ==null){wait(1);}
else
{
here paste sentrygun function
}
wait(1);
}
I'll try test it today and send You working and tested code later.
cheers