Author Topic: Stryker Turret Error  (Read 569 times)

The message exceeds maximun length so i posted it on my website. The Stryker shoots rockets as well as bullets. I want bullets only but i cannot find out where the rockets are coming from. Click here to go to the topic.

Code: [Select]
   function StrykerShellProjectile::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)
   {
      if(%col.dataBlock.className $= "Glass" && !%col.indestructable)
      {
         %col.explode();
      }
      Parent::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e);
   }

   function armor::onTrigger(%this, %obj, %triggerNum, %val)
   {
      %mount = %obj.getObjectMount();
      if(isObject(%mount))
      {
         if(%mount.getDataBlock() == StrykerTurretPlayer.getId() && %triggerNum == 0 && %val)
         {
            %client = %obj.client;
            if(isObject(%client))
               ServerCmdUnUseTool(%client);

            if(getSimTime() - %obj.lastShotTime < 2500)
               return;
           
            %scaleFactor = getWord(%mount.getScale(), 2);
            %p = new Projectile()
            {
               dataBlock = StrykerShellProjectile;
               initialPosition = vectorAdd(%mount.getEyeTransform(),vectorScale(%mount.getEyeVector(),3));
               initialVelocity = vectorScale(%mount.getEyeVector(),140 * %scaleFactor);
               sourceObject = %obj;
               client = %obj.client;
               sourceSlot = 0;
               originPoint = vectorAdd(%mount.getEyeTransform(),vectorScale(%mount.getEyeVector(),3));
            };
            MissionCleanup.add(%p);
            %p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);

            %mount.mountImage(StrykerSmokeImage,1);

            serverPlay3D(StrykershotSound,%obj.getPosition());

            %theVector = %mount.getEyeVector();
            %theVector = vectorAdd(%theVector,"0 0 1");
            %theVector = vectorScale(%theVector,%mount.getObjectMount().dataBlock.mass*5);
            %theVector = vectorSub(%theVector,vectorScale(%thevector,2));
            %mount.getObjectMount().applyImpulse(getWords(%mount.getEyeTransform(),0,2),%theVector);
           
            %obj.playThread(0,activate);
            %obj.lastShotTime = getSimTime();

            return;
         }
      }
     
      Parent::onTrigger(%this,%obj,%triggerNum,%val);
   }



datablock DebrisData(StrykerShellDebris)
{
   emitters = "rocketTrailEmitter";

shapeFile = "./emptywheel.dts";
lifetime = 0.1;
minSpinSpeed = -300.0;
maxSpinSpeed = 300.0;
elasticity = 0.5;
friction = 0.2;
numBounces = 0;
staticOnMaxBounce = true;
snapOnMaxBounce = false;
fade = false;

gravModifier = 0;
};

datablock ExplosionData(StrykerShellExplosion)
{
   explosionShape = "";
   soundProfile = rocketExplodeSound;

   lifeTimeMS = 150;

   debris = StrykerShellDebris;
   debrisNum = 30;
   debrisNumVariance = 10;
   debrisPhiMin = 0;
   debrisPhiMax = 360;
   debrisThetaMin = 0;
   debrisThetaMax = 180;
   debrisVelocity = 140;
   debrisVelocityVariance = 50;

   particleEmitter = gravityRocketExplosionEmitter;
   particleDensity = 10;
   particleRadius = 0.2;

   emitter[0] = gravityRocketExplosionRingEmitter;
   emitter[1] = gravityRocketExplosionChunkEmitter;

   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 = 5;
   lightEndRadius = 20;
   lightStartColor = "1 1 0 1";
   lightEndColor = "1 0 0 0";

   damageRadius = 8;
   radiusDamage = 170;

   impulseRadius = 15;
   impulseForce = 5000;

   playerBurnTime = 5000;
};

AddDamageType("StrykerShellDirect",   '<bitmap:add-ons/Projectile_GravityRocket/rocket> %1',    '%2 <bitmap:add-ons/Projectile_GravityRocket/rocket> %1',1,1);
AddDamageType("StrykerShellRadius",   '<bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1',    '%2 <bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1',1,0);
datablock ProjectileData(StrykerShellProjectile)
{
   projectileShapeName = "./empty.dts";
   directDamage        = 100;
   directDamageType = $DamageType::StrykerShellDirect;
   radiusDamageType = $DamageType::StrykerShellRadius;
   impactImpulse    = 1000;
   verticalImpulse    = 1000;
   explosion           = StrykerShellExplosion;
   particleEmitter     = rocketTrailEmitter;

   brickExplosionRadius = 0;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 10;             
   brickExplosionMaxVolume = 15;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 20;  //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume)

   sound = rocketLoopSound;

   muzzleVelocity      = 120;
   velInheritFactor    = 1.0;

   armingDelay         = 0;
   lifetime            = 4000;
   fadeDelay           = 4000;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = true;
   gravityMod = 1.0;

   hasLight    = true;
   lightRadius = 5.0;
   lightColor  = "1 0.5 0.0";

   explodeOnDeath = 1;

   uiName = "Stryker Shell"; //naming it this way so it's next to the rocket in the alphabetized list
};

It's pretty easy to figure out what all this stuff does, just modify it to whatever.

Well i changed the bullet and it still doesn't work. Let me keep trying.
Solved
« Last Edit: April 13, 2009, 07:55:41 AM by heedicalking »