Skip to content

Equipment and State

Equipment Actor

Ultimately, an equipment is represented in the world by an Actor that gets instantiated and attached to the Equipment Owner. The Actor can perform any required logic, either related to gameplay or purely cosmetic.

You need to create proper Equipment Actor subclasses or Blueprints, implementing any visual elements that your game requires for equipments, such as Skeletal or Static Meshes, particle effects, trails, etc.

It's recommended to create a base Equipment Actor class for common game requirements (current or future) and then create the required concrete ones. The follow diagram should demonstrate this better:

        ANinjaEquipmentActor <|-- AGameEquipmentActor
        AGameEquipmentActor <|-- AGameEquipmentActor_SkeletalMesh
        AGameEquipmentActor <|-- AGameEquipmentActor_StaticMesh
        class AGameEquipmentActor_SkeletalMesh{
            +USkeletalMeshComponent* Mesh
            +UAnimMontage* Montage
        class AGameEquipmentActor_StaticMesh{
            +UStaticMeshComponent* Mesh

Equipment Actor Interface

This interface is used to specify an Actor class that represents a piece of equipment.

It has two important functions that will provide the backing Equipment instance and determine if this actor is an Effect Causer, which is then used by the Ability System layer to determine appropriate effect causers for Gameplay Effects.

The base Equipment Actor implements this interface for you, and it has the property CanBeUsedAsEffectCauser to determine the behavior, with a default value of false. You can either set this property to true or override the function altogether for more elaborate behaviours.

Ninja Combat Integration

This is an important flag for the Ninja Combat Integration. When you define an Equipment Actor that will be used as a weapon, at least one actor must be marked as the Effect Causer interface, so it will be picked up as the causer for melee or ranged damage effects.

Usable Equipment Interface

Allows Equipment Actors to react to an equipment instance being used.

Even though the "heavy lifting" of the event is usually handled by a Gameplay Ability, the equipment or its actors may need to adjust their internal state or perform cosmetic elements, such as playing an animation, particles or sounds.

The equipment instance first reacts to this event and then cascades the event down to its spawned actors. If these actors must access their owning equipment instance, remember that they can do so via the Equipment Instance Aware interface.

The base Equipment Actor implements this interface for you, but won't provide any default behavior.

Scene Component Selector

Most equipments will be attached to the owner's mesh. But the Equipment Component does not assume that to always be a Character's Mesh. You can define where equipments should be attached. Here are some scenarios where this may come in handy.

  1. Your character has a backpack attached to it, but a secondary equipment should be attached to this backpack, instead of being attached directly to the character.

  2. Your character has a Follower Mesh that should be used for the Equipment, instead of the Leader Mesh, which is what you'd have in a very common "Leader Pose Component" setup.

  3. Your character mesh is used for the Mannequin mesh, in an IK retargeter setup, but the actual mesh is a follower mesh (similar to the scenario above).

For these cases, each equipment definition can have their own attachment policies defined by this type of object and, as usual, you can create your for custom logic, by extending UNinjaEquipmentSceneComponentSelector.

The plugin provides two Selectors that you can use:

  1. Attached Actor: Allows attaching an equipment to another Actor attached to the owning Pawn. The selection happens by looking into all scene components, from each actor, looking for one with a given Tag.

  2. Character Mesh: Default selector, that uses the Mesh from a Character.

Compatibility Checks

If you have certain elements of the Equipment that should only be applied if certain criteria is met, for example a mesh for male and female body types, you can use compatibility checks to pick the appropriat asset.

You can create your own logic by extending the NinjaEquipmentAssetCompatibilityCheck class and assigning it to any compatible asset in the Equipment Definition.