Hello,
Designed a code to drop the spear if you decided to sheate it, works well in client side (hosting with bots) but it makes the servers crash somehow, delivering the following error message:
I feel a bit clueless about it and I would appreciate some directions if you may. Some notes might be wrong, thank you for your time.
Code:
raw_spear_drop = (ti_on_item_unwielded, 0, 0, [], #ti_on_item_unwield should make this code trigger when sheating the weapon
[
(store_trigger_param_1, ":agent"),
(store_trigger_param_2, ":item"),
(agent_is_active, ":agent"), # Prevents errors
(agent_is_alive, ":agent"), # Prevents errors
(agent_is_human, ":agent"), # Doesn't trigger for other agents
(try_for_range, ":item_slot", ek_item_0, ek_head), # Cycles through the slots
(agent_get_item_slot, ":item", ":agent", ":item_slot"),
(gt, ":item", itm_no_item), # Has the item
(item_get_type, reg0, ":item"), # Get type of the item
(eq,itp_type_polearm,reg0), # It's a polearm
(agent_unequip_item, ":agent", ":item"), # Remove item
(agent_get_position, pos1, ":agent"), # Get player position
(set_spawn_position, pos1), # Spawn stuff on player's position
(spawn_item, ":item", 0), # Stuff that will be spawned
(try_end),
])
ERROR: Synchronization with server failed: trying to recreate existing object (id: 1226, meta_type: 6, sub_kind_id: 836, variation_id: 0) with meta_type: 7, sub_kind_id: 590, variation_id: 29, do_prune: 1