Author Topic: Some error when firing a weapon  (Read 673 times)

I get this in the console when firing my weapon:

Code: [Select]
base/server/scripts/allGameScripts.cs (9198): Register object failed for object (null) of class Projectile.

base/server/scripts/allGameScripts.cs (9199): Unable to find object: '0' attempting to call function 'setScale'
BackTrace: ->[RaycastingFire]WeaponImage::onFire->WeaponImage::onFire

Set::add: Object "0" doesn't exist

Rykuta is wondering why it's raycasting

How about you tell us what weapon and post the server.cs?

projectiles are actually raycasts

i don't know what to tell you. post your ::onFire code?


Code: [Select]
// Generic
exec("./Content/Support/Support_RaycastingWeapons.cs");
exec("./Content/Support/Support_AmmoGuns.cs");
exec("./Content/Support/Support_TF2Weapons.cs");

// Pyromania
exec("./Content/Pyromania/Scripts/Support_TF2_Pyromania.cs");
exec("./Content/Pyromania/Scripts/Weapon_BeggarsBazooka.cs");
//exec("./Content/Pyromania/Sounds/Weapon_Sounds.cs");
Server.cs ^^^

Code: [Select]
//BeggarsBazooka.cs

//muzzle flash effects
datablock ParticleData(TFTwoRLFlashParticle)
{
dragCoefficient      = 0;
gravityCoefficient   = 0;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 50;
lifetimeVarianceMS   = 0;
textureName          = "base/data/particles/star1";
spinSpeed = 100.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.9 0.4 0.1 0.9";
colors[1]     = "0.9 0.5 0.2 0.0";
sizes[0]      = 3.0;
sizes[1]      = 1.0;

useInvAlpha = false;
};
datablock ParticleEmitterData(TFTwoRLFlashEmitter)
{
   ejectionPeriodMS = 2; //10
   periodVarianceMS = 0;
   ejectionVelocity = 40.0;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 0;
   phiReferenceVel  = 0;
   phiVariance      = 0;
   overrideAdvance = false;
   particles = "TFTwoRLFlashParticle";

   uiName = "TF2 Rocket Launcher Flash";
};

datablock ParticleData(TFTwoRLSmokeParticle)
{
dragCoefficient      = 15;
gravityCoefficient   = -0.5;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 300;
lifetimeVarianceMS   = 250;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;

   colors[0]     = "1 0.4 0.1 0.0";
colors[1]     = "1 0.7 0.3 0.9";
colors[2]     = "1 0.7 0.3 0.9";
colors[3]     = "1 1 1 0.0";

sizes[0]      = 0.75; //0.25
   sizes[1]      = 1.0;  //1.0
sizes[2]      = 2; //1.75
sizes[3]      = 4;

   times[0] = 0.0;
   times[1] = 0.5;
   times[2] = 0.75;
   times[3] = 1.0;

useInvAlpha = false;
};
datablock ParticleEmitterData(TFTwoRLSmokeEmitter)
{
   ejectionPeriodMS = 10; //50
   periodVarianceMS = 0;
   ejectionVelocity = -70.0;
   velocityVariance = 10.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 0; //25
   phiReferenceVel  = 0;
   phiVariance      = 1;
   overrideAdvance = false;
   particles = "TFTwoRLSmokeParticle";

   uiName = "TF2 Rocket Launcher Smoke";
};


//bullet trail effects
datablock ParticleData(TFTwoRLTrailParticle)
{
dragCoefficient      = 3;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 0.15;
constantAcceleration = 0.0;
lifetimeMS           = 1500; //1000
lifetimeVarianceMS   = 805;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -150.0;
spinRandomMax = 150.0;
colors[0]     = "0.86 0.46 0.1 0.9";
colors[1]     = "0.51 0.09 0 0.7";
colors[2]     = "0.5 0.5 0.5 0.2";
colors[3]     = "0.1 0.1 0.1 0.1";

sizes[0]      = 0.25;
sizes[1]      = 0.85;
    sizes[2]      = 0.35;
  sizes[3]      = 0.05;

    times[0] = 0.0;
    times[1] = 0.05;
    times[2] = 0.3;
    times[3] = 1.0;

useInvAlpha = false;
};
datablock ParticleEmitterData(TFTwoRLTrailEmitter)
{
   ejectionPeriodMS = 5;
   periodVarianceMS = 1;
   ejectionVelocity = 0.25;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "TFTwoRLTrailParticle";

   uiName = "TF2 Rocket Launcher Trail";
};


datablock ParticleData(TFTwoRLExplosionParticle)
{
dragCoefficient      = 7;
gravityCoefficient   = -0.5;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 3000;
lifetimeVarianceMS   = 400;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.2 0.2 0.2 0.6";
colors[1]     = "0.1 0.1 0.1 0.0";
sizes[0]      = 10.0;
sizes[1]      = 25.0;
    times[0]      = 0.0;
    times[1]      = 1.0;

useInvAlpha = true;
};
datablock ParticleEmitterData(TFTwoRLExplosionEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 15;
   velocityVariance = 1.0;
   ejectionOffset   = 3.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "TFTwoRLExplosionParticle";

   uiName = "TF2 Rocket Launcher Explosion Smoke";
   emitterNode = TenthEmitterNode;
};


