Author Topic: Smoke coming out of gun after animation  (Read 1306 times)

The smoke only emits from the barrel of my gun once the fire animation has completed.

help me

Code: [Select]
datablock ParticleData(EokaSmokeParticle)
{
dragCoefficient      = 13;
gravityCoefficient   = 0;
inheritedVelFactor   = 4;
constantAcceleration = 4;
lifetimeMS           = 525;
lifetimeVarianceMS   = 55;
textureName          = "base/data/particles/cloud";
spinSpeed = 5.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.5 0.5 0.5 0.9";
colors[1]     = "0.5 0.5 0.5 0.0";
sizes[0]      = 0.2;
sizes[1]      = 0.4;

useInvAlpha = false;
};
datablock ParticleEmitterData(EokaSmokeEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 3.0;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "EokaSmokeParticle";

   uiName = "Eoka Smoke";
};
Code: [Select]
datablock ShapeBaseImageData(EokaadsImage)
{
   // Basic Item properties
   shapeFile = "./Models/Eoka.dts"; //If you use two-handed weapons, this is what would have two hands
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = "0.35 0.9 -0.7"; //"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 = EokaProjectile;
   projectileType = Projectile;

casing = EokaShellDebris; //Don't mess with these too much
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;

   doColorShift = true;
   colorShiftColor = EokaItem.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.15;
stateTransitionOnTimeout[0]       = "Ready";
stateSequence[1] = "Equip"; //Optional if you want an equip animation
stateSound[0] = weaponSwitchSound;

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

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Smoke";
stateTimeoutValue[2]            = 1; //Delay between each shot, the smaller the number, the less of a delay. Fast machine guns would have a small number.
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire"; //When you make a custom fire animation, place the name here
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = EokaFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = EokaShot1Sound;
stateEjectShell[2]       = true;

stateName[3] = "Smoke";
stateEmitter[3] = EokaSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.01;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4]     = "Ready"; //This is what determins firemode, "TriggerUp" = SemiAuto, "Timeout" = Auto
stateSequence[4] = "Ready";    //so "stateTransitionOnTimeout[4], used to be "stateTransitionOnTriggerUp".

};
« Last Edit: March 16, 2015, 06:46:06 PM by Damien4545 »

You've probably put your emitter on the wrong state, but I can't tell you for sure because you didn't post the gun's code.

You've probably put your emitter on the wrong state, but I can't tell you for sure because you didn't post the gun's code.

whoopsie

It seems to me your issue is that stateTimeoutValue[2] = 1; causes a delay after the shot before the smoke. I don't really make weapons, but I would try decreasing that number to 0.05 (the length of the flash emitter).

Edit: checked the gun script and the default value for stateTimeoutValue[2] is 0.14.
« Last Edit: March 16, 2015, 06:54:50 PM by $trinick »

It seems to me your issue is that stateTimeoutValue[2] = 1; causes a delay after the shot before the smoke. I don't really make weapons, but I would try decreasing that number to 0.05 (the length of the flash emitter).

Edit: checked the gun script and the default value for stateTimeoutValue[2] is 0.14.

The animation is meant to be long, and if i change stateTimeoutValue[2] the animation will play at a very high speed, and won't work out how I want it to. If the gun was a fast automatic with a quick animation, smoke coming out afterword wouldn't be a problem because it's going too fast to notice. However with this animation, the hands are placing the bullet in the barrel of the gun after each shot.
« Last Edit: March 16, 2015, 07:04:37 PM by Damien4545 »

Try creating a really fast state before the fire state that has the smoke emitter.