I’m currently working on prototyping an Ability System kind of like Diablo 3’s in blueprints before I convert it to C++. I’ve gotten stuck on how I should store a “library” of all the abilities and their stats to be accessed. What would be the best way of handling this type of situation with storing information about the Abilitys?
I’ve already got it sorted on my character. What I’m looking for essentially a database of every ability I make, not just the ones equipped to the character. I’ve tried making an object (From type Object in the create window) with an array in it, but there wasn’t really a way to create the object from within my character blueprint.
Sorry, I’m not the best at explaining my thoughts
Essentially I’m not worried about the health and what not. As you said, I’m essentially looking for the best solution to creating a global variable with all the Abilities my character could potentially use (Abilities as in “Spells” and such, not character stats).
Looking at that, not sure that’s what I’m looking for. Blueprint interface is a collection of functions whereas I’m looking to store an array of a struct I’ve created.
I think I’m just gonna have to try some experimentation with this and try to figure something out.
Thanks anyways.
DataTables is my suggestion.
You create a Struct which contains all relevant variables associated with an ability (I imagine there are dozens; MP consumption, damage, range, fire rate, healing factor, player launch vector, bMakeInvincible, whatever the list of things is an ability CAN do).
A DataTable is like a permanent array of Struct values, which you populate with the abilities. You give each row a name corresponding to the in-engine backend name for the ability, and maybe you also store values for Display Name, Display Icon texture, whatever.
When the player uses an ability, you call the Name of the ability (you can encapsulate all of this in a reusable macro if you want, even). You can then use a GetDataTableRow pin to call all the variables associated with it… And then I would hit a SwitchOnName pin to fork the Use Ability command into a “generic” ability processor (i.e. Projectile Attack, Melee Attack, Movement Ability, Healing Ability, whatever) and feed that processing path all of the values pulled from the DataTable.
So, as an example, if you have an ability that spawns 5 icicles and launches them, you would call IcicleBarrage, get the value from the DataTable for that name, and then break the Struct. The “Type” column value = projectile, so we SwitchOnName to the Projectile logic. “NumProj” is 5, “SpawnDelay” is 0.25, “LaunchSpeed” is 4500,0,0, “ProjectileMesh” is “GEOM_Icicle_Missile”, “MPUse” is 65, “Cooldown” is 5, and “Damage” is 200. So we feed these values to our spawning logic that calls up 5 icicle meshes 0.25 seconds apart, launch them forward at 4000 speed, deplete 65MP, then hit a 5s delay node that flags us as unable to use another ability again until it’s up.
That’s just an example implementation, you can get far more complex… But this makes it easy for ANY actor in the level to get all data related to an ability with just a name value, and allows you to manually tweak one master file that retunes the ability globally.
This is exactly what I’m looking for. Thanks for the suggestion!
Haha Kitatus… I was looking up same sorta thing and was thinking the same as infected.
Yeah its Structures ya need. 4.18 has improved this a lot but now gotta learn to use to its fullest!!!
Blueprint interfaces are also good for Interaction later on and pulling data out!
Making a CharacterBP_Parent and gonna have all this info in there. Functions and stuff.
Then gonna child it for Players and NPCs
Thanks all