WB Coding Befriending Outlaws and other Minor Factions (e.g. Manhunters)

正在查看此主题的用户

dsfrozen

Squire
Hello, I have been looking for two days for some code that allows a dynamic relationship between the player and the non-kingdom factions (outlaws, manhunters, etc.).

I was able to create a faction leader and enable the player to join any side of the battle (thus being able to 'help' the outlaws) but this does not appear to have an effect on the overall relationship with the outlaws faction.

I am probably missing something obvious but I would have expected this to be a fairly common modification; I think I have seen it in PoP, Brytenwalda, the Old West ones and so on.

Thank you!
 
解决方案
You'll have to set it yourself. Did you edit anything in the "pre_join" menu?
I'll show you a code:
Python:
    ("pre_join", 0,
        "You come across a battle between {s2} and {s1}. You decide to...",
        "none",
        [
            (str_store_party_name, s1, "$g_encountered_party"),
            (str_store_party_name, s2, "$g_encountered_party_2"),
        ],
        [
            ("pre_join_help_attackers",
                [
                    (store_faction_of_party, ":attacker_faction", "$g_encountered_party_2"),
                    (store_relation, ":attacker_relation", ":attacker_faction", "fac_player_supporters_faction"),
                    ## WINDYPLAINS+ ## - Join any side and show allies vs. enemies...
You'll have to set it yourself. Did you edit anything in the "pre_join" menu?
I'll show you a code:
Python:
    ("pre_join", 0,
        "You come across a battle between {s2} and {s1}. You decide to...",
        "none",
        [
            (str_store_party_name, s1, "$g_encountered_party"),
            (str_store_party_name, s2, "$g_encountered_party_2"),
        ],
        [
            ("pre_join_help_attackers",
                [
                    (store_faction_of_party, ":attacker_faction", "$g_encountered_party_2"),
                    (store_relation, ":attacker_relation", ":attacker_faction", "fac_player_supporters_faction"),
                    ## WINDYPLAINS+ ## - Join any side and show allies vs. enemies.
                    # (store_faction_of_party, ":defender_faction", "$g_encountered_party"),
                    # (store_relation, ":defender_relation", ":defender_faction", "fac_player_supporters_faction"),
                    (try_begin),
                        (eq, ":attacker_faction", "$players_kingdom"),
                        (str_store_string, s21, "@Ally"),
                    (else_try),
                        (ge, ":attacker_relation", 10),
                        (str_store_string, s21, "@Friend"),
                    (else_try),
                        (lt, ":attacker_relation", 0),
                        (str_store_string, s21, "@Enemy"),
                    (else_try),
                        (str_store_string, s21, "@Neutral"),
                    (try_end),
                    # (ge, ":attacker_relation", 0),
                    # (lt, ":defender_relation", 0),
                ],
            "Move in to help the {s2}. ({s21})",
                [
                    (select_enemy, 0),
                    (assign, "$g_enemy_party", "$g_encountered_party"),
                    (assign, "$g_ally_party", "$g_encountered_party_2"),
                    ## WINDYPLAINS+ ## - Join any side - relation changes
                    (try_begin),
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (store_relation, ":relation", ":faction_no", "fac_player_supporters_faction"),
                        (ge, ":relation", -10),
                        #Improve relation with ally lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_ally_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_ally_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", 1),
                        (try_end),
                        #Reduce relation with enemy lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_enemy_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_enemy_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", -1),
                        (try_end),
                        #Improve relation with ally faction.
                        (store_faction_of_party, ":faction_no", "$g_ally_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", 2),
                        #Reduce relation with enemy faction.
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", -2),
                    (try_end),
                    ## WINDYPLAINS- ##

                    #reset entrenchments status for this mission +Dj_FRedy
                    (try_begin),
                        (party_get_slot, ":party_entrenched", "p_main_party", slot_party_entrenched),
                        (this_or_next|eq, ":party_entrenched", 1), #entrenched camp
                        (party_slot_eq, "p_main_party", slot_party_siege_camp, 1), #entrenched siege camp

                        (party_set_slot, "p_main_party", slot_party_entrenched, 0),
                        (party_set_slot, "p_main_party", slot_party_siege_camp, 0),
                    (try_end),

                    (jump_to_menu, "mnu_join_battle"),
                ]
            ),

            ("pre_join_help_defenders",
                [
                    ## WINDYPLAINS+ ## - Join any side and show allies vs. enemies.
                    # (store_faction_of_party, ":attacker_faction", "$g_encountered_party_2"),
                    # (store_relation, ":attacker_relation", ":attacker_faction", "fac_player_supporters_faction"),
                    (store_faction_of_party, ":defender_faction", "$g_encountered_party"),
                    (store_relation, ":defender_relation", ":defender_faction", "fac_player_supporters_faction"),
                    (try_begin),
                        (eq, ":defender_relation", "$players_kingdom"),
                        (str_store_string, s21, "@Ally"),
                    (else_try),
                        (ge, ":defender_relation", 10),
                        (str_store_string, s21, "@Friend"),
                    (else_try),
                        (lt, ":defender_relation", 0),
                        (str_store_string, s21, "@Enemy"),
                    (else_try),
                        (str_store_string, s21, "@Neutral"),
                    (try_end),
                    # (ge, ":defender_relation", 0),
                    # (lt, ":attacker_relation", 0),
                ],
            "Rush to the aid of the {s1}. ({s21})",
                [
                    (select_enemy, 1),
                    (assign, "$g_enemy_party", "$g_encountered_party_2"),
                    (assign, "$g_ally_party", "$g_encountered_party"),
                    ## WINDYPLAINS+ ## - Join any side - relation changes
                    (try_begin),
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (store_relation, ":relation", ":faction_no", "fac_player_supporters_faction"),
                        (ge, ":relation", -10),
                        #Improve relation with ally lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_ally_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_ally_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", 1),
                        (try_end),
                        #Reduce relation with enemy lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_enemy_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_enemy_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", -1),
                        (try_end),
                        #Improve relation with ally faction.
                        (store_faction_of_party, ":faction_no", "$g_ally_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", 2),
                        #Reduce relation with enemy faction.
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", -2),
                    (try_end),
                    ## WINDYPLAINS- ##

                    #reset entrenchments status for this mission +Dj_FRedy
                    (try_begin),
                        (party_get_slot, ":party_entrenched", "p_main_party", slot_party_entrenched),
                        (this_or_next|eq, ":party_entrenched", 1), #entrenched camp
                        (party_slot_eq, "p_main_party", slot_party_siege_camp, 1), #entrenched siege camp

                        (party_set_slot, "p_main_party", slot_party_entrenched, 0),
                        (party_set_slot, "p_main_party", slot_party_siege_camp, 0),
                    (try_end),

                    (jump_to_menu, "mnu_join_battle"),
                ]
            ),

            ("pre_join_leave", [],
            "Don't get involved.",
                [
                    (leave_encounter),
                    (change_screen_return),
                ]
            ),
        ]
    ),
I think the #comments in the block are self-explanatory.
 
点赞 0
解决方案
You'll have to set it yourself. Did you edit anything in the "pre_join" menu?
I'll show you a code:
Python:
    ("pre_join", 0,
        "You come across a battle between {s2} and {s1}. You decide to...",
        "none",
        [
            (str_store_party_name, s1, "$g_encountered_party"),
            (str_store_party_name, s2, "$g_encountered_party_2"),
        ],
        [
            ("pre_join_help_attackers",
                [
                    (store_faction_of_party, ":attacker_faction", "$g_encountered_party_2"),
                    (store_relation, ":attacker_relation", ":attacker_faction", "fac_player_supporters_faction"),
                    ## WINDYPLAINS+ ## - Join any side and show allies vs. enemies.
                    # (store_faction_of_party, ":defender_faction", "$g_encountered_party"),
                    # (store_relation, ":defender_relation", ":defender_faction", "fac_player_supporters_faction"),
                    (try_begin),
                        (eq, ":attacker_faction", "$players_kingdom"),
                        (str_store_string, s21, "@Ally"),
                    (else_try),
                        (ge, ":attacker_relation", 10),
                        (str_store_string, s21, "@Friend"),
                    (else_try),
                        (lt, ":attacker_relation", 0),
                        (str_store_string, s21, "@Enemy"),
                    (else_try),
                        (str_store_string, s21, "@Neutral"),
                    (try_end),
                    # (ge, ":attacker_relation", 0),
                    # (lt, ":defender_relation", 0),
                ],
            "Move in to help the {s2}. ({s21})",
                [
                    (select_enemy, 0),
                    (assign, "$g_enemy_party", "$g_encountered_party"),
                    (assign, "$g_ally_party", "$g_encountered_party_2"),
                    ## WINDYPLAINS+ ## - Join any side - relation changes
                    (try_begin),
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (store_relation, ":relation", ":faction_no", "fac_player_supporters_faction"),
                        (ge, ":relation", -10),
                        #Improve relation with ally lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_ally_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_ally_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", 1),
                        (try_end),
                        #Reduce relation with enemy lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_enemy_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_enemy_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", -1),
                        (try_end),
                        #Improve relation with ally faction.
                        (store_faction_of_party, ":faction_no", "$g_ally_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", 2),
                        #Reduce relation with enemy faction.
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", -2),
                    (try_end),
                    ## WINDYPLAINS- ##

                    #reset entrenchments status for this mission +Dj_FRedy
                    (try_begin),
                        (party_get_slot, ":party_entrenched", "p_main_party", slot_party_entrenched),
                        (this_or_next|eq, ":party_entrenched", 1), #entrenched camp
                        (party_slot_eq, "p_main_party", slot_party_siege_camp, 1), #entrenched siege camp

                        (party_set_slot, "p_main_party", slot_party_entrenched, 0),
                        (party_set_slot, "p_main_party", slot_party_siege_camp, 0),
                    (try_end),

                    (jump_to_menu, "mnu_join_battle"),
                ]
            ),

            ("pre_join_help_defenders",
                [
                    ## WINDYPLAINS+ ## - Join any side and show allies vs. enemies.
                    # (store_faction_of_party, ":attacker_faction", "$g_encountered_party_2"),
                    # (store_relation, ":attacker_relation", ":attacker_faction", "fac_player_supporters_faction"),
                    (store_faction_of_party, ":defender_faction", "$g_encountered_party"),
                    (store_relation, ":defender_relation", ":defender_faction", "fac_player_supporters_faction"),
                    (try_begin),
                        (eq, ":defender_relation", "$players_kingdom"),
                        (str_store_string, s21, "@Ally"),
                    (else_try),
                        (ge, ":defender_relation", 10),
                        (str_store_string, s21, "@Friend"),
                    (else_try),
                        (lt, ":defender_relation", 0),
                        (str_store_string, s21, "@Enemy"),
                    (else_try),
                        (str_store_string, s21, "@Neutral"),
                    (try_end),
                    # (ge, ":defender_relation", 0),
                    # (lt, ":attacker_relation", 0),
                ],
            "Rush to the aid of the {s1}. ({s21})",
                [
                    (select_enemy, 1),
                    (assign, "$g_enemy_party", "$g_encountered_party_2"),
                    (assign, "$g_ally_party", "$g_encountered_party"),
                    ## WINDYPLAINS+ ## - Join any side - relation changes
                    (try_begin),
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (store_relation, ":relation", ":faction_no", "fac_player_supporters_faction"),
                        (ge, ":relation", -10),
                        #Improve relation with ally lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_ally_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_ally_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", 1),
                        (try_end),
                        #Reduce relation with enemy lords.
                        (party_get_num_companion_stacks, ":stack_count", "$g_enemy_party"),
                        (try_for_range, ":stack_no", 0, ":stack_count"),
                            (party_stack_get_troop_id, ":troop_no", "$g_enemy_party", ":stack_no"),
                            (troop_is_hero, ":troop_no"),
                            (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
                            (call_script, "script_change_player_relation_with_troop", ":troop_no", -1),
                        (try_end),
                        #Improve relation with ally faction.
                        (store_faction_of_party, ":faction_no", "$g_ally_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", 2),
                        #Reduce relation with enemy faction.
                        (store_faction_of_party, ":faction_no", "$g_enemy_party"),
                        (call_script, "script_change_player_relation_with_faction", ":faction_no", -2),
                    (try_end),
                    ## WINDYPLAINS- ##

                    #reset entrenchments status for this mission +Dj_FRedy
                    (try_begin),
                        (party_get_slot, ":party_entrenched", "p_main_party", slot_party_entrenched),
                        (this_or_next|eq, ":party_entrenched", 1), #entrenched camp
                        (party_slot_eq, "p_main_party", slot_party_siege_camp, 1), #entrenched siege camp

                        (party_set_slot, "p_main_party", slot_party_entrenched, 0),
                        (party_set_slot, "p_main_party", slot_party_siege_camp, 0),
                    (try_end),

                    (jump_to_menu, "mnu_join_battle"),
                ]
            ),

            ("pre_join_leave", [],
            "Don't get involved.",
                [
                    (leave_encounter),
                    (change_screen_return),
                ]
            ),
        ]
    ),
I think the #comments in the block are self-explanatory.
Thank you! That's exactly what I was looking for. Now I need to try to have the relationship change displayed in messages, menus etc. :smile:
 
点赞 0
后退
顶部 底部