SmoothAnim is appallingly inefficient, and it screws up animations done correctly. It is only worth using for crappy animations done with TURN-NOW / MOVE-NOW. Which are, by definition, crappy, because you can save bazillions of lines of instruction if you actually know what you're doing.
However, instead of using TURN at all, in this particular case, what PL should use is:
Code: Select all
#define MY_KEWL_MUZZLEFLASH 1024
AimWeapon1()
{
//Do aiming animations, blah blah blah, also do this part
play-sound (MY_KEWL_SPINUP_SOUND_FX,5);
spin barrel around z-axis speed <450> accelerate <100>;
}
FireWeapon1()
{
emit-sfx MY_KEWL_MUZZLEFLASH from flare1;
sleep 200;
}
Then, during RestoreAfterDelay:
Code: Select all
RestoreAfterDelay(RandomSeed)
{
RandomSeed = RAND(1000, 2000);
sleep RandomSeed;
//start restoring Piece positions back to default, blah, blah
play-sound (MY_KEWL_SPINDOWN_SOUND_FX,5);
spin barrel around z-axis speed <350>;
sleep 500;
spin barrel around z-axis speed <250>;
sleep 500;
spin barrel around z-axis speed <150>;
sleep 500;
spin barrel around z-axis speed <50>;
sleep 500;
stop-spin barrel around z-axis;
}
Reasons for doing it this way:
1. It makes an awesome noise when spinning up and down, like a minigun.
2. It uses SPIN, instead of some lame TURN / TURN-NOW stuff, and spins down over time, naturally, instead of coming to a halt immediately. Since I did not use a SIGNAL command, RestoreAfterDelay can be interrupted, at any time, by AimWeapon1(). Important, to avoid glitches (I really don't see the point of SIG_RESTORE, frankly, there are better ways to achieve the same purpose).
3. It leaves the minigun barrels in slightly random positions, which is cooler-looking. If you have attached the emitting Piece to the rotating barrels, it changes the position of emission- if you want to simulate a true Gatling, which has a fixed chamber and rotating barrels, attach the Piece to the Piece that changes the x-axis of the gun, not the barrels.
Oh, and the #define line is there to save your brain- much easier to go from the Unit's FBI to the COB to the CustomExplosionGenerator if you're consistent at all times about the name, and will save you a lot of time debugging.