So on my character, I have an inventory system. I have the class of the object saved as part of my structure. Can I somehow call a function based on the class?
I don’t think that it’s possible in the way that you described. But you can definitely try to cast your item for every item class you have, and if that cast is successful you can call the function from there. As this is probably not the best way to handle this, you can either make a Blueprint Interface for interacting with your items, or make an item-baseclass that has the functions/events that you need and then overwrite them in your Blueprints derived from that baseclass. You might want to take a look at this Inventory tutorial for the Blueprint Interface solution: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
So if I have an event in one blueprint, and that blueprint is called orange, I can’t call that event from another without a “orange” object stored somewhere? Why can’t I just call the event out of the orange blueprint, since it only has an effect on the character?
The way you want it to be is only possible by using the “static” keyword in c++, a way for doing this in Blueprint doesn’t exist. You probably shouldn’t worry about this, because just storing a reference to the actor in the inventory shouldn’t be much of an issue. As to why it is this way, that’s basically just how programming works. Just having the reference to a class is kind of like having a photo of a car, you know what the car is like, but that photo doesn’t allow you to do anything with/to the car. (There is probably a much better way to explain this, but this was the best thing I could come up with right now).
I hope that this did clarify your question now
The way I made my inventory, the actor is destroyed. What other way is there to do this? If I just hid the actor, people would still be able to interact with it wouldn’t they?
Yes, they would still be able to interact with it. So after turning the actor invisible, you also turn it’s collision off (and if you enabled input on the actor you should also disable input on it again). That way the player shouldn’t be able to interact with it anymore.
Alright thank you that fixed it. The only problem I see arising in the future is when I try to make the inventory save. I’m sure Ill be able to find a way around the issue though.