Re: Can someone make script for...
Code:
detdist = 500;
if MovableMan:IsActor(self.target) == false then
local curdist = 5000;
for actor in MovableMan.Actors do
local avgx = actor.Pos.X - self.Pos.X;
local avgy = actor.Pos.Y - self.Pos.Y;
local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
if dist < curdist and actor.Team ~= self.Team then --THIS LINE
curdist = dist;
self.target = actor;
if dist <= detdist then
self:GibThis()
end
end
end
end
Will make the object gib when it get's closer than 500px to any actor.
If you want your script to only react to a special kind of actor, replace the line with "--THIS LINE" with the following:
Code:
if dist < curdist and actor.Team ~= self.Team and actor.ClassName == "ACRocket"
or
if dist < curdist and actor.Team ~= self.Team and not actor.ClassName == "ACrab" then
The first line will make it blow up only when it's next to a ACRocket, the second line will make it not explode next to ACrabs.