Quad Chain
Author: Drumstix42
-====================================================================================-
This will go through the complete process of adding the QuadChain.
In this tutorials, you will be given the file name and the code.
If you need help on where to put the code, the please refer to
the tutorial on adding any ammo based weapon. Behold the power
of linking tutorials!
|
-====================================================================================-
Step #1
-------
-------------------
--- inventory.cs
-------------------
-------
IN:
function ShapeBase::clearInventory(%this)
Add:
%this.setInventory(QuadChain,0);
%this.setInventory(QuadChainAmmo,0);
In:
function serverCmdGiveAll(%client)
Add:
%player.setInventory(QuadChain,1);
%player.setInventory(QuadChainAmmo,999);
Step #2
---------
----------------------
--- inventoryHud.cs
----------------------
---------
In Weapons list add:
$InvWeapon[10] = "QuadChain"; //Change # correctly
In Weapon list right below it, add:
$NameToInv["QuadChain"] = "QuadChain";
Step #3
--------
--------------------
--- player.cs
--------------------
--------
Armor's that you want to have gun:
max[QuadChain] = 1;
max[QuadChainAmmo] = 400;
Armor's that you don't want to have gun:
max[QuadChain] = 0;
In $ammoType list add:
$ammoType[6] = "QuadChainAmmo"; //Change # correctly
Step #4
--------
-------------------
--- weapons.cs
-------------------
--------
In $WeaponsHudData list add:
$WeaponsHudData[11, bitmapName] = "gui/hud_chaingun"; //Change # correctly
$WeaponsHudData[11, itemDataName] = "QuadChain"; //Change # correctly
$WeaponsHudData[11, ammoDataName] = "QuadChainAmmo"; //Change # correctly
$WeaponsHudData[11, reticle] = "gui/ret_chaingun"; //Change # correctly
$WeaponsHudData[11, visible] = "true";
Change $WeaponsHudCount correctly:
$WeaponsHudCount = 12; //Change # correctly
In $AmmoIncrement list add:
$AmmoIncrement[QuadChainAmmo] = 60;
In Weapon Exec list add:
exec("scripts/weapons/QuadChain.cs");
Step #5
--------
--------------------
--- Optional Step
--------------------
--------------------
--- ammopack.cs
--------------------
--------
In $AmmoItem list add:
$AmmoItem[8] = QuadChainAmmo; //Change # correctly
In max ammo list add:
max[QuadChainAmmo] = 300;
nbsp; Step #6
--------
--------------------
--- QuadChain.cs
--------------------
--------
Make the file QuadChain.cs in weapons folder.
Add this to it:
//--------------------------------------
// QuadChain
// Code Written By Drumstix42
// States Idea From Old Tut
// Please Give Drumstix42 Credit For Any
// code use =D
//--------------------------------------
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock DecalData(QuadchainDecal1)
{
sizeX = 0.05;
sizeY = 0.05;
textureName = "special/bullethole1";
};
datablock DecalData(QuadchainDecal2) : QuadchainDecal1
{
textureName = "special/bullethole2";
};
datablock DecalData(QuadchainDecal3) : QuadchainDecal1
{
textureName = "special/bullethole3";
};
datablock DecalData(QuadchainDecal4) : QuadchainDecal1
{
textureName = "special/bullethole4";
};
datablock DecalData(QuadchainDecal5) : QuadchainDecal1
{
textureName = "special/bullethole5";
};
datablock DecalData(QuadchainDecal6) : QuadchainDecal1
{
textureName = "special/bullethole6";
};
datablock TracerProjectileData(QuadchainBullet)
{
doDynamicClientHits = true;
directDamage = 0.0825;
directDamageType = $DamageType::Bullet;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
kickBackStrength = 0.0;
sound = ChaingunProjectile;
dryVelocity = 425.0;
wetVelocity = 100.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 15.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.10;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = QuadchainDecal1;
decalData[1] = QuadchainDecal2;
decalData[2] = QuadchainDecal3;
decalData[3] = QuadchainDecal4;
decalData[4] = QuadchainDecal5;
decalData[5] = QuadchainDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(QuadchainAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some Quadchain ammo";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(QuadchainImage)
{
className = WeaponImage;
shapeFile = "weapon_chaingun.dts";
item = Quadchain;
ammo = QuadchainAmmo;
projectile = QuadchainBullet;
projectileType = TracerProjectile;
emap = true;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
projectileSpread = 8.0 / 1000.0;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
//
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateScript[5] = "onSpindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 1.0;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
stateScript[6] = "onSpindown";
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ShapeBaseImageData(Quadchain2Image) : QuadchainImage
{
offset = "-0.5 0 0";
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
//
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateScript[5] = "onSpindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 1.0;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
stateScript[6] = "onSpindown";
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ShapeBaseImageData(Quadchain3Image) : QuadchainImage
{
offset = "-0.6 0 0.5";
//shapeFile = "weapon_mortar.dts";
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
//
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateScript[5] = "onSpindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 1.0;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
stateScript[6] = "onSpindown";
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ShapeBaseImageData(Quadchain4Image) : QuadchainImage
{
offset = "0.1 0 0.5";
//shapeFile = "weapon_mortar.dts";
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
//
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateScript[5] = "onSpindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 1.0;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
stateScript[6] = "onSpindown";
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ItemData(Quadchain)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_chaingun.dts";
image = QuadchainImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Quadchain";
emap = true;
};
//Mount The Images
function QuadchainImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
CommandToClient(%obj.client, 'BottomPrint', "QuadChain - By DrumStix42.", 4, 2 );
%obj.mountImage(Quadchain2Image, 4);
%obj.mountImage(Quadchain3Image, 5);
%obj.mountImage(Quadchain4Image, 6);
}
//Fire All At Once
function QuadchainImage::onSpindown(%this,%obj,%slot)
{
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(5, false);
%obj.setImageTrigger(6, false);
}
//Stop All At Once
function QuadchainImage::onSpinup(%this,%obj,%slot)
{
%obj.setImageTrigger(4, true);
%obj.setImageTrigger(5, true);
%obj.setImageTrigger(6, true);
}
//UnMount The Images
function QuadchainImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(4);
%obj.unmountImage(5);
%obj.unmountImage(6);
}
////////////////////////////////////
//End Code- QuadChain -By DrumStix42
////////////////////////////////////
------------------------------------------------------------------------------
And there you have it, simple and done, go play with your new, QuadChain Gun!!
-Drumstix42