I’m creating an ability system for my game, and wanted to allow my designers to implement abilities in blueprint.
I’m working on a system utilising UK2Node_Events which should generate a set of nodes (based on Data Assets containing the basic information of the abilities), similar to how the input action system generates a set of nodes “IA_Move… etc” shown here:
you could look into GAS, even if you dont use it, you can learn from it.
i dont think you want it this way though as the nodes would be static, ie you cant add/remove abilities. I use a UObject instead so a can spawn it based on class and you can wrap it in a K2Node with results pins ie completed/failed
I did check out the gameplay ability system, however we already have a large enough framework of health, mana, etc.. systems which I didn’t want to refactor over to that system. (plus I am enjoying implementing my own systems!)
I hadn’t considered that I wouldn’t be able to add new abilities to the character at runtime with this system, but it shouldn’t be an issue with my setup.
My ability manager component handles all of the base ability logic (cooldowns, blockers etc), with the characters input calling an “ability slot”, which then is matched to the ability data which can be swapped out. I only wanted to avoid setting up the routing of logic back from the ability manager to the correct ability logic (Started_Fireball, Completed_Fireball, etc..) in the character, by having it dynamically create K2Nodes based on the ability data assets. It’s my understanding that node factories can dynamically create any number of nodes needed for this (as the input event system must do something similar).
I could just create the nodes myself and route the information using a switch on the ability name and calling the correct functions (or something similar). Just thought the K2Node_Events would be a good tool to learn, and keep the code more maintainable.
Do you have any good resources on K2Nodes?
I’m just realising the the K2Node would have to bind to an event which would be static (This might be what you meant), is there a way to filter when its fired within the K2Node system(?). My plan was to pass an input to the event (ability name) and have it only fire when the ability name matched the called ability.
if i’m understanding correctly you dont even need K2Nodes, just have custom events such as ActivateAbility, EndAbility, TriggerAbility that pass though a gameplayTag that represent the ability and then you can switch on Tag.
or doing it my way you can encapsulate all that in a UObject that way you dont need to switch on Tag as each ability handles its own logic