Weapon Actors
This page provides information about Weapon Actors, which are used to apply or defend damage, in conjunction with the Weapon Manager and Gameplay Abilities.
Class Hierarchy
Weapons are the primary Actor introduced by Ninja Combat, so they are designed to be flexible and extensible.
Weapon Interface
Ninja Combat recognizes weapons via the CombatWeaponInterface. This interface has relevant functions used to identify the weapon and its owner.
Function | Description |
|---|---|
| Returns the Actor that owns this weapon. |
| Returns a container of Gameplay Tags that uniquely identify a weapon. |
Default Weapon Actor
You can create your own actors implementing the Weapon Interface, or use the provided Default Weapon Actor (NinjaCombatWeaponActor), which is a valid implementation for both melee and ranged weapons.
You may want to create your own base Weapon Blueprint or C++ class, extending the Default Weapon Actor, including some of your own defaults, such as the mesh type being used in your project and any other common logic that should be shared between all weapon actors.
Creating a melee weapon: the Sword
Create a new Blueprint based on
NinjaCombatWeaponActor(or your base Weapon class).Add a weapon mesh, it can be a Static or Skeletal Mesh Component, depending on your weapon requirements.
Disable the collisions from the weapon mesh (or have that done in your base Weapon class).
In the Class Defaults panel, add a Gameplay Tag that defines this weapon, such as
Inventory.Item.Type.Sword.
Creating a defensive weapon: the Shield
Create a new Blueprint based on
NinjaCombatWeaponActor(or your base Weapon class).Add a weapon mesh, it can be a Static or Skeletal Mesh Component, depending on your weapon requirements.
Disable the collisions from the weapon mesh (or have that done in your base Weapon class).
In the Class Defaults panel, add a Gameplay Tag that defines this weapon, such as
Inventory.Item.Type.Shield.
Creating a ranged weapon: the Rifle
Create a new Blueprint based on
NinjaCombatWeaponActor(or your base Weapon class).Add a weapon mesh, it can be a Static or Skeletal Mesh Component, depending on your weapon requirements.
Disable the collisions from the weapon mesh (or have that done in your base Weapon class).
In the Class Defaults panel, add a Gameplay Tag that defines this weapon, such as
Inventory.Item.Type.Rifle.
Weapon Cosmetics
Weapon and Projectile impacts are internally handled via Gameplay Cues.
Cosmetics Data Table
Weapons and Projectiles have default cosmetics - sounds, particles and camera shakes set directly to them. However, you may want to trigger different effects, based on the Physical Material set to the colliding target.
For that, you can set a Data Table, based on CombatImpactCosmeticsTableRow. This structure has the following columns:
Column | Description |
|---|---|
| Should match the Physical Material asset name (i.e. |
| Particle effects played for the given surface. |
| Sound effects played for the given surface. |
| Camera shake played for the given surface. |
Cosmetics Component
The Combat Cosmetics Component, included in the base Weapon Actor, handles audio effects, particle effects and camera shakes. This component is also integrated with the Asset Manager, supporting soft references and loading on demand, when applicable.
Inventory Integration
To integrate weapons with an Inventory Manager, they must be converted into Equipment Actors. To learn how to integrate with Ninja Inventory, see the Inventory Integration guide.