I need another help again… I have been googling Basic Inventory System, TMap, TArray
(Thanks to WCode, Rama and alvarofer0020… cannot remember others… sorry)
However… I face another problems. And my time is very short (the deadline is close by few days… few days!)
- I have a item class based on Actor, it has many members such as name, currency value and so on.
There are various items, and inheritance is not enough to make various types of items. Thus
I used actor component to contain its uniqueness.
For instance, I have a item called a Spear. Primary feature is an weapon. but it can be used as Ammo by a pipe gun.
I thought about making an another class (object) as “WeaponAndAmmo”, somehow it does not sounds right to me.
Thus I made separate component as Weapon Component, Ammo Component… is it better? if it sounds okay,
How do I access its component from Actor class in C++?
- In TArray, How do I find specific the object by searching the demanded value? As I commented above,
I have a class named Item and has FString member as its Name. But I want to find the item by a name in TArray Inventory.
The reason I use TArray for one of inventories… because even though these items (actually weapons) has same name, but each item has durability - thus each of them is unique. They don’t have Quantity value. But I am hesitating to use TMap as Weapon Inventory… but it does not sounds right to myself if I ever think about using weapon type inventory as TMap.
3.In TMap, I used UFUNCTION to access it, if I want to use it from BP. But is it possible to access every objects in TMap
by iteration? and if there is, which method is faster and safe? I might need examples… googling is not enough to get what I want.
- TMap to TArray, is it possible even with same object type? I might to create the temporary UI(or UMG) Inventory for displaying which items are available to use by TArray. However one of current inventory is TMap. I need to transfer from the TMap data to to TArray… is it even possible? even with same data type? For instance, I need put available Ammo and certain weapons from the current Inventories to UI Display Inventory (thus the player can choose item to use during battle). But Ammo Inventory is TMap… and UI Display Inventory is going to be TArray… if I start to program the battle system.
I know it sounds complicated. but I really have short time with limited knowledge about Unreal Engine and C++ than I thought.
Please… I need your help… Desperately.