#item manipulation

1 messages · Page 1 of 1 (latest)

fair ridge
#

You should be able to do these things from the server side entirely

#

What methods do you use to apply the new items to the player?

honest falcon
#

I use
SCR_InventoryStorageManagerComponent::TryInsertItem when equipping new cloth [executed on Owner]
BaseWeaponManagerComponent::SetSlotWeapon when equipping new weapons [executed on Owner]
SCR_InventoryStorageManagerComponent::TrySpawnPrefabToStorage when adding items to any storage (this one works fine executed from client/owner side) [executed on Owner]
SCR_InventoryStorageManagerComponent::TryRemoveItemFromInventory and SCR_EntityHelper::DeleteEntityAndChildren when deleting entities [executed on Owner]

high vapor
honest falcon
high vapor
fair ridge
#

Those should all work from the server side. Try only calling them there.

fair ridge
high vapor
# fair ridge Probably rather an issue of you executinmg the code on client AND server acciden...

That is what I thought, but the methods were printing out for clients that it exited since it wasn't the owner/authority. The server would execute.

The fix I had was to specify the container to add items to AND swap the purpose from ANY to deposit and that stopped duplicating items. I feel like there's something bugged in that system because that's the only thing I changed which stopped the dupe bug

fair ridge
#

if you can make a simple example to reproduce please put it onto the feedback tracker and we will have a look

high vapor
#

good idea, I have a scenario I made for testing I can create a doc on how I tested it

#

Does require a player to be live, on the map beforehand. Otherwise player joins/spawns and things are synced properly

honest falcon
honest falcon
#

Works on my test script, now i'm going to test it on my application.
I think that i tried this a while ago, and didn't work. Something changed in some update?

honest falcon
#

Seems to be "working fine", i forgot to say that y use SCR_InventoryStorageManagerComponent::TryRemoveItemFromInventory to, and is failing when executed on server. Should i use another one?

fair ridge
#

Some of the scripted ones might be designed for client side usage. look at the base class, those all work from the sever side.

#

And yes we updated the inventory to allow server side manipulation a while ago during one of the 0.9.X updates

honest falcon
#

I tested it with TryRemoveItemFromStorage and TryDeleteItem but both fail when testing on localHost + PeerTool or dedicated server

honest falcon
#

It's working now, i had something wrong in another place notlikemeow

#

Now it's time to clean the code. Thx for your help @fair ridge