I've tried numerous ways, and numerous functions, to fix a repair animation for our Altis Life server. The animation often glitches where the player runs the first two or three frames of the animation continuously in a loop.
I've written a file to combat the looping system so that it prepares the player into the animation state required to run the set animation (ainvpknlmstpsnonwnondnon_medic_1) in this case, no matter the starting position, the player is instructed to put away their weapon, and return their stance to kneeling prior to starting the animation.
This all runs smoothly, the animation plays correctly every time tried.
The issue then occurs after the first animation play comes to an end where the player freezes at the last frame of the above animation.
{
_repairAnim = {player switchmove "ainvpknlmstpsnonwnondnon_medic_1";}; animLoop = player addEventHandler["animDone",{player switchMove "ainvpknlmstpsnonwnondnon_medic_1";}]; sleep 0.1; [] spawn _repairAnim; waitUntil {(!life_action_inUse)}; player removeEventHandler ["animDone",animLoop]; };
I've tried multiple combinations of playMove, playMoveNow, and switchMove in both locations (for the start animation and the loop animation).
As the "holstering" of weapon animations is also glitchy, I've used a method of storing the current weapon for the player in a global variable, and then set the player weapon using the action "SwitchWeapon" to value 100 (an unused slot).