How can I use the same key to fire off a different ability depending on which ability I equipped? I would love a large scale solution as I would like to add multiple abilities.
Hey @Shuanlarry! Thanks for posting on the forum, this is a great question.
To start, you could possibly have an array for holding the players’ acquired abilities, and another variable for holding the equipped ability. When you go to “equip” the ability, you set that ability from the array of acquired abilities. Another option could be to look into structs, but it definitely could depend on how you want to implement it.
Wow, I actually do have a little experience using arrays but never thought about using them like this. Do you have a video on this by any chance or a tutorial?
Thank you for the video, I don’t understand this enough to apply this knowledge on what I’m trying to do though. Do you have any links to this Ability System?
well it’s the same thing. If you go through the video (maybe you watch it once and then try on your own as you follow a second time), you’ll understand how to apply it.
thats a very robust system. plenty of documentations about it, but i think it’s good to understand the programming 101 stuff first. That way it doesn’t all seem like magic and you can troubleshoot when things don’t work.
state pattern is one of those 101 programming things very helpful to know. it seems complicated at first but once you get it, it saves you a lot of heartache.
I think the first method shown in that video is just using enumerators, which is a very simple approach you can probably understand right away and get started with on your own project. Eventually you realize that may be cumbersome to work with as your project gets more complex, and then the mroe advanced methods come in handy.
If you’re using 4.27, you may want to check the action rpg game template, available for free at epic’s marketplace, which abilities are assigned to a slot index. In this example, only one ability is equipped as default, but the built-in system allows expansion to more slots by editing the combat widget. So, whatever ability is equipped from the “store” menu, it will be activated by that mapped input logic triggered from the player controller. A function “activate ability at slot” is available in this game sample.