Using a blueprint variable?

Hey! I am trying to create an Inventory system. I was thinking about making a new class for each weapon, as I am trying to create a rather diverse arsenal and not all weapons will be using the same type of function to fire. The problem is, that I am only aware of single classes being available as variables. Am I wrong? Is there anything I could do to adjust my scripts etc.? Any advice is appreciated. Thank you in advance!

You can use inheritance for this. Providing all your classes inherit from a common base class (eg AWeapon). Then you can have in your inventory:

TArray<AWeapon*> Weapons

Your AWeapon class would declare a virtual function called fire:

virtual void Fire() = 0; // the = 0 just means you don't have to specify how a weapon fires

Then you call the Fire method and the relevant method will be called.

Interesting…although I have no idea how I will specify and apply this Fire() thing, this looks like a good method. Thanks.

Look up class inheritance in C++