datablock ParticleData(TFTwoRLExplosionRingParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = -0.5;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 200;
lifetimeVarianceMS   = 10;
textureName          = "base/data/particles/star1";
spinSpeed = 70.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "1 0.91 0.59 0.9";
colors[1]     = "0.7 0.25 0.02 0.9";
sizes[0]      = 3;
sizes[1]      = 30;
times[1]      = 0.0;
times[2]      = 1.0;

useInvAlpha = false;
};
datablock ParticleEmitterData(TFTwoRLExplosionRingEmitter)
{
lifeTimeMS = 50;

   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 10;
   velocityVariance = 10.0;
   ejectionOffset   = 3.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "TFTwoRLExplosionRingParticle";

   uiName = "TF2 Rocket Launcher Explosion Flash";
};

datablock ExplosionData(TFTwoRLExplosion)
{
   //explosionShape = "";
   explosionShape = "./explosionSphere1.dts";
soundProfile = rocketExplodeSound;

   lifeTimeMS = 150;

   particleEmitter = TFTwoRLExplosionEmitter;
   particleDensity = 10;
   particleRadius = 0.2;

   emitter[0] = TFTwoRLExplosionRingEmitter;

   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 1 1";
   lightEndColor = "0 0 0 0";

   damageRadius = 3;
   radiusDamage = 65;

   impulseRadius = 4;
   impulseForce = 2000; //4000
};


AddDamageType("TFTwoRLDirect",   '<bitmap:add-ons/Weapon_Rocket_Launcher/CI_rocket> %1',    '%2 <bitmap:add-ons/Weapon_Rocket_Launcher/CI_rocket> %1',1,1);
AddDamageType("TFTwoRLRadius",   '<bitmap:add-ons/Weapon_Rocket_Launcher/CI_rocketRadius> %1',    '%2 <bitmap:add-ons/Weapon_Rocket_Launcher/CI_rocketRadius> %1',1,0);
datablock ProjectileData(TFTwoRLProjectile)
{
   projectileShapeName = "./TF2Rocket.dts";
   directDamage        = 65;
   directDamageType = $DamageType::TFTwoRLDirect;
   radiusDamageType = $DamageType::TFTwoRLRadius;
   impactImpulse    = 1000;
   verticalImpulse    = 1000;
   explosion           = rocketExplosion;
   particleEmitter     = rocketTrailEmitter;

   brickExplosionRadius = 3;
   brickExplosionImpact = false;          //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)

   sound = rocketLoopSound;

   muzzleVelocity      = 35;
   velInheritFactor    = 1.0;

   armingDelay         = 00;
   lifetime            = 4000;
   fadeDelay           = 3500;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod = 0.0;

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

   uiName = "TF2 Rocket";
};

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

// Basic Item Properties
shapeFile = "./BeggarsBazooka.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Beggar's Bazooka";
iconName = "./icon_BeggarsBazooka";
doColorShift = true;
colorShiftColor = "0.100 0.500 0.250 1.000";

// Dynamic properties defined by the scripts
image = BeggarsBazookaImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(BeggarsBazookaImage)
{
   // Basic Item properties
   shapeFile = "./BeggarsBazooka.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   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 = BowItem;
   ammo = " ";
   projectile = TF2rocketProjectile;
   projectileType = Projectile;

//casing = rocketLauncherShellDebris;
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 = 700;   //minimum time allowed between shots (needed to prevent equip/dequip exploit)

   doColorShift = true;
   colorShiftColor = BeggarsBazookaItem.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";
   // TF2 stuff
   TF2_IsWeapon = 1;
   TF2_IsBazooka = 1;

   // 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]  = "LoadShell";
stateAllowImageChange[1]         = true;

stateName[2]                      = "LoadShell";
stateTimeoutValue[2]              = 0.75;
stateScript[2]                    = "onLoadShell";
    stateTransitionOnTimeout[2]       = "CheckForAction";
stateAllowImageChange[2]        = false;

stateName[3]           = "CheckForAction";
stateTimeoutValue[3]              = 0.5;
stateTransitionOnTriggerUp[3]     = "Fire";
stateTransitionOnTimeout[3]       = "LoadShell";
stateAllowImageChange[3]        = false;

stateName[4]                    = "Fire";
stateTransitionOnTimeout[4]     = "Smoke";
stateTimeoutValue[4]            = 0.1;
stateFire[4]                    = true;
stateAllowImageChange[4]        = false;
stateSequence[4]                = "Fire";
stateScript[4]                  = "onFire";
stateWaitForTimeout[4] = true;
stateEmitter[4] = TFTwoRLFlashEmitter;
stateEmitterTime[4] = 0.05;
stateEmitterNode[4] = tailNode;
stateSound[4] = rocketFireSound;

stateName[5]                    = "Smoke";
stateEmitter[5] = TFTwoRLSmokeEmitter;
stateEmitterTime[5] = 0.05;
stateEmitterNode[5] = "muzzleNode";
stateTimeoutValue[5]            = 0.1;
stateTransitionOnTimeout[5]     = "CoolDown";

    stateName[6]                     = "CoolDown";
    stateTimeoutValue[6]             = 0.5;
stateTransitionOnTimeout[6]      = "Ready";

};

function BeggarsBazookaImage::onLoadShell(%this, %obj, %slot)
{
%obj.tf2LoadCount++;
if(%obj.tf2LoadCount > 3)
{
%obj.spawnExplosion(TFTwoRLProjectile, 2);
%obj.tf2LoadCount = 3;
}
}
BeggarsBazooka.cs

Currently the bazooka fires a rocket and instantly the rocket explodes.

There is no onFire function?

There is no onFire function?
yeah this is kinda important

There is no onFire function?
I let the scripting gremlins (jk) know