Download

Object Oriented Weapon System

Dear reader,

I am trying to build an extension to the First Person Template, making it easier to change the weapon used.
My Idea was: Create an Actor Blueprint Class called Weapon, and make every weapon used in the game a Child Instance of this blueprint, so that events like"Fire", “Reload” etc. can easily be called by the character blueprint
and the appropriate method for each weapon could be called immediately.
However, once I add the “Weapon” variable to the character blueprint (replacing the Rifle Skeletal Mesh), I kinda get stuck. I can’t put in a default value for my Weapon Variable (“Editing this Value is not allowed”), nor can I set a child blueprint of the Weapons class as default, or used weapon,
for they are also “empty” instances of the Weapons Class, even though they’ve got their properties assigned.

When I try to attach the “Gun” Skeletal Mesh (Base property of the “Weapons” class), as other skeletal meshes would be attached to the character mesh as seen in the FPP template, I get these errors:

Error Accessed None ‘Weapon’ from node AttachTo in graph ‘UserConstructionScript’ in blueprint PlayerController
Error Accessed None from node AttachTo in graph ‘UserConstructionScript’ in blueprint PlayerController

I’d appreciate any help with solving this issue, or an entirely other way in which I could make an easy, widely usable weapon system. Because I am thinking about using around 30 weapons, Trying to cast my “Weapon” to each different weapon instance actor is not an option.

Thank in Advance, any help is welcome.