Data Realms Fan Forums
http://45.55.195.193/

A script that forces you to buy two guns in a set?
http://45.55.195.193/viewtopic.php?f=73&t=30691
Page 1 of 1

Author:  Miggles [ Wed Mar 14, 2012 1:23 am ]
Post subject:  A script that forces you to buy two guns in a set?

OK: What I'm trying to do is make a script that forces you to buy 2 guns at once, and when bought, you dual wield them.
Is there any way to do this?

Author:  Azukki [ Wed Mar 14, 2012 7:37 am ]
Post subject:  Re: A script that forces you to buy two guns in a set?

I don't think you can force the player to buy both guns as separate entries in the Midas ordering GUI, but you can offer one gun for sale which can have a script on it to add the second gun to the inventory of the first actor to hold it. The name and description could of course indicate to the player that buying the first gun will also get them the second.

Code:
function Update(self)
   if self.RootID ~= 255 and self.Sharpness == 1 then
      if self.RootID == self.ID then
         self.b = CreateHDFirearm("guna","Mod.rte")
         self.b.PresetName = self.PresetName
         self.b.Vel = self.Vel
         self.b.Pos = self.Pos
         MovableMan:AddParticle(self.b)
         self.c = CreateHDFirearm("gunb","Mod.rte")
         self.c.PresetName = self.PresetName
         self.c.Vel = self.Vel
         self.c.Pos = self.Pos
         MovableMan:AddParticle(self.c)
         self.Sharpness = 0
         self.ToDelete = true
         self.Lifetime = 0
      else
         self.y = MovableMan:GetMOFromID(self.RootID)
         if self.y then
            if self.y:IsActor() then
               self.z = ToAHuman(MovableMan:GetMOFromID(self.RootID))
               if self.z then
                  self.b = CreateHDFirearm("guna","Mod.rte")
                  self.b.PresetName = self.PresetName
                  self.z:AddInventoryItem(self.b)
                  self.c = CreateHDFirearm("gunb","Mod.rte")
                  self.c.PresetName = self.PresetName
                  self.z:AddInventoryItem(self.c)
                  self.z:GetController():SetState(Controller.WEAPON_CHANGE_PREV,true)
                  self.Sharpness = 0
                  self.ToDelete = true
                  self.Lifetime = 0
               end
            end
         end
      end
   end
end

I wound up making a similar script to this so I figured why not. Just apply this to a weapon with a sprite of the two guns next to each other, give it this script, and replace guna, gunb, and Mod.rte respectively.

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