#process_rpc: Invalid packet received. Requested node was not

1 messages · Page 1 of 1 (latest)

neat gull
#

hmm game works as intened but this is bugging me

    for child in item_container.get_children():
        if child.name == item_id:
            return true
    return false

@rpc("any_peer", "call_local", "reliable")
func recive_gift(item_id):
    item_id = str(item_id)
    
    if !item_container_has_item(item_id):
        print("Item not found for receiving gift: " + item_id)
        return
    
    var item_node = item_container.get_node(item_id)
    var slot_data = item_node.slot_data
    
    if player:
        player.inventory_data.inventory.pick_up_slot_data(slot_data)

@rpc("any_peer", "call_local", "reliable")
func remove_item_rpc(item_id):
    item_id = str(item_id)
    
    if item_container_has_item(item_id):
        item_container.get_node(item_id).queue_free()
        print("Item removed with ID: " + item_id)
    else:
        print("Attempted to remove item, but it was not found: " + item_id)
icy oyster
#

i assume what's happening is that the packet is fine but the node its directed too doesn't exist within the tree. on the side that got the rpc. if this is a client maybe the node isn't spawned in for the client.

does it work as intended for both clients and the server?
i don't know the error message is kind of obscure

neat gull
#

so hmm its a item drop

#

after a player picked

#

it just gets everyone notifed and removed

#

this works as intended as long as both not standing on the item

#

but if both standing on the item . somehow the rpc is called twice i assume

icy oyster
#

there will always be a little bit of delay between clients
i'm guessing its like an automatic pickup system
so maybe if both players stand on it, you get a race condition. which ever pick request gets processed first will delete the item and the second slower RPC will arrive to an item that doesn't exist anymore

you could try handling for that by keeping the item around in an unpickable state for a bit of time to allow all RPC calls to finish
or find a way to split the picking RPC from the item so that you can check if the item is valid on the server side when it gets the RPC