so i’m trying to set up a spell system, and i’m probably going about it completely the wrong way, but.
I’ve got a spellbook component that i have given to the pawns that can cast spells (including the player character), which will contain all of the spells that the caster can cast, and i am using template blueprints with rules for what the spell does.
The spells are stored in the component as an array of a structure i set up for the spell data but because the different kind of spells use different actors i have to store the actors as variables within the spell, so the spawned actors can’t inherit the data the usual way with spawn actor from class.
my theory is that i need to use the owner to get the reference in the array for the specific spell and set the data that way on spawn, but i need some kind of reference to be inherited to find the specific spell.
for example, i have a healing aura spell that heals the player’s stamina, mana, and health by specific values per second, but i want the player to have, hypothetically, a different version of the spell for each stat that heals by 10/s but each one to use the same blueprint. This way the player can create their own spells in game because all that matters is the metadata for each one.
i’ve got as far as inheriting an owning spellbook, i just can’t get the reference for each spell.
that’s exactly what i want, and i’ve got everything set up except getting the data from the owner. I need the index for the spell to find the data within the array.
The spell can’t inherit this data on spawn because multiple spells will use the same actor blueprint, like a weak, mid and strong fireball for example.
i’ve created a component bp which is called spellbook, that i can add to any player or enemy that can cast spells.
within that i have an array of a struct that stores the spell’s variables, each member of the array represents a spell.
the spellbook component will then add indexes with data to the array as the player learns/creates them. And enemies will be given some spells when they are spawned from a library, or generated.
Would you not (for example) bind “E” to Spell Fireball Create. Then in the creation function have Inputs to take in data from the owning Player.
It seems like you have a Datatable with the Base Stats? Having issues linking the Class and Datatable? This could be resolved by Enum or by manually storing the Index within the object.
Might be worth providing some screen-grabs or partial code to better understand the limitation/issue you are facing, since conceptually we seem to be on the same page.