so i have now a working inventory and i can select the slots but now i want to hold a item when i have selected a slot (what i already fixed) but now i want to fix it that if i select a different slot that i destroy the actor / object i feel if i am close tho
You’re getting an error because there is no instance of the actor you’re attempting to destroy.
i feel if i am close tho
If you use Get Actor of Class in an inventory managment, then you’re far from a reliable system I’m afraid
i do this in my third person character
and the thing i spawn is in the world or is it a data thing?
It does not matter where it happens. Get Actor of Class finds no actors of the requested class. Perhaps you query wrong class?
Do isValid
on the return and see.
Why do you even need to do it? Why not just destroy the thing the player is holding? You should never use Get (all) Actors of Class. Not in an inventory, not for this.
oke it works kinda dont get a error now but now it also dont spawns a new item if i select that slot again hmm anyway thx for your help
atleast i got what i asked for
how do i do this then?
even with 8 years of trying i am still kinda bad at making my own things XD
Referencing. When you spawn an actor, have a reference variable store the return value:
You can then use that variable to manipulate that actor. Refer to it.
Sorry for the no-pic post. My fat fingers mashed enter by accident ;p
i will try that 1 sec
question do i still need that refrence of the item what i did to get the item of the current selected slot
or do i just if it is not == to 0 then do the is valid
No clue how your inventory works, what slots are and so on. What we see above is not demonstrating any structure (to me, at least).
If your player holds 10 items in slots:
You can then fetch one by index (there’s a dozen other ways). Your slots are probably represented by some kind of interface that knows which index is needed.
The above may be useless, I am assuming a lot because I know nothing about your system.
How does it work?
Slot holds a class? And you spawn from class when you select a slot? And you only want to hold / have one spawned item at a time? How close am I?
i got a actor component what takes a widget (my slot) what has 2 images and 2 text
it takes those widgets and makes it so so that i can chance it with 2 int variables (max horizontal slots (what indigates how much rows of slots must be there) and max slots (what indagates how much it must be placed over the rows)) we also have a int variable called inventory slot
we set it so that slot 1 is 0 and so fort till we have all slots
Sure, so you select by index, Is this how it’s supposed to work:
How does it work?
Slot holds a class? And you spawn from class when you select a slot? And you only want to hold / have one spawned item at a time? How close am I?
i dont know to much about it i am great at copying and changing it what i need but terrible at making it (still need to learn about that) all i know is that if i take the selected slot and say is equal to 0 that i meant a specific slot
If you do not understand the overall idea of how your own inventory works, then no one can help. How do you even proceed?
But you must know how you want it to work, surely!
- player has up to 10 items
- only one is spawned at a time
- we can cycle items
Is this what we’re making:
You gotta give us something to work with.
yes that is what i am trying to make
sorry this is kinda difficult for me can i add you on discord it would be much easier explaining i did try joining several discords but they never respond to my mesages
While I can’t possibly make the whole thing for you, see if this pseudoscript makes sense:
If plugged in, it would allow you to cycle items forward. You’ll still need to add other bits, ofc. The thing is that this is useless if you want to have stacks since you can’t store stuff in a class. This is where the data structc come in. I believe this is where you pipe in the data:
Which is fine. See if the above makes sense, and see if you can somehow slot the logic that stores item refs, destroys it and replaces it with something else.
If I accepted 1 vs 1 discord chats, I’d be a rich man, but with no time to tickle my cat.