Code:
symbols
message startup
message pulse
thing player
thing trooper
flex movespeed=1.75
flex thinkRate=1.0
flex ctrlocator=0.30 local
flex ctrlocator1=0.25 local
vector position0 local
end
# ========================================================================================
code
startup:
AiSetMoveSpeed(trooper, movespeed);
SetPulse(thinkRate);
return;
# ........................................................................................
pulse:
position0 = GetThingPos(player);
if (VectorDist(GetThingPos(trooper), position0) > ctrlocator) {
AISetLookPos(trooper, position0);
AiSetMoveThing(trooper, player);
}
if (VectorDist(GetThingPos(trooper), position0) < ctrlocator1) {
StopThing(trooper)
}
if (GetHealth(trooper) <= 0.0) {
SetPulse(0.0);
}
return;
end