ok, i am working on eventually getting a friendly stormie to follow you around and fires at enemies... but right now i am just figuring out how to get an actor to follow you.
i have it working as of now so that if the actor is ever further than 0.3 distance from you it will move to your current location... but the problem it it moves to your exact location, bumping the player out of the way to get there. i want to get it so once the actor is within 0.3 of the player the actor will STOP...
any help??
Code:symbols
message startup
message pulse
thing player
thing trooper
flex movespeed=1.5
flex thinkRate=1.0
flex ctrlocator=0.30 local
vector position0 local
end
# ========================================================================================
code
startup:
AiSetMoveSpeed(trooper, movespeed);
SetPulse(thinkRate);
return;
# ........................................................................................
pulse:
position0 = GetThingPos(player);
if (VectorDist(GetThingPos(trooper), position0) < ctrlocator) {
return;
}
else {
AISetLookPos(trooper, position0);
AiSetMoveThing(trooper, player);
}
if (GetHealth(trooper) <= 0.0) {
SetPulse(0.0);
}
return;
end