Bit of a complex one

I want to make an ability system, im using enumeration to get the name of the skills which currently looks like this.
image

To set the image of the skillslot it currently looks like this,

Now what i need is a was to assign the skills to the HUD


and let the player activate them with a keypress.

Extra notes-

  • Skills are assigned in a blueprint component called “BPC_Attacks”
  • The rest of the values on S_Skills are there because im working on a skilltree and id like them to follow the same structure (if its not possible then fine)
  • Id like for the system to be flexible so im able to add abilities in the future too
  • At the moment not needed but im going to make a menu that allow the player to assign the abilities to slots

---- Any more information needed please ask

The most straightforward way:

  • make a bunch of generic slots (ideally, these should be already wrapped in user widgets at this point):

image

This will allow you to place any widget there - weapon, skill, item, spell and whatnot.

  • if you want to map them to 1-5 int range:

Fetch it by index and fire an Interface message. Alternatively, if you do not want to clutter things with yet another interface, rely on Event Dispatchers inside user widget wrapped named slot.

If you want the lot remappable, you’ll need Enhanced Input, potentially right inside the widget.

If you use an enum value or class value is up to you, but in a system where values are going to change (the amount of skills will grow / shrink / be flexible in other ways) then enum is not the most supportive data type. You could consider replacing the enums for skills with soft pointers to skill classes.

What I had happen with enums is that I used a bunch of enum values in my animation blueprint, then changed the enum, at which point all enum properties / comparisons in blueprint assets started to show “invalid value / byte”. It’s best if you can avoid that and use enums for small switch cases that are expected not to change.

  • for better advice, please post your engine version and input system of choice when asking

Im not sure i quite understand what your saying since i dont really use map variable types often. But from what i understand, your assigning an integer as an index for every skill. Im not sure that this would work with what im doing because of the variables (like damage) which are increased with the player level.

I also want to trigger the 4 slots with numbers 1,2,3,4 on the keyboard

If it helps the attack component contains all player and ai attacks that are different from the normal sword attack, in there attacks follow this structure
image
although in this case “Max distance” and “size” are specific.

I have an abilities UI which looks like this.


Which is just 4 slots in a widget and i plan to keep the max at 4

Ive heard these systems are better to make using C++ because of the UE ability plugin.
Should i go and learn that instead of relying on blueprints.

I have not used any ability plugin myself. The advice in general is use c++ as soon as you can, use BP only for prototyping. In some cases you or your designer benefits from the asset editors of BP assets (design widgets, preview animation blending etc.), then you write all logic in c++, make a new class inheriting from your c++ class purely to design the visual details. Your widget would be a c++ UserWidget class implementing all logic. It holds some UPROPERTY with the “bindwidget” flag to which the designer implements the visual design in a blueprint asset. This separates core logic from design. Writing everything in BP makes it a pain to port to c++ later, it’s like starting over. You do need to get comfortable with C++, because technically it is a bit more difficult and you get much more freedom.