What's the best way to large number of character abilities.

Just for fun right now I am making an MMO example demo that mimics the kind of game play in FFXIV/WoW/GuildWars2. So far I have a lot of stuff in place and its working out pretty well.

  1. How is it best to work with making a hotbar that functions like in WoW/FFXIV? When working with an Array its simple enough to add abilities or take them away. But the real question is, how do you go about making it so I can drag an ability to slot 5 instead of slot 1? Do I just add a blank ability to store on empty slots or something? It doesn’t seem to be possible for me to place an object on random slots so easily with an array.

  2. What is the best way to organize a large number of abilities?

  3. Is there a way to call a different struct for each ability?

  1. Using UMG would be the best one. It has a Drag and Drop function. The DragFunction is called on the Widget that is for your Spell/Item and the DropFunction is called on the specific
    slot you are dropping it on. So you can easily check which slot (giving him a number) you dropped you Spell/Item on. If you also save the CurrentSlot Number of your Spell/Item, you can
    just move around these 2 slots. I solved this with an array and i just have a few cases like “is there an Item in that slot?”, “can i stack it?”, “should i swap it?”, etc. It is not that much work
    once you understood how your system should work.

  2. I would create a Base_Class for Abilities and Items. Then i would make a child for each (the base class is for adding them both to the same array, like your hotbar). In the Spell ChildClass
    i would make a struct with all the general Spell properties. Then you can make childs of this class for every new spell.
    Now you could have an array of classes in your Character, or where ever you want to save the Spells. On begin play, you can spawn them and save them in some kind of a SpellBook
    and your Hotbar.

The other way would be do use plain data and just create the Struct on your Character and make an Array of that struct, but that will be way more complicated!

  1. I guess Number 2 answers this or?

AH I didn’t realize that its possible to make a base object then place all of its children in a list. That might be what I need. How does that work exactly?

This would actually be fairly straight forward if it wasn’t for the fact that every ability will have a different cost to use as well as different casting times ect. I was thinking about maybe an even better way to do this would be to add the spell to the character as a component then get all of the information I need from the component then have that component be the thing that does everything its supposed to do provided the casting time reaches zero before interruption. This would actually make more sense to me in a technical sense but in the end I guess I just dont know how to have access to every ability.

I’ll look into accessing children of an object because that seems like it might solve all of my issues.

edit: I am not having any luck figuring out how to access a list of all child actors. There must be info about how to do this somewhere.

Hm, the Parent and Child Class thing is really basic objective programming. You make a Base_Class BP that has all the Data that your Spells should have (cast time, etc).
Then you create a Child BP of that Base_Class BP for each of your spells. You can then simply change the values, like casting time, icon image etc in the default settings.

You can also view the created variables of the Base_Class in the Child Classes by clicking on the EYE Symbol on the left side of the BP and selecting “Show inherited”.

If you now make an array of your Base_Class BP, you can also story the Childs in it. And although the Childs are all different, you can access every variable, because
they are coming from the Base_Class. You would only need to cast a spell to its specific Child_Class if you want to access a variable or function that you created directly
in the Child_Class BP. You will also want to define a function called “OnUse” or something like that, in the Base_Class, so every Child_Class also has this function and
can override it. If you now call this function from one of your Array Elements (which would be of type Base_Class), will still call the overridden version of that function
inside of the Child_Class, which is really the Type inside of the Array. This function is called a “virtual” function.

For the Component idea: I would not suggest this. You will need to add several Components and you would need to add them on RunTime. I would go for the basic
array of Base_Class idea.

NOTE: If your want to story Spells and Items in this Array, you will want to have a Base_Class with the OnUse function, then 2 Childs (Spells_Class and Item_Class)
and then childs of these 2 Class. Then you would make an Array of the Base_Class again and you would be able to Store all Childs Classes in it.

The OnUse function will be called when you press a Hotbar Button and it will call down to the Childs version of this function. So a spell would deal damage and item would
consume and heal or what every you want.

The Data that both share (like an Image), would be placed in the Base_Class too. Only information that only spells or items need, would be placed in the Spells_Class or Item_Class.

I guess you get the point by now. If not, i would highly recommend to learn object oriented programming first. Because even BPs are a programming language and without understanding
the basics, you won’t find yourself in a good spot with it. Dodging C++ is not really an option in terms of knowledge about how to use such a language.

