Weapons & Data Assets {{ currentPage ? currentPage.title : "" }}

Abilties and states rely on weapons to do their actions however, there is a slight difference between the way the weapons are handled for the player and the AI, each have their own implementation. we will begin first by explaining the base weapon.

  • BP_BaseWeapon

in the base weapon BP, i am only handling few functions that has info about the weapon properties like weapon equipping and unequipping sockets in addition to the mesh related to it. All the functions provided are overridable so any weapon can adjust that based on need.

  • BP_BasePlayerWeapon

Player Weapon Extends the Base Weapon BP by adding 1 function and 1 extra variable. The variable here is a Data Asset From “Base Player PDA” that has info about the player inputs / states / abilities/ attributes Associated with each weapon and that 1 additional function just takes this info from the Data Asset and assigns it to the player character.

————————————————————————————————————————————————————-

Assigning Weapons & Data Assets For your characters

  • Assigning Weapons

as you can see below, its quite simple, simply run this on begin play or whenever you want to have it.

setting the equipped weapon and registering it is handled in the Player Weapon, you have this exact actor on your if you bought this asset, so you can take a look at it if needed. if you look at the 2 pictures, i have highlighted the important parts with red rectangle for you see. setting the Owner is extremely important for both of them (must be the owning character). For the AI, register and set the equipped weapon when you spawn its weapon right away just like shown above or you can do it within the actor, however you prefer. But, for the Player, its automatically done inside it but you also you will need to specify the Data Asset For that weapon.

  • Assigning Data Assets

For the AI, you simply have to assign it on the character it self as shown Below.

But For the player, its on the weapon/ weapon spawn as shown in the “Assigning weapons”

{{{ content }}}