View unanswered posts | View active topics It is currently Tue Apr 16, 2024 9:23 pm



Reply to topic  [ 3 posts ] 
 How to create a script to spawn a dropship? 
Author Message

Joined: Tue Dec 04, 2012 1:31 am
Posts: 45
Reply with quote
Post How to create a script to spawn a dropship?
I'm attempting to make a grenade that when thrown spawns a dropship loaded with two actors in it above it. I can't get it to do anything, at all, though.

Here's what i have so far...

Code:
function Update(self)
   if self.Fuze then
      if self.Fuze:IsPastSimMS(2000) then
         local Dropship = CreateACDropShip("Drop Ship MK1")
         local soldiera = CreateAHuman("Coalition Light", "Coalition.rte")
         soldiera:AddInventoryItem(CreateHDFirearm("Assault Rifle", "Coalition.rte"));
         soldiera:AddInventoryItem(CreateHDFirearm("Auto Pistol", Coalition.rte"));
         Dropship:AddInventoryItem(soldiera)
         local soldierb = CreateAHuman("Coalition Light", "Coalition.rte")
         soldierb:AddInventoryItem(RandomHDFirearm("Assault Rifle", "Coalition.rte"));
         soldierb:AddInventoryItem(RandomHDFirearm("Auto Pistol", "Coalition.rte"));
         Dropship:AddInventoryItem(soldierb)
         if Dropship then
            Dropship.Pos = Vector(self.Pos.X,0)
            MovableMan:AddActor(Dropship)
         end
         
         self:GibThis()
      end
   elseif self:IsActivated() then
      self.Fuze = Timer()
   end
end


Thu Feb 07, 2013 6:34 am
Profile
User avatar

Joined: Thu Jun 21, 2012 3:38 pm
Posts: 122
Location: On a little island called Puerto Rico
Reply with quote
Post Re: How to create a script to spawn a dropship?
. :skull: .

nubbles wrote:
I'm attempting to make a grenade that when thrown spawns a dropship loaded with two actors in it above it. I can't get it to do anything, at all, though.

Here's what i have so far...

Code:
function Update(self)
   if self.Fuze then
      if self.Fuze:IsPastSimMS(2000) then
         local Dropship = CreateACDropShip("Drop Ship MK1")
         local soldiera = CreateAHuman("Coalition Light", "Coalition.rte")
         soldiera:AddInventoryItem(CreateHDFirearm("Assault Rifle", "Coalition.rte"));
         soldiera:AddInventoryItem(CreateHDFirearm("Auto Pistol", Coalition.rte"));
         Dropship:AddInventoryItem(soldiera)
         local soldierb = CreateAHuman("Coalition Light", "Coalition.rte")
         soldierb:AddInventoryItem(RandomHDFirearm("Assault Rifle", "Coalition.rte"));
         soldierb:AddInventoryItem(RandomHDFirearm("Auto Pistol", "Coalition.rte"));
         Dropship:AddInventoryItem(soldierb)
         if Dropship then
            Dropship.Pos = Vector(self.Pos.X,0)
            MovableMan:AddActor(Dropship)
         end
         
         self:GibThis()
      end
   elseif self:IsActivated() then
      self.Fuze = Timer()
   end
end


I'm not to sure about the .lua but I believe that the actors can be added to the dropship in the .ini if you created a copy of the dropship that is not buyable. it should make coding it easier. cause all you would need to create would be the dropship. again i'm not to sure about lua but I think that you need to set the Y vector. cause if not the ship would spawn directly on your grenade.( I can't tell if its that peace of code you got there Dropship.Pos = Vector(self.Pos.X,0))

Also I believe there is a faction called Oni corps or tech(I think thats the name, I know there red and look like duke nukem pigs) that has a grenade beacon that spawns a drop-pod with a actor in it. You should take a look at it.

. :skull: .


Thu Feb 07, 2013 8:58 pm
Profile

Joined: Tue Dec 04, 2012 1:31 am
Posts: 45
Reply with quote
Post Re: How to create a script to spawn a dropship?
I got it working. Here's the finished script.
Code:
function Update(self)
   local theHolder = MovableMan:GetMOFromID(self.RootID)
   if MovableMan:IsActor(theHolder) then
      self.holder = theHolder;
   end
   if self.Fuze then
      if self.Fuze:IsPastSimMS(2000) then
         local Dropship = CreateACDropShip("Drop Ship MK1")
         local soldierb = CreateAHuman("Soldier Light", "Coalition.rte")
         soldierb:AddInventoryItem(CreateHDFirearm("Assault Rifle", "Coalition.rte"));
         soldierb:AddInventoryItem(CreateHDFirearm("Auto Pistol", "Coalition.rte"));
         Dropship:AddInventoryItem(soldierb)
         local secondsoldier = CreateAHuman("Soldier Light", "Coalition.rte")
         secondsoldier:AddInventoryItem(CreateHDFirearm("Assault Rifle", "Coalition.rte"));
         secondsoldier:AddInventoryItem(CreateHDFirearm("Auto Pistol", "Coalition.rte"));
         Dropship:AddInventoryItem(secondsoldier)
         if Dropship then
            Dropship.Pos = Vector(self.Pos.X,0)
            Dropship.Team = self.holder.Team
            MovableMan:AddActor(Dropship)
         end

         self:GibThis()
      end
   elseif self:IsActivated() then
      self.Fuze = Timer()
   end
end


Sun Feb 10, 2013 5:05 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.057s | 17 Queries | GZIP : Off ]