Okay here’s the situation. I have a couple of spells I want to add to my game, lets assume Fireball, Magic Missile, and Lightning Bolt. I’m trying to improve upon the modularity of the spells so I make them into their own classes based on a Spells class that I made from an actor class. The spells are then put into a reference array inside the blueprint of the character that will be able to cast that spell. But that’s where the hiccup comes in. Because if the spells a character can use is stored in a reference array, I have to have the actors placed in the game world in order for the character to use them. Somehow I feel like it is counter-intuitive to place an invisible spell actor into the game world for every character that knows a spell (this is assuming I want variation in the same types of spells; ie. A 4 damage fireball vs a 6 damage fireball). Is this an acceptable way to go about it? It feels kinda silly because I feel like I’m going to end up placing 100+ invisible spell actors lol. I feel like Actor Components might be where my answer lies but I will need to experiment with that a little more. Of course this is all theoretical, so I won’t have actual code to post as an example of how I’m going about this.
You want to store your characters available spells as Class Types, not Reference Types.
That way you can use the Class of the spell to spawn it when you want to fire it.
You can set any number of Available spells and not need direct actor references, as you can see on the details panel of the variable i have directly set a number of spells.
Ah, right I see now. This way I won’t have to manually drag in each spell actor that I need. Thanks.