Blockland Forums > Modification Help

Constant Ammo Leech

Pages: (1/1)

RedGajin:

Is it possible to make it so when a player equips an item, the amount of ammo it has is leeched from it, and when unequipped, the leech stops?


infiniteLoop:

You mean like a constant ammo drain of some sort when a player is wielding the weapon? If yes, then this can be done quite easily.

edit: This is one way to do it.

package something
{
   function weaponImage::onMount(%this,%player,%a)
   {
      parent::onMount(%this,%player,%a);
      if(%this.getName() $= "someWeaponImage")
      {
         //Some code to start leeching
      }
   }

   function weaponImage::onUnMount(%this,%player,%a)
   {
      if(%this.getName() $= "someWeaponImage")
      {
         //Some code to stop leeching
      }
      parent::onUnMount(%this,%player,%a);
   }
};
activatePackage(something);


RedGajin:

Ah, thanks. Will see if I can get this to work.

Pages: (1/1)

Go to full version