Design Questions
How do I decide between using the Weapon Interface or the Weapon Base Class?
The Weapon Base class is just an implementation of the Weapon Interface without any additional functionality. This means it can be used as a base class for many situations.
However, if you already have a class hierarchy for your weapons, which is very likely to be the case if you have an Equipment Management System in place, then you may need to opt to implement the interface in your base class instaed.
I have my own Inventory System, can I use it with the Combat System for Weapons?
Yes, you can provide your own implementation of the Weapon Maanger Component, by implementing ICombatWeaponManagerInterface
.
Then, instead of using the default UNinjaCombatWeaponManagerComponent
, set your own implementation in the settings page.
Furthermore, Weapon Actors are implementatins of the ICombatWeaponInterface
, so simply implement that interface
in your Equipment Actors and they are compatible with the Combat System. If you don't have Equipment Actors, or other
similar base classes, then you can simply use the ANinjaCombatWeaponActor
as your base class.
Similarly, if you have your own Projectile Actors from your own implementation. You can still use them as long as
you implement the ICombatProjectileInterface
.
Should attacks use the Avatar's mesh or the Weapon's mesh as a source?
You can use both. If your project has a weapon attached to a character's mesh, either in the mesh directly or as an
attached Skeletal or Static Mesh, then configure your notifies to use the Owner as a source and either tag the
mesh components appropriately, with the correct Combat.Component.Source
.
If your weapons are separate Actors, provided via the Equipment Component or a dedicated Inventory System, then you must define the source as the Weapon and provide a proper Gameplay Query to obtain this weapon from the repository. From there, you just need to tag the weapon's mesh with the correct tag, as above.
Gathering the proper sources is responsibilit of the UNinjaCombatMeleeScan
and UNinjaCombatProjectileRequest
classes. If these methods are not enough to suit your needs, you can override them accordingly.
When should I use Line Traces and when should I use Sweeps for the Melee Scans?
Broad horizontal slashes usually will work well with Line Traces. Vertical slashes and piercing might work better
with Sweeps. If you need something more elaborate, you can also provide your own implementation of the scan,
by extending the UNinjaCombatMeleeScan
class.
I configured my Gameplay Ability System with my own Actor Info / Effect Contexts, can I still use them?
Yes, even though the Combat System provides its own version of these G.A.S.-related structs, it's expected that projects may already have their own implementations, and may want/need to stick with them.
Though the data of the provided structs is required for the combat system, the source can be any struct designed
to provide it, due to the fact that the Combat System never interacts with them directly. Instead, it makes use of
Proxy classes implementing CombatActorInfoProxyInterface
and CombatEffectContextProxyInterface
.
Create UObject
classes implementing these interfaces - you can even implement both of them in the same object if
you prefer - and write the appropriate code to access your own Structs, providing the required data defined by the
interfaces. Set the correct proxies in the system's settings and you should be good to go.
I have a Melee Attack that should generate something like a projectile. Do I need two abilities?
No, the base Attack Ability can handle both Melee and Ranged aspects of an attack. Just configure the ability to handle both and then add the proper Notifies to your animation, denoting where the melee scan should happen and where the projectile should spawn.
However, if you need any conditions to that (i.e. "a projectile can only spawn on successful hits"), then you need to track this type of logic yourself, by connecting to the proper methods in the core Attack Ability.
Can I have more than one Ability triggered in a Combo Attack?
Yes, but not directly. The way State Trees work will make a State succeed (or fail) and transition when the Ability Finishes (or gets cancelled). So this will interrupt other abilities being played in parallel. Synchronization in this level will be tricky.
Instead, I recommend creating an "Orchestrator Ability", that will trigger all your abilities and track their completitions. Once all of them complete, the ability itself completes too, ultimately completing the current combo state.