Better title: I talk about how guns (animations) usually work and if you have a problem with them then read this yes.
There are many great FPS games out there that have incredible mechanics. And I am here to use my imagination and tell you how these animations and effects were created.
Ooooh, this is an important part of animations. These events fire whenever a marker placed by you is reached, and different effects can happen at that time. For example, if you have more than 1 sound at the reloading animation, just like Arsenal has, then you can add these with custom names and play the sound when the magic GetMarkerReachedSignal event has fired. It is recommended for these types of things and I strongly suggest you use them.
Ah. The most simplest and used guns in the world of FPS. There isn’t much you need to know here, just the basics:
- Reloading sound(s) and animation
- Shooting sound(s) and animation
- And, well uhh, scripting knowledge.
With all of these in mind, you are ready to go and script that awesome .
If you’re ready to script a more advanced gun, for example, if you reload and then equip another weapon, the (in-reloading) weapon’s state remains the same, like an in pause reload.
You would do more than 1 animation, the number of animations is up to you, but the more the better.
With the usage of Int or Number OR String variables, you can store the current state of the gun.
Another (pretty much unrealistic) way to do is having 1 reload animation, Pause it and all of the sounds playing on unequipping, remembering the state of the gun on equipping, and on equipping the gun you play the animation and sounds.
There’s so secret here, same as the Automatic guns, but, y’know, not auto.
Oh no. The most High-Tech Code Big Hard Amazing So_Hard gun to make. Prepare for a biggie lesson.
What you need:
- Sounds (shooting, putting shell into shotgun, pumping it, etc.)
You will need an animation (or more, randomize them) for the shooting event, an animation for the pump event, and more importantly, 3 more animations:
- Placing the hand behind the camera to get shell;
- Putting shell into the shotgun (not looped, you are gonna need this animation for usage more times);
- Placing hand back on the pump and getting ready to shoot.
And the framework would be like this:
- Shoot the gun (shoot anim)
- Pump the gun (pump anim but only if you have remaining ammo)
- Placing the hand behind camera anim
- Playing the shell anim more times, depends on how much you shoot
- Placing hand back on the lever.
On the scripting part, you can store an IntValue and increase it every time the player shoots, and on the reloading part, you can
for loop it as many times the value is, then reset it to 0, once the ammo is full.
This one, well I am not sure, but uses:
This depends on how you’re making it. For example, if you’re doing the way Roblox did it and just gonna reload the entire stock with one animation then that’s simple, just like the Pistol mechanic. However, if you want to do it the following way:
It’s satisfying, isn’t it?
Then just use the Shotgun mechanic. Simple, right? Well, no.
The gun mechanic works pretty much as pistols, but with more damage being dealt, and a different scripted aim scope point thing. The classic way is to increase the FOV and moving the camera forward or use this amazing resource by BoatBomber.
- (Ammo): Usage of the mechanic just like pistols, actually basically the same system
- (Bullet reload): 2 Animations. Easy, right? Well, just the shoot and reload animation. Reload happens only if there is ammo left and fires after shooting. And that just sounds weird.
I guess that’s it then. Thanks for reading all of this (done in 3 hours, what can I say), and if you have any questions feel free to DM me! I would consider more weapon types or mechanics too!