Weapon Selection System

At the moment I have a fleshed out weapon system that includes various things like ironsights, muzzle flash, reloading, ect, but it is all handled inside the player blueprint and not in a weapon specific blueprint. I feel this will fill my player blueprint space pretty quick and just seems like an inefficient method. Im interested in expanding each weapon into its own specific blueprint, but Im not sure how I should have everything work together. Ive basically expanded a lot on the FPS blueprint template.

It would help to know which events you use but generally it’s very much possible to just take everything, copy it into a weapon BP and then use those events to call functions inside of your weapon BP.

To have this working properly without it getting messy due to casting the currently selected weapon through all possibilities you will need a master weapon with the very basic variables and functions every weapon will need.
Now an abstract method would be really awesome (call it in your weapon master and implement the functionality in a child class) however sadly this is at this point not possible through blueprint.
However you can get something very similar by implementing an interface for your weapon master but not implementing that function in there.

You’re child BP will have those functions at the side and you can right click them to implement them in your child bp.

From yoru player BP you can then simply call those interface events for your weapon master (like fire button down, up. Reload, etc) and the currently selected weapon will then receive them and run their own logic.

I hope it’s understandable without pictures. I will try to get a bit of time in this evening and post a bit more detailed explenation.


Thanks for the reply! I looked at interfaces and the functions, is it possible to use delays in them? I have delays attached to things like reloading, fire rate, ect.

one method I saw done was a different character for each weapon and swap the character on weapon change

I feel like that would be just as inefficient as the current method Im using.

I would put everything in your fire box into your weapons blueprint. Think about it this way; if you shoot an assault rifle IRL then you aim, maybe with iron sights or from the hip then you pull the trigger, then when you want to stop firing you release it right? It’s the weapon that shoots projectiles, muzzle flash, has recoil etc.

Input actions can be put in your player BP so you want the event ‘Fire weapon’ with ‘pressed’ and ‘released’ outputs. Then your ‘pressed’ can cast to your weapon BP to a custom event which starts firing projectiles every x seconds. But be aware that ‘pressed’ and ‘released’ only fire off once so it may be worth having your weapon bp stuff go in a loop until another custom event is fired from ‘released’ breaks that loop.

The player character BP always seems to be the one that fills up fast and it gets very slow and laggy when there’s a lot of stuff going on.

You can also just have an Enum that specifies all of the weapon types, and use it to store the value of the currently active weapon (along with backup weapons currently held or w/e). Then you can use a Switch On [Weapon] node to branch relevant execution paths to specific casts.

This is helpful if weapons change more than just weapon functionality itself, and affect character movement (e.g. character sprints faster when holding a certain melee weapon, can’t jump when the minigun is equipped, whatever) or other things that don’t make sense distinguished from the player BP.

Thats currently what Im trying to do, but I dont know how to store the weapon specific blueprints outside of the player blueprint.

You create the weapon BP, and then create a series of custom events for each thing it does (fire, reload, melee, whatever).

Then, inside your player BP, you get the active weapon actor, Cast To it, and call the corresponding functions.

Getting the weapon actor involves storing it on pickup as a variable for the player.

So, imagining you have a weapon system like Halo or Gears, on pickup of a weapon, you’d Set a Weapon variable to the actor you were on when you pressed “pick up”, and set an Enum that indicates that the corresponding weapon is of type X. Say you were holding a rifle and picked up a shotgun; you’d set your Weapon 2 var to THAT shotgun actor, and set the Weapon 2 slot Enum to “Shotgun”.

Then when you pressed “swap weapons” or w/e you’d set an Active Weapon variable to be the actor previously grabbed for Weapon 2, and the Active Weapon slot Enum to “shotgun”.

Then, you’d have all of your input commands feed Switch on Enums and Cast Tos. So for example, “Fire” would feed a Switch on Weapon Slot node which is connected to your “Active Weapon Slot” enum. Since that Enum is currently set to shotgun, it would feed the shotgun execution pin. That pin should then go to a Cast To node which casts the “Active Weapon” actor variable to a “MyShotgun” BP (or whatever) and calls the custom event “Fire” on that BP.

That’s how I do it, anyway.

Is it posible to get this image in a quality that someone can read it ?
Eventualy someone can help u better then.

I have a BasicWeapon BP with all funktions a weapon have.
Then I make a Child for all weapons i want to have and Implement the Funktionality of the weapon if it is not the same as the Basic.
I Attach the 1P and 3P Mesh on the Player Char and call the funktions from player BP.

The stuff in the picture isnt important, Im just showing that this is all the weapon specific stuff I have that I need in a different blueprint for each weapon.

Build a BasicWeapon Blueprint and make childs for every Weapon.
In the BasicWeapon Bp you implement all the Functions.
You WeaponInventory should be of class BasicWeapon so you can fill it with you Weapons.
Now you only need to call the funktion in the PlayerBP

Mouse1 Pressed - > GetActiveWeapon -> Fire

You can use a StandartFire or Reimplement it on each Child for Custom Fireing
Same you can make with all the functions. And its a better Way as implement it on the CharBP.

Thats all i can tell you without knowing what exactli you done in you BP and cant give you a example :wink:

Greez DarkSoe

Thanks for the reply, but you dont really need to know what I have in my blueprint at all. Its based off of the default gun that comes with the FPS Blueprint template.

No, i dont need to know. I only had made you a example if you had posted it.
So u need to make it yourself but it isnt so hard, so i hope i had helped you.
And in the FPS BP T is no realy gun, its only a Projectiel Spawn on Mouse Pressed ^^

Yeah thats the problem Im facing with the template. Ive created the functionality for the gun, reloading, muzzle flash, shell ejection, reloading, ect, but since its in the players blueprint, its not really a gun. Thats why Im trying to figure out how to switch between guns with seperate blueprints,

I made it int this way.

The BasicWeapon with Basic Fire, Reload, Zooming(Sniper) ect. Function and a Variable “IsEquiped”.
In the Childs i changed functions like ClipLoading to Shotgun Shell loading and FireRate, AmmoCount, ClipAmmo, Mesh ect.

I Created a Inventory (Simply a Array of type BasicWeapon).
In Char BP are functions for Equip(Set Weapon is Equiped and Attach WeaponMesh), Unequip(Set IsEquiped = False and deAttach Mesh) and GetEquipedWeapon(ForEach the InventoryArray and Return Weapon IsEquiped = true).
There also The Controlls for FireButtonPressed -> GetEquipedWeapon -> Fire ect.

Now you can (MouseWeel Controll or Keyboard Keys) Simply Iterate the Array for Change the Weapons from “Inventory”