Data Realms Fan Forums
http://45.55.195.193/

Pilot Ejection
http://45.55.195.193/viewtopic.php?f=1&t=45878
Page 1 of 1

Author:  Silent00 [ Sat Dec 20, 2014 2:40 pm ]
Post subject:  Pilot Ejection

After I made a new, huge amount updates for the ACTA mod, such as a actors and weapons, and the ejecting pods for the AC Crafts....

I made this eject pods like this:




if without a Team = 1 for the actor(s), they'll be as a neutral team though, it stills remain a Red team even I plays as a other team. Is there any lua for this?

Author:  Asklar [ Sat Dec 20, 2014 9:31 pm ]
Post subject:  Re: Pilot Ejection

There are many ways to do this. The only problem I see is that with Lua, detecting the pilot and his escape craft would be somewhat complicated since they are all gibs, so if you attach the script to the DropShip and make it trigger on it's destruction, it won't be able to change the team of the pilot.

I'm not really sure of why the craft gib into a MOSRotating that then gibs into the ACDropShip instead of gibbing the craft into the ACDropShip right away. In case this doesn't really matter, the "easy" option would be directly creating all the things with Lua:

Code:
function Create(self)
   self.eject = CreateACDropShip("Pilot Release");
   self.eject.Team = self.Team;
   self.pilot = CreateAHuman("R-FP 44-1C");
   self.pilot.Team = self.Team;
   self.pilot:AddInventoryItem(CreateHDFirearm("PL2-Kl"));
   self.eject:AddInventoryItem(self.pilot);
end

function Destroy(self)
   self.eject.Pos = self.Pos;
   self.eject.Vel = self.Vel; --to give it an inertia-like movement when spawned
   MovableMan:AddActor(self.eject);
end


Something like that would be enough.

Author:  Silent00 [ Sun Dec 21, 2014 8:27 am ]
Post subject:  Re: Pilot Ejection

thanks, does it have eject more at once?

Author:  Asklar [ Mon Dec 22, 2014 2:18 am ]
Post subject:  Re: Pilot Ejection

I didn't get your question, you mean if it can eject more than one pilot/escpae pod at once? Yeah, you can.

Author:  Silent00 [ Mon Dec 22, 2014 9:08 am ]
Post subject:  Re: Pilot Ejection

but how?

Author:  Asklar [ Mon Dec 22, 2014 8:44 pm ]
Post subject:  Re: Pilot Ejection

Simply defining more ejects and pilots, though you'd have to be careful to place the ejection things in such way that they won't overlap with each other, since that would cause them to explode or something.

For example,

Code:
function Create(self)
   self.eject = CreateACDropShip("Pilot Release");
   self.eject.Team = self.Team;
   self.pilot = CreateAHuman("R-FP 44-1C");
   self.pilot.Team = self.Team;
   self.pilot:AddInventoryItem(CreateHDFirearm("PL2-Kl"));
   self.eject:AddInventoryItem(self.pilot);

   self.eject2 = CreateACDropShip("Pilot Release");
   self.eject2.Team = self.Team;
   self.pilot2 = CreateAHuman("R-FP 44-1C");
   self.pilot2.Team = self.Team;
   self.pilot2:AddInventoryItem(CreateHDFirearm("PL2-Kl"));
   self.eject2:AddInventoryItem(self.pilot2);
end

function Destroy(self)
   self.eject.Pos = self.Pos + Vector(-30,0); -- this (-30,0) vector is just a place holder, replace it for a better value later
   self.eject.Vel = self.Vel;

   self.eject2.Pos = self.Pos + Vector(30,0);
   self.eject2.Vel = self.Vel;

   MovableMan:AddActor(self.eject);
   MovableMan:AddActor(self.eject2);
end


That would allow you to bring out more escape pods. If you'd like to add more, you simply have to copy and paste the obviously copy/pasted chunk and rename the variables (adding a number at the end).

Author:  Silent00 [ Tue Dec 23, 2014 2:51 am ]
Post subject:  Re: Pilot Ejection

Ok, I made this, but when the dropships left in the orbit, it left a pod instead along with it. It must've been only deleting AC.

Author:  Asklar [ Tue Dec 23, 2014 3:55 am ]
Post subject:  Re: Pilot Ejection

I'm not sure if a health check would be enough because instant gibbing might not set the health of the craft to 0. Maybe a height check?

Code:
function Create(self)
   self.eject = CreateACDropShip("Pilot Release");
   self.eject.Team = self.Team;
   self.pilot = CreateAHuman("R-FP 44-1C");
   self.pilot.Team = self.Team;
   self.pilot:AddInventoryItem(CreateHDFirearm("PL2-Kl"));
   self.eject:AddInventoryItem(self.pilot);

   self.eject2 = CreateACDropShip("Pilot Release");
   self.eject2.Team = self.Team;
   self.pilot2 = CreateAHuman("R-FP 44-1C");
   self.pilot2.Team = self.Team;
   self.pilot2:AddInventoryItem(CreateHDFirearm("PL2-Kl"));
   self.eject2:AddInventoryItem(self.pilot2);
end

function Destroy(self)
   if self.Pos.Y > 0 then
      self.eject.Pos = self.Pos + Vector(-30,0); -- this (-30,0) vector is just a place holder, replace it for a better value later
      self.eject.Vel = self.Vel;

      self.eject2.Pos = self.Pos + Vector(30,0);
      self.eject2.Vel = self.Vel;

      MovableMan:AddActor(self.eject);
      MovableMan:AddActor(self.eject2);
   end
end

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