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.