Data Realms Fan Forums
http://45.55.195.193/

Weapon Gibs based on remaining ammo/mag status?
http://45.55.195.193/viewtopic.php?f=73&t=45343
Page 1 of 1

Author:  Arcalane [ Fri Jul 05, 2013 12:27 pm ]
Post subject:  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?

Author:  CaveCricket48 [ Mon Jul 15, 2013 8:27 pm ]
Post subject:  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

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