Game Development Community

Spinup and down plays randomly

by Danni · in Torque Game Engine · 04/13/2008 (12:14 pm) · 1 replies

Can someone help figure out what is wrong here. www.antihax.net/movies/spin.wmv Sometimes it spins up and down, sometimes it stops instantly and i cannot figure out why? Happens in both TGE and TGEA.

datablock TSShapeConstructor(w_VulcanDts)
{
   baseShape = "w_vulcan.dts";
   sequence0 = "vulcan_activate.dsq Activate";
   sequence1 = "vulcan_deactivate.dsq  Deactivate";
   sequence2 = "vulcan_idle.dsq Idle";
   sequence3 = "vulcan_reload.dsq Reload";
   sequence4 = "vulcan_run.dsq Run";
   sequence5 = "vulcan_shoot.dsq Fire";
   sequence6 = "vulcan_spin.dsq spin";
   sequence7 = "vulcan_spin.dsq SpinUp";
   sequence8 = "vulcan_spin.dsq SpinDown";
   sequence9 = "vulcan_spin.dsq FullSpeed";
};

datablock ShapeBaseImageData(VulcanImage)
{
......

   stateName[0]                     = "Activate";
   stateSpinThread[0]               = Stop;
   stateTransitionOnTimeout[0]      = "Ready";
   stateTimeoutValue[0]             = 0.5;
   stateSequence[0]                 = "Activate";

   stateName[1]                     = "Ready";
   stateSpinThread[1]               = Ignore;
   stateTransitionOnNoAmmo[1]       = "NoAmmo";
   stateTransitionOnTriggerDown[1]  = "Spinup";

   stateName[2]                    = "Spinup";
   stateSpinThread[2]              = SpinUp;
   stateSound[2]                   = VulcanSpinupSound;
   stateTimeoutValue[2]			       = 0.5;
   stateWaitForTimeout[2]          = true;
   stateTransitionOnTimeout[2]     = "Fire";
   stateTransitionOnTriggerUp[2]   = "Spindown";

   stateName[3]                     = "Fire";
   stateTransitionOnTimeout[3]      = "Skip";
   stateTransitionOnTriggerUp[3]    = "Spindown";
   stateTransitionOnNoAmmo[3]       = "Spindown";
   stateSequenceRandomFlash[3]      = true;   
   stateSpinThread[3]               = FullSpeed;
   stateTimeoutValue[3]             = 0.03125; //0.125;
   stateFire[3]                     = true;
   stateRecoil[3]                   = HeavyRecoil;
   stateEjectShell[3]               = true;
   stateAllowImageChange[3]         = false;
   stateSequence[3]                 = "Fire";
   stateScript[3]                   = "onFire";
   stateSound[3]                    = VulcanFireSound;

   stateName[4]                     = "Reload";
   stateSpinThread[4]               = Stop;
   stateTransitionOnNoAmmo[4]       = "NoAmmo";
   stateTransitionOnTimeout[4]      = "Ready";
   stateTimeoutValue[4]             = 2;
   stateAllowImageChange[4]         = false;
   stateSequence[4]                 = "Reload";
   stateEjectShell[4]               = true;
   stateScript[4]                   = "onReload";
   stateSound[4]                    = VulcanReloadSound;

   stateName[5]                     = "NoAmmo";
   stateTransitionOnAmmo[5]         = "Reload";
   stateScript[5]                   = "onNoAmmo";
   stateSpinThread[5]               = Ignore;
   stateSequence[5]                 = "NoAmmo";
   stateTransitionOnTriggerDown[5]  = "Spinup";

   stateName[6]                     = "DryFire";
   stateSpinThread[6]               = FullSpeed;
   stateTimeoutValue[6]             = 1.0;
   stateTransitionOnTimeout[6]      = "NoAmmo";
   stateSound[6]                    = VulcanFireEmptySound;

   stateName[7]                    = "Spindown";
   stateSound[7]                   = VulcanSpinDownSound;
   stateSpinThread[7]              = SpinDown;
   stateTimeoutValue[7]            = 1.0;
   stateWaitForTimeout[7]          = true;
   stateTransitionOnTimeout[7]     = "Ready";
   stateTransitionOnTriggerDown[7] = "Spinup";

   stateName[8]                    = "Skip";
   stateSpinThread[8]              = Ignore;
   stateTransitionOnTriggerUp[8]   = "Spindown";
   stateTransitionOnNoAmmo[8]      = "Spindown";
   stateTransitionOnTimeout[8]     = "Fire";
};

