GiMMLi's Scripting Tutorials

Adding a weapon  
Adding a new weapon!

//------------Armordata.cs------------
$ItemMax[larmor, Chaingun] = 1;
$ItemMax[marmor, Chaingun] = 1;
$ItemMax[harmor, Chaingun] = 1;
$ItemMax[lfemale, Chaingun] = 1;
$ItemMax[mfemale, Chaingun] = 1;

//-----------item.cs------------------
$AutoUse[Chaingun] = True;
$SellAmmo[BulletAmmo] = 25;
$WeaponAmmo[Chaingun] = BulletAmmo;
//----------------------------------------------------------------------------

ItemData BulletAmmo
{
description = "Bullet";
className = "Ammo";
shapeFile = "ammo1";
heading = "xAmmunition";
shadowDetailMask = 4;
price = 1;
};

ItemImageData ChaingunImage
{
shapeFile = "chaingun";
mountPoint = 0;

weaponType = 1; // Spinning
reloadTime = 0;
spinUpTime = 0.5;
spinDownTime = 3;
fireTime = 0.2;

ammoType = BulletAmmo;
projectileType = ChaingunBullet;
accuFire = false;

lightType = 3; // Weapon Fire
lightRadius = 3;
lightTime = 1;
lightColor = { 0.6, 1, 1 };

sfxFire = SoundFireChaingun;
sfxActivate = SoundPickUpWeapon;
sfxSpinUp = SoundSpinUp;
sfxSpinDown = SoundSpinDown;
};

ItemData Chaingun
{
description = "Chaingun";
className = "Weapon";
shapeFile = "chaingun";
hudIcon = "chain";
heading = "bWeapons";
shadowDetailMask = 4;
imageType = ChaingunImage;
price = 125;
showWeaponBar = true;
};


//----------Station.cs-------------------
$InvList[Chaingun] = 1;
$InvList[BulletAmmo] = 1;
$RemoteInvList[Chaingun] = 1;
$RemoteInvList[BulletAmmo] = 1;


//--Under station.cs find function Station::itemsToResupply(%player)
//--- and add this inbetween on of the lines you'll catch on

%cnt = %cnt + AmmoStation::resupply(%player,ChainGun,BulletAmmo,20);


//-------------------------------------
//Ammo pack parts: (In Item.cs)
$AmmoPackMax[Beacon] = 10;
$AmmoPackItems[0] = BulletAmmo;

//-------------------------------------
//In the ammopack item: (Item.cs)
function AmmoPack::onDrop(%player, %item)

for(%i = 0; %i < 13 ; %i = %i +1)
// |
// |
// Raise this to be the highest number + 1 because 0 counts
// this tells the game how many ammos to look through for the
// part below.

if(%i == 0) { <--- Make the %i == to be one number higher than the last
%item.BulletAmmo = %numPack; <--- BulletAmmo should be your ammo's name
}

//-------------------------------------
function checkPacksAmmo(%player, %item)

for(%i = 0; %i < 13 ; %i = %i +1)
// |
// |
// Raise this one just like you did the others

//Add one of these:
else if(%i == 0) { <--- do the same here as you did earlier
%item.BulletAmmo = %numPack;
}

//-------------------------------------
function fillAmmoPack(%client):
for(%i = 0; %i < 13 ; %i = %i +1)
// |
// |
// Same here

The Realm is owned and maintained by {FA}GiMMLi J (c)1999

The Realm's {FA}Demon logo is sole property of GiMMLi's Realm any duplication or modifications of this trade mark are Strictly prohibited. Violators will be prosecuted!

Tribes is a trademark of the Dynamix and Sierra Co.

Hosted by www.Geocities.ws

1