Data Realms Fan Forums
http://45.55.195.193/

Gun turrets
http://45.55.195.193/viewtopic.php?f=1&t=17152
Page 1 of 1

Author:  caekdaemon [ Tue Nov 17, 2009 10:02 pm ]
Post subject:  Gun turrets

I want to make a craft with gun turrets Above the main bulk of the craft, but bellow the front, but I dont want the shells to hit the craft, Im trying to lay it out so that its a Heavily Armed Craft, still capable of dilivery and Bombardment. The problem is I dont know how to put guns on said craft.

Author:  Metal Meltdown [ Tue Nov 17, 2009 10:09 pm ]
Post subject:  Re: Gun turrets

FireIgnoresThis (or Parent, can't remember right now, nor do I have have anything handy to check) = 1 on the turret's weapon. That's for the shells hitting the craft bit. Before Grif or someone who knows Lua points out that this idea is stupid (mostly because it is), you would have to make the sides of the craft attachables attached to the turrets.

Author:  dragonxp [ Wed Nov 18, 2009 12:08 am ]
Post subject:  Re: Gun turrets

Code:
function Create(self)
   --working variables
   self.Turret = {};
   --create the turrets.
   self.Turret[1] = CreateACrab("<Preset Name>");
   MovableMan:AddActor(self.Turret[1]);
   self.Turret[1].Offset = Vector(-3,-31);
end

function Destroy(self)
   for i = 1, #self.Turret do
      if MovableMan:IsActor(self.Turret[i]) == true then
         if self.Health < 1 then
            self.Turret[i]:GibThis()
         else
            self.Turret[i].ToDelete = true
         end
      end
   end
end

function Update(self)
   --update turret spatial properties
   for i = 1, #self.Turret do
      if MovableMan:IsActor(self.Turret[i]) == true then
         --basic turret position upkeep (so it doesn't fall at 999999m/s)
         self.Turret[i].Vel.X = 0;
         self.Turret[i].Vel.Y = 0;
         --update turret position
         self.Turret[i].RotAngle = self.RotAngle;
         self.Turret[i].Pos = self.Pos + self:RotateOffset(self.Turret[i].Offset)
      end
   end

end

Code:
self.Turret[2] = CreateACrab("<Preset Name>");
   MovableMan:AddActor(self.Turret[1]);
   self.Turret[2].Offset = Vector(-3,-31);


Copy this under the self.turret[1] for additional turrets.

Lua i learned from the Coalition heavy dropship.
Hope this help, i dont know what you mean about below front but above the top though. Maybe in the middle? :???:

Author:  caekdaemon [ Wed Nov 18, 2009 2:34 pm ]
Post subject:  Re: Gun turrets

Im trying to Create the battlestar Galactica in-game, Il test your code in a minute.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/