Author Topic: *Solved* Weapon emitter wont change back to it's original  (Read 3859 times)

A while ago I posted this and kind of forgot about it (sorry :c). Port gave me a solution that I recently tried and the weapon still isn't changing back to its original emitter. Here's the code with the empty states.
Quote
   stateName[0]                     = "Activate";
   stateTimeoutValue[0]             = 0.8;
   stateTransitionOnTimeout[0]       = "Ready";
   stateSound[0]               = pixelequip3Sound;
   stateEmitter[0]               = rangedEmitter;
   stateEmitterTime[0]            = 600;

   stateName[1]                     = "Ready";
   stateTransitionOnTriggerDown[1]  = "Charge";
   stateAllowImageChange[1]         = true;
   stateSequence[1]   = "Ready";
   stateEmitter[1]      = rangedEmitter;
   stateEmitterTime[1]   = 600;
   
   stateName[2]         = "Charge";
   statetransitionOnTimeOut[2]   = "ChargeFull";
   stateTransitiononTriggerup[2]   = "Fire";
   stateWaitForTimeout[2]      = false;
   stateAllowImageChange[1]        = true;
   stateTimeoutValue[2]      = 2;
   stateScript[2]              = "OnCharge";
   
   stateName[3]                    = "Fire";
   stateTransitionOnTimeout[3]     = "Reload";
   stateTimeoutValue[3]            = 0.74;
   stateFire[3]                    = true;
   stateAllowImageChange[3]        = false;
   stateSequence[3]                = "Fire";
   stateScript[3]                  = "onFire";
   stateWaitForTimeout[3]         = true;
   stateSound[3]               = pixelfire1Sound;

   stateName[4]               = "ChargeFull";
   stateAllowImageChange[4]        = true;
   stateTransitiononTriggerup[4]   = "Empty1";
   stateEmitter[4]               = ranged2emitter;
   stateEmitterTime[4]            = 600;
   
   stateName[5]               = "empty1";
   stateTransitiononTimeout[5]      = "empty2";
   stateTimeoutValue[5]         = 0.18;
   
      stateName[6]               = "empty2";
   stateTransitiononTimeout[6]      = "empty3";
   stateTimeoutValue[6]         = 0.01;
   
      stateName[7]               = "empty3";
   stateTransitiononTimeout[7]      = "empty4";
   stateTimeoutValue[7]         = 0.01;
   
      stateName[8]               = "empty4";
   stateTransitiononTimeout[8]      = "ChargeFire";
   stateTimeoutValue[8]         = 0.01;
   

   stateName[9]                    = "ChargeFire";
   stateTransitionOnTimeout[9]     = "Reload";
   stateTimeoutValue[9]            = 1;
   stateFire[9]                    = true;
   stateAllowImageChange[9]        = false;
   stateSequence[9]                = "Fire";
   stateScript[9]                  = "onChargeFire";
   stateWaitForTimeout[9]         = true;
   stateSound[9]               = chargefireSound;
   stateEmitter[9]          = rangedEmitter;
   stateEmitterTime[9]         = 600;

   stateName[10]         = "Reload";
   stateSequence[10]                = "Reload";
   stateTimeoutValue[10]            = 0.12;
   stateTransitionOntimeout[10]   = "Ready";
   stateSequence[10]           = "Ready";
   stateEmitter[10]          = rangedEmitter;
   stateEmitterTime[10]         = 600;
};
« Last Edit: August 10, 2014, 01:08:44 PM by Ghille »


Your emitter time is probably way to high, the time is set in seconds, not milliseconds. So try setting it to 0.6 instead of 600.

Your emitter time is probably way to high, the time is set in seconds, not milliseconds. So try setting it to 0.6 instead of 600.
I time is that high so the emitter stays for it serves as an indication the weapon is charged.

Try getting rid of State 9's emmiter, as having them overlap like that may be the problem? (Don't quote me on that)

Try getting rid of State 9's emmiter, as having them overlap like that may be the problem? (Don't quote me on that)
Unfortunately that still doesn't work :(

I time is that high so the emitter stays for it serves as an indication the weapon is charged.
That's not how you do constant emitters. You set them to a short period of time, then set the state's stateTransitionOnTimeout to link back into itself, and the timeout value to the same time as the emitter lifetime.

That's not how you do constant emitters. You set them to a short period of time, then set the state's stateTransitionOnTimeout to link back into itself, and the timeout value to the same time as the emitter lifetime.
This fixes it, thanks, I don't know why I didn't think to do that.