#1
05/29/2008 (6:49 am)
Try this
stateTransitionOnLoaded[0]       = "Activate";
   stateTransitionOnNoAmmo[0]       = "NoAmmo";

   // Activating the gun.  Called when the weapon is first
   // mounted and there is ammo.
   stateName[1]                     = "Activate";
   stateTransitionOnTimeout[1]      = "Ready";
   stateTimeoutValue[1]             = 0.5;
   stateSequence[1]                 = "Activate";
  // stateTransitionOnNoAmmo[1]      = "NoAmmo";
   // Ready to fire, just waiting for the trigger
  // stateName[2]                     = "Ready";
  // stateTransitionOnNoAmmo[2]       = "NoAmmo";
   //stateTransitionOnTriggerDown[2]  = "SpinUp";
   //stateSpinThread[2]               = Stop;
   
   stateName[2]       = "Ready";
   stateSpinThread[2] = Stop;
   stateTransitionOnTriggerDown[2] = "Spinup";
   stateTransitionOnNoAmmo[2]      = "NoAmmo";


   
   //--------------------------------------
   stateName[3]                     = "SpinUp";
   stateSound[3]                    = GatlingFireStartSound;
   stateTimeoutValue[3]             = 0.30;
   stateWaitForTimeout[3]           = false;
   stateTransitionOnTimeout[3]      = "Fire";
   stateSpinThread[3]   = SpinUp;
   stateTransitionOnTriggerUp[3] = "Spindown";


   // Fire the weapon. Calls the fire script which does
   // the actual work.
   stateName[5]                     = "Fire";
   stateFire[5]                     = true;
   stateRecoil[5]                   = NoRecoil;
   stateAllowImageChange[5]         = true;
   stateSequence[5]                 = "Fire";
   stateScript[5]                   = "onFire";
   stateEmitter[5]                  = GatlingFireEmitter;
   stateEmitterTime[5]              = 0.15;
   stateSound[5]                    = GatlingFireSound;
   stateTimeoutValue[5]             = 0.15;
   stateTransitionOnTimeout[5]      = "Fire";
   stateSpinThread[5]               = FullSpeed;
   stateSequenceRandomFlash[5]      = true;
   stateEjectShell[5]               = true;
   stateTransitionOnTriggerUp[5]    = "Spindown";
   stateTransitionOnNoAmmo[5]       = "EmptySpindown";
   
   stateName[6]                     = "Spindown";
   stateSound[6]                    = GatlingFireStopSound;
   stateSpinThread[6]               = SpinDown;
   stateTimeoutValue[6]             = 0.25;
   stateWaitForTimeout[6]           = true;
   stateTransitionOnTimeout[6]      = "Ready";
   stateTransitionOnTriggerDown[6]  = "Spinup";

   stateName[7]                     = "EmptySpindown";
   stateSound[7]                    = GatlingFireStopSound;
   stateSpinThread[7]               = SpinDown;
   stateTimeoutValue[7]             = 0.5;
   stateTransitionOnTimeout[7]      = "NoAmmo";

   stateName[8]                     = "NoAmmo";
   stateScript[8]                   = "onNoAmmo";
   stateSpinThread[8]               = Stop;
   stateSequence[8]                 = "NoAmmo";
   stateTransitionOnAmmo[8]         = "Ready";