Post 26: From Bows to Muskets

I could outline the function order in the following way;

Key held down to toggle ranged mode >>> Equipped weapon (if any) is put away >>> Musket is equipped >>> Player is locked in place and upper body will move with mouse >>> Key released; Musket put away, previously equipped weapon re-equipped.

First I retrieved a musket model (temporarily):

https://sketchfab.com/3d-models/musket-8dd65888025f4b34bc2d5cf7b8cc0347

Binding a key was the same as usual, I picked L-Alt, this turned out to be a mistake as during testing ALT + A ends up unpossessing the character – this will need to be changed.

After creating the usual event that goes will all bound keys – I started on the “Pressed state”. Firstly, I put in a “Ready Check” function – this makes sure that the character isn’t doing something else when the ALT key is pushed.

Next I put in a check for an equipped weapon with a ‘Yes’ return to an equip 0 (unarmed) and a ‘No’ return that skips this equip function. The next part is the same as the equip sword function in that equip animations are played and the weapon is shifted to a new parent. Finally, I put in an aim loop so that the animation would pause as the player was aiming.

The “Release” function of this input was similar to the “Pressed” function in the usage of an animation and re-parenting the gun.

Again, it needs a little refining, but I can double back on it.

Implementation

As I mentioned in the previous post I was really tossing up over the idea of whether or not to adopt bows into the game. The main conflict was the amount of work required into creating a skeleton, animating and implementing the IK’s. There was also a conflict on an aesthetic and historical level as although bows may have been used around the time of the Jakobite rebellion; they really weren’t all that common. Finally, I really just didn’t want to go through all the trouble of putting a bow into the game, because I really didn’t think it would be all that pivotal.

My solution to this was to put in muskets. They don’t require skeletons, the IK is easier to implement and the reloading animations shouldn’t be all that hard to implement – if I do at all.

This will take care of my ranged solutions, plus add some extras like smoke and explosions that wouldn’t normally be included with a bow and arrow system.