I have this 4 crafting materials. i can right click and drop it on the item below which i want to craft. The problem is the item below do not recognize what exactly was dropped on it and it count all 4 crafting objects as equal. It cannot recognize that those are 4 are seperate items. How can i achieve this ? I was thinking maybe a “String on int” node or something but couldn’t figure it out so far So i want object 1 when i drop it on the crafting object below it should show me object 1 then object 2 and so on…
Not sure what that means. Is this all 3d? Show it in what way? What’s there to show if the items are already laying on the table?
I’d just have a crafting table catch falling items via an overlap and have it add them to an array or a unique array, or even a set. But I might be misunderstanding what is needed.
Normally, you’d make enumerator or ingredient ID system and store those in a container, then compare it against a crafting recipe.
the item below do not recognize what exactly was dropped on it and it count all 4 crafting objects as equal. It cannot recognize that those are 4 are seperate items.
Perhaps if you could post the script of what is being compared against what and how, it would help clarify things.
Hi, and yes it’s all 3d i can send a video how it looks like in a sec.
So top are my crafting objects and i want to drop them on the item below
It’s not 3d at all. These are widgets.
There is no way to help if we do not know what the script is doing. How it could work:
onDrop → (is container empty) → Get Payload → extract it → add to slot → add it or its ID to the table → have the crafting table compare the container content against a crafting recipe
oh yeah those are widgets but all the objects exist in 3d as well and i need to pick them up. After that numbers update. What can i do from here i have on drop set up and then decrease the stats by 1 when dropping one of those. But it recognize them all as the same so acctually it not shown on the video because i tested something. But it was when i drop any of the top crafting objects it will subtract -1 to all 4 and not -1 to only the one i was dropping.
What kind of answer are you expecting? We can’t see what the script is doing.
Place breakpoints everywhere, run the debugger, flag variables to watch, prints values, step through the code, see where data stops flowing or stops making sense.
Was looking for a simple solution how this should be properly done. Those crafting materials they do have a data table. So i need to go On drop - then get the data table - and then check if the name is == to my object im dropping ? And then i have stats function i can call decrease object 1 by -1 amount something like that im not sure.
Add a variable called CurrentHeldItem(or whatever name you like), then on click put the class or name or some kind of identifier from the item you are holding into it. When you release the RMB and drop it on top of the other one, check what’s inside CurrentHeldItem and use that anywhere necessary.
With stacks of inventory items? This is never simple, actually. Inventories + crafting is generally convoluted. Hence the plethora of tuts of varying quality. Avoid comparing strings. Use sets if crafting table does not require repetitions.
No those stats are outside of the inventory. (inventory has its own stacks and numbers but those are disabled because i have simple stats component where i manage those stats. At the end i can just call the function there decrease by “x” amount or increase and so on.
This is how it looks like atm
But i don’t know what to do from here. CurrentHeldItem what type of variable that should be so i can get or store the info of the data table which holds the info ? On the data table there are like 100+ items i want to store just those 4.
Firstly, I don’t know what exactly you are going to do after you manage to differentiate between items. I also don’t know how you are managing your top row items(are these just images? classes? object references? do they inherit the same class?)
so I’m going to give a general answer.
There are various ways you can do this but what I would personally do is, associate each slot in the top row with an item class then on click, depending on which one was clicked put that class inside the CurrentHeldItem variable. In this case the CurrentHeldItem type would be a class reference to a common class between all your items. Then inside the on drop you check that class and use it for whatever you want. If for example you clicked and grabbed the green item, you would have green item class inside your currentHeldItem which you can use to distinguish between different items.
Obviously this can vary a lot depending on your actual implementation of the whole system…
Ty i will try it out. Unfortunatly the data table has no class info about this items. Just image and description. The item itself is in a solo BP where there is the logic to be picked up and stats change accordingly.
associate each slot in the top row with an item class then on click,
I wish i knew how to do this - The image above has the info from the data table and is a button which can be dragged and dropped. So it has to be this way to work at least drag and drop. I now only need to associate this with the class you mentioned. Then i can store this class in the CurrentHeldItem. But of now i cannot do it. If i store there in this CurrentHeldItem - 1of those objects from the solo BP it will do nothing and is not associated to the green drag and drop icon. Do i need to add the class in the data table as well - so my solo BP as a class there ?
I now put it here in the data table as a class
And now on the CurrentHeldItem as a reference to this BP
Would this now work like this ? And what would be the next steps to complete this ?
If this works for 1 item i would then make parent class of it to the other 3 then as of now those are 4 separate Blueprints with no connection to the data table. (Now i added 1 of them to the data table as a class reference if this is correct like this)
I manage to make it work. Just as you say to store the item information in this CurrentHeldItem variable. I awso added it to the data table the BP i had as a class REF. And then acctually just check if the class on the data table is = to the class stored in the CurrentHeldItem. And if both are equal then i can execute whatever i want next.
That was pretty much what i was looking for - some simple solution how to do this. Thx