Re: Checking distance from an actor via Lua
So, what I'm trying to do is crate a gun whose rounds explode after a certain time after they come within range of a target; the purpose being that the explode inside said target (they'll probably be dead already, but it could be used for busting bunkers). I also don't want it to explode on allies, so it only explodes on enemy actors. This is what I have:
Quote:
function Update(self)
if SceneMan:shortestDistance(self.Pos,actor.Pos,true).Magnitude <= 30
and actor.Team ~= self.Team
and dist.timer:IsPastSimMS(1000) == true then
self.timer = Timer();
break
end
if self.timer:IsPastSimMS(1000) == true then
self.GibThis()
end
It seems as if the round just explodes on impact. Help!