Create Melee Weapons
After configuring the initial Combat Components, the first step in Ninja Combat is to prepare your character for Melee Attacks using a Melee Weapon, which must be registered with the Weapon Manager.
Create a new Actor extending from
NinjaCombatWeaponActor
. This will be our sword.tip
If you want to create a base Blueprint for your melee weapons, you can also do that. Then, extend this Blueprint to create the sword Actor.
Set
Inventory.Item.Type.Sword
to the Weapon Tags container.Add a Static Mesh to this Actor, set your sword mesh to it, and add the Component Tag
Combat.Component.MeleeScanSource
.tip
Set the mesh's collision to Overlap All. The system uses traces to collect targets, and we do not want the weapon colliding with other objects.
tip
If you created a base Melee Weapon Blueprint, then make sure to configure collisions in the base Blueprint, so it can be applied to any actual Melee Weapon Actors!
Create a new Actor extending from
NinjaCombatWeaponActor
, or from your base Blueprint. This will be our shield.Set
Inventory.Item.Type.Shield
to the Weapon Tags container.Repeat the same steps as before, setting the Weapon Collision and tagging the Static Mesh Component.
tip
You only need to tag your meshes if you have not implemented
GetMeleeMesh
, from the Melee Interface.
In your Player Character, add the Combat Manager Component, Weapon Manager Component and implement the Combat System Interface.
BlueprintC++In the Components tab, search for
combat manager
and select the Ninja Combat Manager component.In the Components tab, search for
weapon manager
and select the Ninja Combat Weapon Manager component.In the Class Settings view, add the Combat System Interface.
In the My Blueprint tab, under Interfaces, expand the Combat System Interface:
Double-click
GetCombatManagerComponent
and return the Combat Manager component.Double-click
GetWeaponManagerComponent
and return the Weapon Manager component.Double-click
GetCombatMesh
and return the Character Mesh.
Add
CombatSystemInterface
to your Player Character class.Create an instance of
UNinjaCombatManagerComponent
and return it fromGetCombatManager_Implementation
Create an instance of
UNinjaCombatWeaponManagerComponent
and return it fromGetWeaponManagerComponent_Implementation
Return the character's mesh from
GetCombatMesh_Implementation