I’m currently making a game in the LyraStarterGame project. I want to add a feature where my players can upgrade their weapons in game without creating many weapons with different stats.
So basically, there will be a machine in my game where the player can upgrade his weapons. The machine will take the item (weapon) in the current active slot. it will double the damages, increase the magazine size and change the texture of the weapon in hand. But I don’t know how to change all these variable in game.
I want to add some details. The problem I have is that the weapons are stored as “Items” in the inventory. But I can’t get any attribute from my item because I guess I can get them from a subclass.
The items in Lyra are stored in a data structure within the ULyraInventoryManagerComponent class. In this class, you will find various functions such as AddItemDefinition(), AddItemInstance(), and RemoveItemInstance(). The actual item created in the game is the ULyraInventoryItemInstance object. To modify the item at runtime, you will need to create functions in the ULyraInventoryItemInstance class. Anticipating this, the functionality you want to modify items is more complex than it appears.