View unanswered posts | View active topics It is currently Wed Dec 25, 2024 5:16 pm



Reply to topic  [ 2 posts ] 
 Weapon Gibs based on remaining ammo/mag status? 
Author Message
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Weapon Gibs based on remaining ammo/mag status?
...thinking of how to phrase this is awkward--

What I want to do is have a weapon's 'gibs' be altered by how many rounds it has left in its magazine when it's destroyed, either spawning a set number of particles/etc. for each round remaining, or based on steps (if more than x spawn a projectiles, if more than y spawn b projectiles, etc. etc.).

Basically volatile ammo that goes up with the gun; the more rounds it's holding when it gibs, the bigger the boom.

Anyone have a script for one or other of those handy, or time to whip one up if not?


Fri Jul 05, 2013 12:27 pm
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Weapon Gibs based on remaining ammo/mag status?
Arcalane wrote:
either spawning a set number of particles/etc. for each round remaining,

Code:
function Create(self)

   if self.Magazine then
      self.ammoCounter = self.Magazine.RoundCount;
   else
      self.ammoCounter = 0;
   end

end

function Update(self)

   if self.Magazine ~= nil then
      self.ammoCounter = self.Magazine.RoundCount;
   else
      self.ammoCounter = 0;
   end

end

function Destroy(self)

   for i = 1, self.ammoCounter do
      self.gib = CreateTDExplosive("Frag Grenade");
      self.gib.Pos = self.Pos;
      MovableMan:AddParticle(self.gib);
   end

end

Arcalane wrote:
or based on steps (if more than x spawn a projectiles, if more than y spawn b projectiles, etc. etc.).

Code:
function Create(self)

   if self.Magazine then
      self.ammoCounter = self.Magazine.RoundCount;
   else
      self.ammoCounter = 0;
   end

end

function Update(self)

   if self.Magazine ~= nil then
      self.ammoCounter = self.Magazine.RoundCount;
   else
      self.ammoCounter = 0;
   end

end

function Destroy(self)

   if self.ammoCounter > 3 and self.ammoCounter < 5 then
      self.gib = CreateTDExplosive("Frag Grenade");
      self.gib.Pos = self.Pos;
      MovableMan:AddParticle(self.gib);
   end

   if self.ammoCounter >= 5 and self.ammoCounter < 10 then
      self.gib = CreateTDExplosive("Pineapple Grenade");
      self.gib.Pos = self.Pos;
      MovableMan:AddParticle(self.gib);
   end

end


Mon Jul 15, 2013 8:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.093s | 13 Queries | GZIP : Off ]