Creating Shotgun

Screen Shot 2015-06-18 at 14.01.27

In earlier post we have added shooting functionality for base weapon. Now let’s upgrade this class to support Shotgun that came with Military Weapons Silver package.

  • Shotgun will fire more bullets than other weapons, (Burst functionality)
  • Its single shoot shotgun with automatic reloading, (custom reload functionality)
  • Spread will be different,
  • Impulse for ragdoll will be different, (Add ImpulsePower to BaseWeapon)
  • Custom animation for FPP Hands to carry shotgun,

Updating BP_BaseWeapon

Open BP_BaseWeapon and add those variables:

  • PullDownWhenReloading (bool, default: true)
    Basically shotgun from the pack comes with reload animation so we don’t want to put hands down while reloading as in other weapons,
  • BurstCount (int, default: 1)
    It will tell us how many bullets we should fire on one Fire Event,
  • ImpulseOnKill (float, default: 10 000)
    This will be used for ragdoll impulse on die,

Now in Fire function let’s add BurstCount:


Updating GameplayCharacter

Now we need to update Reload event in GameplayCharacter to check if weapon should be putted down when reloading.


I marked new nodes.

Add new event dispatcher: Shotgun_IsReloading with one input: IsReloading (bool) it will be used to communicate with animation blueprint. It will be called each time reloading animation will be played.

Creating Shotgun Blueprint.

Create new Blueprint extending from BP_BaseWeapon. Name it BP_Weapon_Shotgun. Check variables:

  • CurrentAmmoInMag: 1,
  • MaxAmmoInMag: 1
    It means that we have only one bullet before reloading.
  • CurrentAmmoInBackpack: 15,
  • MaxAmmoInBackpack: 15,
  • ReloadTime: 0.7,
  • SpreadMin: 0.1,
  • SpreadMax: 1,
  • SpreadCurrent: 0.1,
  • SpreadDecreaseTime: 0.4,
  • MinWeaponDamageModifier: 0.4,
  • MaxWeaponDamageModifier: 0.7,
  • PullDownWhenReloading: false,
  • BurstCount: 10,
  • ImpulseOnKill: 50 000,

So we are just setting up variables. Event graph is just used to play Fire animation which is available in the package.


In this example we will drive whole firing and reloading using Anim Notifies.

Firing and reloading

Animation Notifies are great thing and we will use one here.

Create new Blueprint extending from AnimNotify and name it Shotgun_SetReloading.

Open it and create one variable:

  • IsReloading (bool, editable)

Now we need to override Received Notify function.


If you open Fire animation (Fire_Shotgun_W) you can add notify when weapon is in place where animation is reloading the weapon.


If you select added notify you can change IsReloading bool value. The first one should be true and next false – it means that it will finish reloading in place where animation is telling this.

You can create shell particle as we did earlier for pistol. And you can add PlayParticlEffect notify to spawn it using animation!

Now your weapon should have firing and reloading functionality.

Creating hands animations.

This is the hardest part but you have learnt a lot about TwoBoneIK and Transform (Modify) Bone in earlier posts. Go to HeroFPP_AnimationBlueprint and add those variables:

  • ShotgunRecoil (bool),
  • ShotgunReloading (bool),
  • ShotgunRecoilAlpha (float),

Now in Event Blueprint Initialize Animation let’s bind Shotgun_IsReloading from GameplayCharacter.


In UpdateAnimation add another pin to Sequence and add ShotgunRecoilAlpha interpolation.


Now in Animation Graph. I won’t tell you exactly what to do here – you should be able to do it by yourself if you read earlier posts.

Here is my ShotgunIdle Pose. Just using Transform (Modify) Bones to move hands so they fit Shotgun. You should read How to Add Weapons  if you don’t have shotgun placeholder animation here when you change CurrentWeapon enum in animation blueprint preview.


Now I’m blending the Idle pose by bool (recoil)


Last node goes to earlier created blend poses by Current Weapon enum.


Take your time with using modify bone. Thanks to Epic you have preview and you can check out everything what you are doing if you don’t have any cast to nodes in your graph!

Here’s the final result:

Time Spent on writing this tutorial: 4h.

Creating ShooterTutorial takes a lot of my free time.
Buy Now Button
If you want you can help me out! I will use your donation to buy better assets packs and you will be added to Credits /Backers page as well.

Implementing game is taking time but writing about this is taking much more effort!

One thought on “Creating Shotgun

  1. Pingback: Turret Tutorial | Shooter Game Tutorial

Comments are closed.