Ok I just commented out this simple trigger and it fixed the problem. How is the player being set as the target? I know it is what you said, 0 means it will affect the player so the target is the player, but I dont know how or why, this is native code and I dont see how the target is set to 0.
Edit: When I put this code back in the problem seemed to have fixed itself. It doesnt happen anymore, although I need to test it some more. If it comes up again I think I have an idea of how to fix it. Ill just put in a check for the target party and if it is the player Ill stop it from being the player.
# Spawn village farmer parties
(24,
[
(try_for_range, ":village_no", villages_begin, villages_end),
(party_slot_eq, ":village_no", slot_village_state, svs_normal),
(party_get_slot, ":farmer_party", ":village_no", slot_village_farmer_party),
(this_or_next|eq, ":farmer_party", 0),
(neg|party_is_active, ":farmer_party"),
(store_random_in_range, ":random_no", 0, 100),
(lt, ":random_no", 30),
(call_script, "script_create_village_farmer_party", ":village_no"),
(assign, ":party_no", reg0),
(party_set_slot, ":village_no", slot_village_farmer_party, ":party_no"),
(str_store_party_name, s1, ":village_no"),
# (display_message, "@Village farmers created at {s1}."),
(try_end),
]),
Here's the script
("create_village_farmer_party",
[(store_script_param, ":village_no", 1),
(party_get_slot, ":town_no", ":village_no", slot_village_market_town),
(store_faction_of_party, ":party_faction", ":town_no"),
(set_spawn_radius, 0),
(spawn_around_party, ":village_no", "pt_village_farmers"),
(assign, ":new_party", reg0),
(party_set_faction, ":new_party", ":party_faction"),
(party_set_slot, ":new_party", slot_party_home_center, ":village_no"),
(party_set_slot, ":new_party", slot_party_type, spt_village_farmer),
(party_set_slot, ":new_party", slot_party_ai_state, spai_trading_with_town),
(party_set_slot, ":new_party", slot_party_ai_object, ":town_no"),
(party_set_ai_behavior, ":new_party", ai_bhvr_travel_to_party),
(party_set_ai_object, ":new_party", ":town_no"),
(party_set_flags, ":new_party", pf_default_behavior, 0),
(store_sub, ":item_to_price_slot", slot_town_trade_good_prices_begin, trade_goods_begin),
(try_for_range, ":cur_goods", trade_goods_begin, trade_goods_end),
(store_add, ":cur_good_price_slot", ":cur_goods", ":item_to_price_slot"),
(party_get_slot, ":cur_village_price", ":village_no", ":cur_good_price_slot"),
(party_set_slot, ":new_party", ":cur_good_price_slot", ":cur_village_price"),
(try_end),
(assign, reg0, ":new_party"),
]),