Yeah, it's me... Again!
I'm wondering how I should do to let enemies group up against me in battle.
Basicly, I'm trying to convert this TML Tweak into the MS.
I know what part of code I should change, but not WHAT to change.
Here's the code:
SOLVED!
I'm wondering how I should do to let enemies group up against me in battle.
Basicly, I'm trying to convert this TML Tweak into the MS.
I know what part of code I should change, but not WHAT to change.
Here's the code:
Code:
# script_let_nearby_parties_join_current_battle
# Input: arg1 = besiege_mode, arg2 = dont_add_friends
# Output: none
("let_nearby_parties_join_current_battle",
[
(store_script_param, ":besiege_mode", 1),
(store_script_param, ":dont_add_friends", 2),
(assign, ":join_distance", 5),
(try_begin),
(is_currently_night),
(assign, ":join_distance", 3),
(try_end),
(try_for_parties, ":party_no"),
(party_get_battle_opponent, ":opponent",":party_no"),
(lt, ":opponent", 0), #party is not itself involved in a battle
(party_get_attached_to, ":attached_to",":party_no"),
(lt, ":attached_to", 0), #party is not attached to another party
(get_party_ai_behavior, ":behavior", ":party_no"),
(neq, ":behavior", ai_bhvr_in_town),
(store_distance_to_party_from_party, ":distance", ":party_no", "p_main_party"),
(lt, ":distance", ":join_distance"),
(store_faction_of_party, ":faction_no", ":party_no"),
(store_faction_of_party, ":enemy_faction", "$g_enemy_party"),
(try_begin),
(eq, ":faction_no", "fac_player_supporters_faction"),
(assign, ":reln_with_player", 100),
(else_try),
(store_relation, ":reln_with_player", ":faction_no", "fac_player_supporters_faction"),
(try_end),
(try_begin),
(eq, ":faction_no", ":enemy_faction"),
(assign, ":reln_with_enemy", 100),
(else_try),
(store_relation, ":reln_with_enemy", ":faction_no", ":enemy_faction"),
(try_end),
(assign, ":enemy_side", 1),
(try_begin),
(neq, "$g_enemy_party", "$g_encountered_party"),
(assign, ":enemy_side", 2),
(try_end),
(try_begin),
(eq, ":besiege_mode", 0),
(lt, ":reln_with_player", 0),
(gt, ":reln_with_enemy", 0),
(party_get_slot, ":party_type", ":party_no"),
(eq, ":party_type", spt_kingdom_hero_party),
(get_party_ai_behavior, ":ai_bhvr", ":party_no"),
(neq, ":ai_bhvr", ai_bhvr_avoid_party),
(party_quick_attach_to_current_battle, ":party_no", ":enemy_side"), #attach as enemy
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_enemy"),
(else_try),
(eq, ":dont_add_friends", 0),
(gt, ":reln_with_player", 0),
(lt, ":reln_with_enemy", 0),
(assign, ":do_join", 1),
(try_begin),
(eq, ":besiege_mode", 1),
(assign, ":do_join", 0),
(eq, ":faction_no", "$players_kingdom"),
(faction_slot_eq, "$players_kingdom", slot_faction_marshall, "trp_player"),
(assign, ":do_join", 1),
(try_end),
(eq, ":do_join", 1),
(party_get_slot, ":party_type", ":party_no"),
(eq, ":party_type", spt_kingdom_hero_party),
(party_stack_get_troop_id, ":leader", ":party_no", 0),
# (troop_get_slot, ":player_relation", ":leader", slot_troop_player_relation),
(call_script, "script_troop_get_player_relation", ":leader"),
(assign, ":player_relation", reg0),
(ge, ":player_relation", 0),
(party_quick_attach_to_current_battle, ":party_no", 0), #attach as friend
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_friend"),
(try_end),
(try_end),
]),
SOLVED!
Solution said:Thanks Berserker and Keedo for the code.
Search for:
let_nearby_parties_join_current_battle
in Scripts.py and paste the lines marked in red:
(try_begin),
(eq, ":besiege_mode", 0),
(lt, ":reln_with_player", 0),
(gt, ":reln_with_enemy", 0),
(party_get_slot, ":party_type", ":party_no"),
#(eq, ":party_type", spt_kingdom_hero_party),
(neg|is_between,":party_no",spawn_points_begin, spawn_points_end),
(neq, ":party_type", spt_town),
(neq, ":party_type", spt_castle),
(neq, ":party_type", spt_kingdom_caravan),
(get_party_ai_behavior, ":ai_bhvr", ":party_no"),
(neq, ":ai_bhvr", ai_bhvr_avoid_party),
(party_quick_attach_to_current_battle, ":party_no", ":enemy_side"), #attach as enemy
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_enemy"),
(else_try),
(eq, ":dont_add_friends", 0),
(gt, ":reln_with_player", 0),
(lt, ":reln_with_enemy", 0),
(assign, ":do_join", 1),
(try_begin),
(eq, ":besiege_mode", 1),
(assign, ":do_join", 0),
(eq, ":faction_no", "$players_kingdom"),
(faction_slot_eq, "$players_kingdom", slot_faction_marshall, "trp_player"),
(assign, ":do_join", 1),
(try_end),
(eq, ":do_join", 1),
(party_get_slot, ":party_type", ":party_no"),
#(eq, ":party_type", spt_kingdom_hero_party),
(neg|is_between,":party_no",spawn_points_begin, spawn_points_end),
(neq, ":party_type", spt_town),
(neq, ":party_type", spt_castle),
(neq, ":party_type", spt_kingdom_caravan),
(party_stack_get_troop_id, ":leader", ":party_no", 0),
# (troop_get_slot, ":player_relation", ":leader", slot_troop_player_relation),
(call_script, "script_troop_get_player_relation", ":leader"),
(assign, ":player_relation", reg0),
(ge, ":player_relation", 0),
(party_quick_attach_to_current_battle, ":party_no", 0), #attach as friend
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_friend"),
(try_end),
(try_end),
]),