Author Topic: Weapon not Working  (Read 538 times)

Hi I'm trying to make a mindblast item, which is the same thing as the Shockwave (Weapon_ShockWave) except that it's mounted on the head with no model. When I equip it, it's as if it wasn't. Simply wasn't. Here's the code:
Code: [Select]
datablock ExplosionData(Sb_MindBlastExplosion)
{
   explosionShape = "Add-Ons/Weapon_Rocket Launcher/explosionSphere1.dts";
soundProfile = ShockwaveExplodeSound;

   lifeTimeMS = 50;

   particleEmitter = ShockwaveSmokeEmitter;
   particleDensity = 10;
   particleRadius = 7;

   faceViewer     = true;
   explosionScale = "1 1 1";

   shakeCamera = true;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "3.0 10.0 3.0";
   camShakeDuration = 0.5;
   camShakeRadius = 20.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 0;
   lightStartColor = "1 1 1 1";
   lightEndColor = "0 0 0 0";

   damageRadius = 3;
   radiusDamage = 0;

   impulseRadius = 4;
   impulseForce = 5000;
};

datablock ProjectileData(Sb_MindBlastProjectile)
{
   projectileShapeName = "base/data/shapes/empty.dts";
   directDamage        = 0;
   directDamageType = $DamageType::ShockWaveDirect;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;
   
   sound = ShockWaveFireSound;
   particleEmitter     = ShockWaveTrailEmitter;
   explosion           = Sb_MindBlastExplosion;
   
   impactImpulse      = 500;
   verticalImpulse    = 500;

   brickExplosionRadius = 3;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 30;             
   brickExplosionMaxVolume = 30;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 60;  //max volume of bricks that we can destroy if they aren't connected

to the ground (should always be >= brickExplosionMaxVolume)

   armingDelay         = 0;
   lifetime            = 210;
   fadeDelay           = 0;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = false;
   gravityMod = 0.0;

   uiName = "Sb - MindBlast";
};

//////////
// item //
//////////
datablock ItemData(Sb_MindblastItem)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "base/data/shapes/player/m.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Sb - MindBlast";
iconName = "";
doColorShift = true;
colorShiftColor = "0.250 0.250 0.250 0.100";

// Dynamic properties defined by the scripts
image = Sb_MindBlastImage;
canDrop = false;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(Sb_MindblastImage)
{
   // Basic Item properties
   shapeFile = "base/data/shapes/empty.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 6;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = Sb_MindBlastItem;
   ammo = " ";
   projectile = Sb_MindBlastProjectile;
   projectileType = Projectile;

//casing = ShockWaveShellDebris;
shellExitDir        = "1.0 -1.3 1.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 15.0;
shellVelocity       = 7.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;
   minShotTime = 15000;   //minimum time allowed between shots (needed to prevent equip/dequip exploit)

   doColorShift = false;
   colorShiftColor = Sb_MindBlastItem.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateTransitionOnNoAmmo[1] = "NoAmmo";
// stateSequence[1] = "Ready";

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 0.1;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = tailNode;
stateSound[2] = ShockWaveFireSound;
// stateSequence[2] = "Fire";
//stateEjectShell[2] = true;

stateName[3] = "Smoke";
stateEmitter[3] = ShockWaveSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.1;
// stateSequence[3] = "TrigDown";
stateTransitionOnTimeout[3] = "CoolDown";

stateName[5] = "CoolDown";
stateTimeoutValue[5] = 0.5;
stateTransitionOnTimeout[5] = "Reload";
// stateSequence[5] = "TrigDown";


stateName[4] = "Reload";
stateTransitionOnTriggerUp[4] = "Ready";
// stateSequence[4] = "TrigDown";

stateName[6] = "NoAmmo";
stateTransitionOnAmmo[6] = "Ready";

};

function Sb_MindBlastImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
Parent::onFire(%this,%obj,%slot);
}

function Sb_MindBlastImage::OnMount(%this,%obj,%slot)
{
Parent::OnMount(%this,%obj,%slot);
%obj.playThread(2, ArmReadyBoth);
}

Images mounted in other slots aren't properly linked to the triggers. Set it to the right hand like a normal weapon then just overwrite the onFire to spawn the projectile from the eye node and go along the eye vector.