#script_player_join_faction
# INPUT: arg1 = faction_no
# OUTPUT: none
("player_join_faction",
[
(store_script_param, ":faction_no", 1),
(assign,"$players_kingdom",":faction_no"),
(try_for_range,":other_kingdom",kingdoms_begin,kingdoms_end),
(try_begin),
(neq, ":other_kingdom", ":faction_no"),
(store_relation, ":other_kingdom_reln", ":other_kingdom", ":faction_no"),
(else_try),
(store_relation, ":other_kingdom_reln", "fac_player_faction", ":other_kingdom"),
(val_max, ":other_kingdom_reln", 12),
(try_end),
(set_relation,":other_kingdom","fac_player_faction", ":other_kingdom_reln"),
(try_end),
(try_for_range, ":cur_center", centers_begin, centers_end),
#Give center to kingdom if player is the owner
(party_slot_eq, ":cur_center", slot_town_lord, "trp_player"),
(party_set_faction, ":cur_center", ":faction_no"),
(try_end),
(assign, "$g_player_banner_granted", 1),
]),