If you are going to use proximities for that and want them to work for a moving guard, you probably need to use a timer to update the proximity on a regular basis. Here is an example from a script I use:
Code:
$ProxRangeXY = 100;
$ProxRangeZ = 25;
sub EVENT_SPAWN {
quest::set_proximity($x - $ProxRangeXY, $x + $ProxRangeXY, $y - $ProxRangeXY, $y + $ProxRangeXY, $z - $ProxRangeZ, $z + $ProxRangeZ);
quest::settimer("setprox", 2);
}
sub EVENT_TIMER {
if ($timer eq "setprox") {
quest::clear_proximity();
quest::set_proximity($x - $ProxRangeXY, $x + $ProxRangeXY, $y - $ProxRangeXY, $y + $ProxRangeXY, $z - $ProxRangeZ, $z + $ProxRangeZ);
}
}