For certain guns that require loading a single round at a time (i.e. sniper rifles), what would be the most efficient way of correctly animating the player loading the amount of rounds necessary?
Example:
I have a Gewehr 98 (bolt-action rifle | 5 round capacity) and I fire 3 rounds. When I trigger the reload function, my player only loads 3 new rounds into the rifle.
Likewise, when I fire 2 rounds, my player only loads 2 new rounds.
I’ve tried doing a loop combined with the KeyframeReached event but it’s not efficient and the animations often glitch.
I usually don’t make my animations using the animation editor which makes it easier for me to just change animation states, however, what you can do is probably mark the end of a counted reload animation and switch into it, or make the animation blend from intro to loop to end using AdjustWeight and AdjustSpeed or just play and stop
Here is a very simple example, looks goofy as all hell but it works.
local playUntilDone = function(anim)
anim:Play()
anim.Stopped:Wait()
end
local ammoCount = 5
playUntilDone(anims.intro)
for i = 1, ammoCount do
playUntilDone(anims.loop)
end
playUntilDone(anims.ending)
Do you have any idea of how I could stop animation delay? Sometimes when reloading, the “intro” animation (which in my case is the player opening the rifle’s bolt) plays correctly and stops, but there’s a small delay and then the ‘loop’ animations play.
Another way you can go about this is instead of uploading multiple animations (bringing gun up, inserting gun, back to idle) , just have one animation and use the TimePosition of the animation to replay the bullet insert.