I think it's something to do with the states, just I don't know what.
All I done was copy and paste from the grav gun and changed the gravLoop and onGrav and a few emitters and sounds.
It's probably something completely obvious that I should of seen.
datablock ProjectileData(TestProjectile : gunProjectile){
directDamage = 0;
brickExplosionImpact = false;
};
datablock ItemData(TestItem : gunItem){
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
//gui stuff
uiName = "Test";
doColorShift = true;
colorShiftColor = "0.2 0.2 0.2 1.000";
// Dynamic properties defined by the scripts
image = TestImage;
canDrop = true;
};
datablock ShapeBaseImageData(TestImage : gunImage){
colorShiftColor = "0.2 0.2 0.2 1.000";
item = TestItem;
projectile = TestProjectile;
projectileType = Projectile;
// States
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = "";
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Reload";
stateTimeoutValue[2] = 0.2;
stateTransitionOnAmmo[2] = "TestLoop";
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = "gunEmitter";
stateEmitterTime[2] = 0.15;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = gunFireSound;
stateEjectShell[2] = false;
stateName[3] = "Reload";
stateSequence[3] = "Reload";
stateTransitionOnTrigger[3] = "Ready";
stateSequence[3] = "Ready";
stateName[4] = "TestLoop";
stateEmitter[4] = gunEmitter;
stateEmitterTime[4] = 0.01;
stateEmitterNode[4] = "muzzleNode";
stateTransitionOnTimeout[4] = "TestLoop";
stateTransitionOnTriggerUp[4] = "Cancel";
stateTransitionOnNoAmmo[4] = "Cancel";
stateTimeoutValue[4] = 0.01;
stateScript[4] = "Test";
stateSequence[4] = "Ready";
stateName[5] = "Cancel";
stateScript[5] = "onCancel";
stateTimeoutValue[5] = "0.1";
stateTransitionOnTimeout[5] = "Ready";
};