View unanswered posts | View active topics It is currently Sun Sep 29, 2024 4:59 am



Reply to topic  [ 4 posts ] 
 Gun turrets 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Sun Nov 01, 2009 3:00 pm
Posts: 4144
Location: Hell.
Reply with quote
Post 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.


Tue Nov 17, 2009 10:02 pm
Profile WWW
Banned
User avatar

Joined: Thu May 14, 2009 9:22 pm
Posts: 826
Location: Lookin' forward to mocking people on Jan 1st 2013.
Reply with quote
Post 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.


Tue Nov 17, 2009 10:09 pm
Profile YIM
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post 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? :???:


Wed Nov 18, 2009 12:08 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Sun Nov 01, 2009 3:00 pm
Posts: 4144
Location: Hell.
Reply with quote
Post Re: Gun turrets
Im trying to Create the battlestar Galactica in-game, Il test your code in a minute.


Wed Nov 18, 2009 2:34 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

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.047s | 13 Queries | GZIP : Off ]