How does this work? If I would guess then there should be no problem since after the first event has been executed, it will keep executing the local event.
However I have an issue that seems like this could be an issue, trying to sort out if it is or not
Hmm probably why the refresh on the clients local machine never happen instantly and requires a reconstruct of the inventory by tapping “i”.
I am drawing another way of doing this at the moment. What happened earlier was that the server rearranged the items in the inventory for the player wich, is crazy
I need the physical inventory (The array that holds the structs) to always remain the same, and the only thing the player does is basically moving references around.
So that if UIslot 1 reference to item 7, then if I move item from slot 1 to 5 all it does is locally change so that now slot 5 reference to item 7.
It feels like it should be also fairly safe since no matter what you do locally the server keeps track of what items you own.
Thanks for the help, should be able to fix this pretty fast
how i would build inventory
as replicated actor, which exist on server and on owner client
it contain array, the library, struct with inventory items object class, quantity and slot ID.
1.when item changed, inventory actor pass the updated item slot id into client and client update actual HUD based on this data.
2.when player swap some items, slot ID of those items go into server, server go over all library items, found one which has id swapped and swap them on server and run part 1
3.when player opens the inventory, hud just read the value of replicated library and set the icon in HUD for each item which found
4.when player refresh inventory (whatever that means, since out inventory always on sync), hud read the value of replicated library and set the icons for each item also adding the ID of new items into another array, than it go over all existing ID and if those cannot be found in newly updated array IDs its reset the icon.
This is basically me not using onrep notify. It is whenever the thumbnails in your inventory has to be checked and updated, like after a pickup, after a drop, opening the inventory etc.
Thanks for sharing how you would have made your inventory! Its fun reflecting over methods on how to solve problems.
What I have now is alright for testing purposes but might need some updated security later.
1: Each inventory slot gets a slotNumber and a ReferenceNumber. ReferenceNumber points to a slot in the physical inventory controlled only by the server, the array wich holds the acctual items and their stats.
2: When a player swaps items, the reference numbers swap.
3: When an item is dropped, say SlotNumber10 gets dropped, it refers to slot 5 in physical inventory, so server drops item 5. And player reads that in slot 5 is nothing, and updates that slot to display nothing.
4: When player opens inventory it goes through all inventoryslots, gets the proper thumbnail based off of reference number of each slot.
Im thinking of cheating as of what a player could do with their inventory locally and well they could for example say that all ui slots refers to that one super item in their inventory.
But, since when the server drops that item it is no longer there so now all inv slots would refer to an empty slot.
I dont know im not a proffesional when it comes to security, but as of now it seems solid enough and quite fast.
My items are structures I think you could say. Holding all stats, names and also the class. So when you pick something up you destroy it permanently, when you then drop it or equip it a new object is created from the class.
This I have no idea if its usually done this way, or if its fast or not. I guess time will tell