i have item value with structure type, and few other builded with same structure
can they be unique? becouse when i try to add them in array, and after check it there is few issues:
if i try to check is in array some item, we don’t add it again, and if there is two items like to pensils it look like it one item
it too complicated to explain this( but i hope you understand my problem. Thanks
If you can’t explain then how can we understand it.
You can just create some screenshots and use some pencil sketches to highlight what you mean will help a lot.
and some time i have array of those items, there can be few same type items like white cup and white cup, they same but in both of them can be different liquid
so they are different items but same type, and question is: how to make them unique
in this function in different index can be one item, but when i try to check them they looks like same so i have some problems with phantom items or if there few items same type they look like one item
So, let me rephrase your goal to create an inventory system where duplicate items will not be added but items with unique accessories or liquids will deserve a slot in an array? But your current system only treats them as one regardless of their liquids?"
If so, then do the check for the liquids as well. Just after you know the item already exists do another check to see if the liquids already exist in the slot, if not then add otherwise do not add.
liquid is not a point. even if they empty they must be different items, even if they same type if two green cups they must be two green cups in array, so when i loop array and try to find items there there must be two cups and every time when loop find new item must do something
but now when loop and first time find green cup, and second time see green cup it think that this is same item and don’t do nothing(
thats the problem… one item can take few indexes in array like 2 slots, and if it appear in array 1 time, next time this item must not be added in next array, thats what a problem. that this items are like one, or different, depending what i’m trying to check.
i think that variable with structure is same all, and don’t have unique between them
i try few another ways but they don’t work properly for me( and i back to structures
and main what i want to understand is:
i have structure STR_Item:
Name
Amount
MEsh
…
item is value type - STR_Item
so i have few actors on map items builded on this structure
let it be:
four apples with 1 amount each of them
few stuck of bolts first stuck with 2 bolts, and second with 3 bolts
if i put them in array, but 1 apple use 2 slots in array to place it, bolts use 1 slot.
so apple will be on index 0-1, 2-3, 5-6 …
sooo, after i want to get count apples in array, how can i get them?
if i just try to find in array item with name apple it will give me 8 apples, not 4 (ofcourse we can just devide result on two, but it’s not an option)
how to understand that on index 0 and 1 one item?
and this item different from another item even if their info same
sorry if i “burdened” you with this) trying to build corect inventory system with replication and have some issues(
Deng, you make it sound so confusing for us to understand. Okay, so let me rephrase your question. You are asking about creating an inventory system where, you currently have a system that always treats new items to be inside a new slot, right? And then, you are asking how to check how many of a specific item are inside the array, for example, you have 4 slots of apples and how do you check if you have 4, right?
You can’t because 0 and 1 are two different indexes. You will have to implement tags to classify it into the same type of class or perhaps some string checks.
in my system (before i made it on objects but they couldn’t be replicated) i can place items on grid, and one item can takle few slots, so in array looks like item take few indexes.
so there must be maybe some id in structure wich can show that on those indexes one item
if we have some basket for aplles, its big and take 22 slots
so if we have inventory 44 basket will take for examples 0,1,4,5 indexes, another basket will be onright bottom side of inventory with indexes 10,11,14,15
in every array index will be basket item structure, sooo ihope now you understand what i’m trying to resolve) it’s to complicated to explain for me)
so i don’t know how better to resolve this problem
becouse if i try to find there in this array basket i have result 8 of them, but there is only 2
if i try to find basket and in some local variable set that basket founded on first index, it will stop find another becouse it same
i need something unique to see that few indexes are one item