The question I am asking is if there is a way to make a list of all spells and abilities automatically. Right now from what people are saying is that its not currently possible to make a list of child actors without doing it by hand.

I wont be able to use recursive functions to call abilities. Ill be forced to hook up everything by hand which is bad.

Hm the only way go fill lots of data into something would be using datatables. But at one or another point, you will need to fill in this data by hand anyway.

I don’t get your last sentence. I already explained the best way to create your system. :o

To make a list, I would get the length of the Base_Class array variable and for loop it, outputting the array variable information at the current loop index.

A recursive function is like a generic function I can use to call any ability I want by passing variables through it. It turns out I might not need to generate a big list anymore as I can make everything happen that is relevant to the ability within the ability itself. So I just need a generic function to spawn the ability then pass commands from the ability on to the caster like casting time and cost to use the ability.

I think its actually possible to make the entire system recursive so I only need one set of functions to call everything in the entire game.

I dont see an array. Are you saying that there is an array that the engine automatically generates? Or are you saying that I need to hand create an array then access it while in its children?

ah either way I think I might have this figured out now.

Ok (: I might have done it otherwise, but if you are good to go with your solution, it is fine.

I guess Yggdrasil meant the array that i talked about the whole time :smiley:

I have been asking the entire time where this array is because I dont see it. Generating one by hand is not a valid approach to this problem.

It is a custom class, so sure you need to create this one yourself. How else do you want to store data? You could only use a Datatable, but creating an array of the Base_Class
is the normal way to store your Items and Spells. At least for a Hotbar and such things.

I have no idea why you don’t want to create it by hand. Is it, because you think that all in all this is too much work or because it doesn’t suit your System?

In the first post you asked for the Hotbar, which should work with an Array and in the other questionparts, you asked how to organize a large number of abilities.
And this was answered too: Create Base and Child classes and store them in the Array you can then use with your Hotbar.

I have no idea what else you want to achieve, so if this does not work for you, you will have to explain what you are trying to achieve.

I’m guessing what you want is something similar to the request I made here?

As in you don’t want to manually add the spell classes to the array of spell classes. Currently I don’t think that’s possible to do. :S And Yggdrasil meant you loop through the array of spell classes that you created. Not that there is already one for you to use.

^^ He nailed it.

What I was asking isn’t possible right now. I am opting to create all abilities by hand as child blueprints then add them and remove them from each class as I see fit. Its not as pretty as giving every class potential access to every single ability in the game. But in this style of game its not like that is something you commonly see anyway.

The only issue I have now though is that I dont know how to make sure the icons on the hotbar pull information from its associated ability. Like how much SP it costs to use it and what the ability is called. This seems like it would be easily addressed though. Otherwise everything else is working pretty well.

When you create the child of the Master_Power blueprint, the child inherits all of the variables. You can then change the values of those variables to suit the child.

Example: Master_Power contains the variables Name, ManaCost and CreditWorthiness, with defaults of Sara, 90 and 780 respectively. If I made a child blueprint of Master_Power and named it Subordinate_Class, then Subordinate_Class would automatically have the Name and CreditWorthiness variables (also ManaCost, but I don’t care about that for Subordinate_Class). I can then make Subordinate_Class have a CreditWorthiness of 580. If that is all I made changes to, SubordinateClass would have Sara for the value in Name, 90 in the value for ManaCost and 580 in the value for CreditWorthiness.

Keep in mind that Master_Power still has a CreditWorthiness of 780 as well.

Don’t take me wrong here, but i already explained all of this. You may want to read all posts in a thread before eventually posting things twice.

He already said, that this is not exactly what he asks for. He wants to be able to get a list of subclasses that are not yet spawned.
And this is possible, but not in BP only. C++ gives you the power to do what ever you want and Shadowriver already stated in the
other thread that it can be done with C++.

The idea for a BP node is nice, maybe we can get Rama to implement this into his BP Nodes Plugin.

I can’t see it being too hard for Rama to do or even the average user if they do their research. I mean you could just make a node which returns an array of all the classes and then loop through that node once at the start of your game and add all the extend the Base_Class to the array of abilities.

This should happen BEFORE the game starts, as far as i understood.