View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:30 pm



Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
 Attaching using lua 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Attaching using lua
Yeah you could attach a lua file to the turret in use this:

Code:
function Create(self)
    local curdist = 100;
    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 then
       curdist = dist;
       self.parent = actor;
   self.Team = self.parent.Team
   end
    end
end

function Update(self)
if self.parent == nil then
   self:GibThis();
end
end


Idk why the spacing is a little off.


Thu Jul 23, 2009 7:21 pm
Profile
User avatar

Joined: Wed Nov 22, 2006 3:19 pm
Posts: 2073
Reply with quote
Post Re: Attaching using lua
Mind wrote:
Yeah you could attach a lua file to the turret in use this:

Code:
blahblah


Idk why the spacing is a little off.


Doesn't work, and any edits I try cause gib on spawn.

I think i'm gonna stick with the Destroy(self) part.
I don't think it will cause any crashes because my turret is GetsHitByMOS = 0 (When set to 1 it ♥♥♥♥ everything up) anyway so there is no way for it to get destroyed before the ♥♥♥♥ itself.

Thanks for the help guys.


Thu Jul 23, 2009 8:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 17 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.262s | 13 Queries | GZIP : Off ]