Someone can help-me?
I got this error when I leave my server, just in dedicated. The number of "Invalid Agent ID:" change every time, but LINE NO, and everything another is the same.
SCRIPT WARNING ON OPCODE -2147481941: Invalid Agent ID: 2; LINE NO: 15:
At Script [86] setup_agent_for_respawn
in this script:
("setup_agent_for_respawn", # server: when an agent dies, clean up slots and attached props; set up lootable items
[(store_script_param, ":agent_id", 1),
(store_script_param, ":killer_agent_id", 2),
(try_begin),
(agent_is_active, ":agent_id"),
(agent_get_attached_scene_prop, ":instance_id", ":agent_id"),
(try_begin),
(prop_instance_is_valid, ":instance_id"),
(agent_set_attached_scene_prop, ":agent_id", -1),
(call_script, "script_cart_set_detached_position", ":instance_id"),
(try_end),
(agent_set_slot, ":agent_id", slot_agent_died_normally, 1),
(agent_set_slot, ":agent_id", slot_agent_cannot_attack, 0), # so the attack restrictons checking loop will skip this agent
(agent_get_player_id, ":player_id", ":agent_id"),
(player_is_active, ":player_id"),
(try_begin),
(neg|agent_is_non_player, ":player_id"),
(player_get_slot, ":faction_id", ":player_id", slot_player_faction_id),
(try_end),
(agent_get_position, pos1, ":agent_id"),
(set_spawn_position, pos1),
(try_begin),
(agent_is_active,":killer_agent_id"),
(agent_get_player_id, ":killer_player_id", ":killer_agent_id"),
(player_is_active, ":killer_player_id"),
(neg|agent_is_non_player, ":killer_agent_id"),
(player_get_slot, ":killer_faction_id", ":killer_player_id", slot_player_faction_id),
(else_try),
(assign,":killer_player_id",-1),
(try_end),
(try_begin),
(neq,":killer_player_id",-1),
#Check for hostile killer
(call_script, "script_cf_factions_are_hostile", ":killer_faction_id", ":faction_id"),
#if the two players factions are hostile then drop the loot
(spawn_item, "itm_human_carcass", 0, corpse_prune_timer),# Human meat
(scene_prop_set_slot, reg0, slot_animal_carcass_meat_count, 1), # Human Meat
(store_random_in_range, ":imod", imod_plain, imod_cracked + 1),
(spawn_item, "itm_agent_corpse", ":imod", corpse_prune_timer),
(assign, ":corpse_instance_id", reg0),
(prop_instance_set_position, ":corpse_instance_id", pos1),
(store_mission_timer_a, ":loot_timer"),
(val_add, ":loot_timer", corpse_loot_timer),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_corpse_owner, ":killer_player_id"),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_corpse_loot_timer, ":loot_timer"),
(store_mission_timer_a, ":prune_time"),
(val_add, ":prune_time", corpse_prune_timer),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_prune_time, ":prune_time"),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_count, corpse_inventory_slots),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_max_length, corpse_inventory_max_length),
(val_add, "$g_last_inventory_unique_id", 1),
(scene_prop_set_slot, ":corpse_instance_id", slot_scene_prop_inventory_unique_id, "$g_last_inventory_unique_id"),
(assign, ":inventory_slot", slot_scene_prop_inventory_begin),
(try_for_range, ":player_equip_slot", slot_player_equip_head, slot_player_equip_gloves + 1),
(player_get_slot, ":item_id", ":player_id", ":player_equip_slot"),
(ge, ":item_id", all_items_begin),
(scene_prop_set_slot, ":corpse_instance_id", ":inventory_slot", ":item_id"),
(val_add, ":inventory_slot", 1),
(try_end),
(try_begin), # if the only items dropped were rubbish default items, remove the corpse now for performance reasons
(eq, ":inventory_slot", slot_scene_prop_inventory_begin),
(scene_prop_set_prune_time, ":corpse_instance_id", 1),
(try_end),
(try_for_range, ":player_equip_slot", slot_player_equip_item_0, slot_player_equip_end),
(player_set_slot, ":player_id", ":player_equip_slot", 0),
(try_end),
(agent_get_position, pos1, ":agent_id"),
(agent_get_wielded_item, ":weapon_item_id", ":agent_id", 0),
(agent_get_wielded_item, ":shield_item_id", ":agent_id", 1),
(set_fixed_point_multiplier, 100),
(position_get_z, ":height", pos1), # the engine only drops the wielded items, only if above water level: drop all equipped items
(try_for_range, ":equip_slot", ek_item_0, ek_item_3 + 1),
(agent_get_item_slot, ":item_id", ":agent_id", ":equip_slot"),
(ge, ":item_id", all_items_begin),
(try_begin),
(this_or_next|eq, ":item_id", ":weapon_item_id"),
(eq, ":item_id", ":shield_item_id"),
(gt, ":height", -50),
(neq, ":item_id", "itm_money_bag"),
(else_try),
(store_add, ":unequip_slot", ":equip_slot", 1),
(agent_unequip_item, ":agent_id", ":item_id", ":unequip_slot"), # if spawning an item manually, remove it so the engine definitely won't drop a duplicate
(call_script, "script_set_random_spawn_position", 50),
(spawn_item, ":item_id", 0, "$g_spawn_item_prune_time"),
(call_script, "script_check_on_item_dropped", ":agent_id", ":item_id", reg0, 1),
(try_end),
(try_end),
(try_begin),
(neq, "$g_game_type", "mt_permanent_death"),
(agent_get_troop_id, ":troop_id", ":agent_id"),
#Upkeep
(troop_get_slot, ":upkeep_price", ":troop_id", slot_troop_upkeep_price),
(try_begin),
(gt,":upkeep_price",0),
(try_begin),
(call_script, "script_cf_check_enough_gold", ":player_id", ":upkeep_price"),
(call_script, "script_player_adjust_gold", ":player_id", ":upkeep_price", -1),
(multiplayer_send_3_int_to_player, ":player_id", server_event_preset_message, "str_upkeep_money_take", preset_message_chat_log|preset_message_red, ":upkeep_price"),
(else_try),
(try_begin),
(ge,":faction_id",castle_factions_begin),
(assign,":troop_id", "trp_serf"),
(else_try),
(assign,":troop_id", playable_troops_begin),
(try_end),
#Female troop types
(player_get_gender, ":gender", ":player_id"),
(try_begin),
(eq,":gender",tf_female),
(troop_get_slot, ":female_troop", ":troop_id", slot_troop_has_female),
(try_begin),
(ge,":female_troop",playable_troops_begin),
(assign,":troop_id",":female_troop"),
(try_end),
(else_try),
(troop_get_slot, ":male_troop", ":troop_id", slot_troop_female),
(ge,":male_troop",playable_troops_begin),
(assign,":troop_id",":male_troop"),
(try_end),
#Female end
(player_set_troop_id, ":player_id", ":troop_id"),
(multiplayer_send_3_int_to_player, ":player_id", server_event_preset_message, "str_upkeep_money_fail", preset_message_chat_log|preset_message_red, ":upkeep_price"),
(try_end),
(try_end),
#Upkeep - End
(try_end),
(agent_get_slot, ":freeze_instance_id", ":agent_id", slot_agent_freeze_instance_id),
(try_begin),
(gt, ":freeze_instance_id", -1),
(call_script, "script_remove_scene_prop", ":freeze_instance_id",0),
(agent_set_slot, ":agent_id", slot_agent_freeze_instance_id, -1),
(try_end),
(troop_get_slot, ":spawn_health_percent", ":troop_id", slot_troop_spawn_health_percent),
(player_set_slot, ":player_id", slot_player_next_spawn_health_percent, ":spawn_health_percent"),
(else_try),
(player_set_slot, ":player_id", slot_player_next_spawn_health_percent, 100),
(player_set_troop_id, ":player_id", playable_troops_begin),
(player_set_slot, ":player_id", slot_player_faction_id, factions_begin),
(try_end),
(player_set_slot, ":player_id", slot_player_spawn_state, player_spawn_state_dead),
(try_end),
]),