Lords recruit their current faction`s troops.

Users who are viewing this thread

koban

Recruit
I have not found it anywhere, so here it is.
The idea was to force the lords to recruit their current faction`s troop. For example: if Tonju Noyan belongs to the Kingdom of Nords, he recruits nord troops (nord recruit, nord footman, nord veteran archer, huscarl, etc). And if you fight against the Kingdom of Nords, most of enemy troops will be nord infantry, not khergit horse archers, lancers, etc.

Most part of npc recruiting system is coded into game engine. The only possible way is to change parameter "slot_troop_original_faction". To make this happiness happened, open "module_scripts.py" file, find the "change_troop_faction" script and put this line there:
(troop_set_slot, ":troop_no", slot_troop_original_faction, ":faction_no"),
# script_change_troop_faction
  # Input: arg1 = troop_no, arg2 = faction
  ("change_troop_faction",
    [
      (store_script_param_1, ":troop_no"),
      (store_script_param_2, ":faction_no"),
      (try_begin),
        #Reactivating inactive or defeated faction
        (is_between, ":faction_no", kingdoms_begin, kingdoms_end),
        (neg|faction_slot_eq, ":faction_no", slot_faction_state, sfs_active),
        (faction_set_slot, ":faction_no", slot_faction_state, sfs_active),
        #(call_script, "script_store_average_center_value_per_faction"),
      (try_end),

  #Political ramifications
  (store_faction_of_troop, ":eek:rig_faction", ":troop_no"),
 
  #remove if he is marshal
  (try_begin),
(faction_slot_eq, ":eek:rig_faction", slot_faction_marshall, ":troop_no"),
        (call_script, "script_check_and_finish_active_army_quests_for_faction", ":eek:rig_faction"),     

#No current issue on the agenda
(try_begin),
(faction_slot_eq, ":eek:rig_faction", slot_faction_political_issue, 0),

(faction_set_slot, ":eek:rig_faction", slot_faction_political_issue, 1), #Appointment of marshal
(store_current_hours, ":hours"),
(val_max, ":hours", 0),
(faction_set_slot, ":eek:rig_faction", slot_faction_political_issue_time, ":hours"), #Appointment of marshal
(try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
(store_faction_of_troop, ":active_npc_faction", ":active_npc"),
(eq, ":active_npc_faction", ":eek:rig_faction"),
(troop_set_slot, ":active_npc", slot_troop_stance_on_faction_issue, -1),
(try_end),
(try_begin),
(eq, "$players_kingdom", ":eek:rig_faction"),
(troop_set_slot, "trp_player", slot_troop_stance_on_faction_issue, -1),
(try_end),
(try_end),

        (try_begin),
  (troop_get_slot, ":eek:ld_marshall_party", ":troop_no", slot_troop_leaded_party),
          (party_is_active, ":eek:ld_marshall_party"),
          (party_set_marshall, ":eek:ld_marshall_party", 0),
        (try_end), 

(faction_set_slot, ":eek:rig_faction", slot_faction_marshall, -1),
  (try_end),
  #Removal as marshal ends
 
  #Other political ramifications
  (troop_set_slot, ":troop_no", slot_troop_stance_on_faction_issue, -1),
  (try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
(troop_slot_eq, ":active_npc", slot_troop_stance_on_faction_issue, ":troop_no"),
(troop_set_slot, ":active_npc", slot_troop_stance_on_faction_issue, -1),
  (try_end),
  #Political ramifications end
 
 
(try_begin),
(ge, "$cheat_mode", 1),
(str_store_troop_name, s4, ":troop_no"),
(display_message, "@{!}DEBUG - {s4} faction changed in normal faction change"),
(try_end),
 
      (troop_set_faction, ":troop_no", ":faction_no"),
      (troop_set_slot, ":troop_no", slot_troop_recruitment_random, 0),
      (troop_set_slot, ":troop_no", slot_lord_recruitment_argument, 0),
      (troop_set_slot, ":troop_no", slot_lord_recruitment_candidate, 0),
      (troop_set_slot, ":troop_no", slot_troop_promised_fief, 0),

#nplus start ...............................................................................
    (troop_set_slot, ":troop_no", slot_troop_original_faction, ":faction_no"),    
#nplus end  ...............................................................................
     
      #Give new title
      (call_script, "script_troop_set_title_according_to_faction", ":troop_no", ":faction_no"),
     
      (try_begin),
        (this_or_next|eq, ":faction_no", "$players_kingdom"),
        (eq, ":faction_no", "fac_player_supporters_faction"),
        (call_script, "script_check_concilio_calradi_achievement"),
      (try_end),

  #Takes walled centers and dependent villages with him
      (try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
        (party_slot_eq, ":center_no", slot_town_lord, ":troop_no"),
        (party_set_faction, ":center_no", ":faction_no"),
        (try_for_range, ":village_no", villages_begin, villages_end),
          (party_slot_eq, ":village_no", slot_village_bound_center, ":center_no"),
          (party_set_faction, ":village_no", ":faction_no"),
          (party_get_slot, ":farmer_party_no", ":village_no", slot_village_farmer_party),
          (try_begin),
            (gt, ":farmer_party_no", 0),
            (party_is_active, ":farmer_party_no"),
            (party_set_faction, ":farmer_party_no", ":faction_no"),
          (try_end),
          (try_begin),
            (party_get_slot, ":eek:ld_town_lord", ":village_no", slot_town_lord),
            (neq, ":eek:ld_town_lord", ":troop_no"),
            (party_set_slot, ":village_no", slot_town_lord, stl_unassigned),
          (try_end),
        (try_end),
      (try_end),
 
  #Dependant kingdom ladies switch faction
  (try_for_range, ":kingdom_lady", kingdom_ladies_begin, kingdom_ladies_end),
(call_script, "script_get_kingdom_lady_social_determinants", ":kingdom_lady"),
(assign, ":closest_male_relative", reg0),
(assign, ":new_center", reg1),

(eq, ":closest_male_relative", ":troop_no"),

(try_begin),
(ge, "$cheat_mode", 1),
(str_store_troop_name, s4, ":kingdom_lady"),
(display_message, "@{!}DEBUG - {s4} faction changed by guardian moving"),
(try_end),

(troop_set_faction, ":kingdom_lady", ":faction_no"),
(troop_slot_eq, ":kingdom_lady", slot_troop_prisoner_of_party, -1),
(troop_set_slot, ":kingdom_lady", slot_troop_cur_center, ":new_center"),
  (try_end),
 
  #Remove his control over villages under another fortress
      (try_for_range, ":village_no", villages_begin, villages_end),
        (party_slot_eq, ":village_no", slot_town_lord, ":troop_no"),
        (store_faction_of_party, ":village_faction", ":village_no"),
        (try_begin),
          (neq, ":village_faction", ":faction_no"),
          (party_set_slot, ":village_no", slot_town_lord, stl_unassigned),
        (try_end),
      (try_end),
 
  #Free prisoners
      (try_begin),
        (troop_get_slot, ":leaded_party", ":troop_no", slot_troop_leaded_party),
        (gt, ":leaded_party", 0),
        (party_set_faction, ":leaded_party", ":faction_no"),
        (party_get_num_prisoner_stacks, ":num_stacks", ":leaded_party"),
        (try_for_range_backwards, ":troop_iterator", 0, ":num_stacks"),
          (party_prisoner_stack_get_troop_id, ":cur_troop_id", ":leaded_party", ":troop_iterator"),
          (store_troop_faction, ":cur_faction", ":cur_troop_id"),
          (troop_is_hero, ":cur_troop_id"),
          (eq, ":cur_faction", ":faction_no"),
          (call_script, "script_remove_troop_from_prison", ":cur_troop_id"),
          (party_remove_prisoners, ":leaded_party", ":cur_troop_id", 1),
        (try_end),
      (try_end),
 
  #Annull all quests of which the lord is giver
  (try_for_range, ":quest", all_quests_begin, all_quests_end),
(check_quest_active, ":quest"),
(quest_slot_eq, ":quest", slot_quest_giver_troop, ":troop_no"),

(str_store_troop_name, s4, ":troop_no"),
(try_begin),
  (eq, "$cheat_mode", 1),
    (display_message, "str_s4_changing_sides_aborts_quest"),
        (try_end),
(call_script, "script_abort_quest", ":quest", 0),
  (try_end),
 
  #Boot all lords out of centers whose faction has changed
  (try_for_range, ":lord_to_move", active_npcs_begin, active_npcs_end),
(troop_get_slot, ":lord_led_party", ":lord_to_move", slot_troop_leaded_party),
    (party_is_active, ":lord_led_party"),
(party_get_attached_to, ":led_party_attached", ":lord_led_party"),
(is_between, ":led_party_attached", walled_centers_begin, walled_centers_end),
(store_faction_of_party, ":led_party_faction", ":lord_led_party"),
(store_faction_of_party, ":attached_party_faction", ":led_party_attached"),
(neq, ":led_party_faction", ":attached_party_faction"),

(party_detach, ":lord_led_party"),
  (try_end),
 
  #Increase relation with lord in new faction by 5
  #Or, if player kingdom, make inactive pending confirmation
  (faction_get_slot, ":faction_liege", ":faction_no", slot_faction_leader),
  (try_begin),
(eq, ":faction_liege", "trp_player"),
(neq, ":troop_no", "$g_talk_troop"),
    (troop_set_slot, ":troop_no", slot_troop_occupation, slto_inactive), #POSSIBLE REASON 1
  (else_try),
(is_between, ":faction_liege", active_npcs_begin, active_npcs_end),
(is_between, ":troop_no", active_npcs_begin, active_npcs_end),
(call_script, "script_troop_change_relation_with_troop", ":faction_liege", ":troop_no", 5),
(val_add, "$total_indictment_changes", 5),
  (try_end),
 
  #Break courtship relations
  (try_begin),
  (troop_slot_ge, ":troop_no", slot_troop_spouse, 0),
#Already married, do nothing
  (else_try),
(is_between, ":troop_no", active_npcs_begin, active_npcs_end),
    (try_for_range, ":love_interest_slot", slot_troop_love_interest_1, slot_troop_love_interests_end),
(troop_get_slot, ":courted_lady", ":troop_no", ":love_interest_slot"),
(call_script, "script_courtship_event_lady_break_relation_with_suitor", ":courted_lady", ":troop_no"),
    (try_end),
(call_script, "script_assign_troop_love_interests", ":troop_no"),
  (else_try),
(is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end),
(try_for_range, ":active_npc", active_npcs_begin, active_npcs_end),
(try_for_range, ":love_interest_slot", slot_troop_love_interest_1, slot_troop_love_interests_end),
(troop_slot_eq, ":active_npc", ":love_interest_slot", ":troop_no"),
(call_script, "script_courtship_event_lady_break_relation_with_suitor", ":troop_no", ":active_npc"),
(try_end),
(try_end),
  (try_end),
 
  #Stop raidings/sieges of new faction's fief if there is any
  (troop_get_slot, ":troop_party", ":troop_no", slot_troop_leaded_party),
  (try_for_range, ":center_no", centers_begin, centers_end),
    (party_slot_eq, ":center_no", slot_party_type, spt_village),
    (party_get_slot, ":raided_by", ":center_no", slot_village_raided_by),    
    (eq, ":raided_by", ":troop_party"),
    (party_set_slot, ":center_no", slot_village_raided_by, -1),
    (try_begin),
      (party_slot_eq, ":center_no", slot_village_state, svs_being_raided),      
      (party_set_slot, ":center_no", slot_village_state, svs_normal),
      (party_set_extra_text, ":center_no", "str_empty_string"),
    (try_end),
  (else_try),     
    (party_get_slot, ":besieged_by", ":center_no", slot_center_is_besieged_by),
    (eq, ":besieged_by", ":troop_party"),
    (party_set_slot, ":center_no", slot_center_is_besieged_by, -1),
    (try_begin),    
      (party_slot_eq, ":center_no", slot_village_state, svs_under_siege),      
      (party_set_slot, ":center_no", slot_village_state, svs_normal),
      (party_set_extra_text, ":center_no", "str_empty_string"),
    (try_end),
  (try_end),
   
      (call_script, "script_update_all_notes"),

      (call_script, "script_update_village_market_towns"),
      (assign, "$g_recalculate_ais", 1),
      ]),
The culture of new faction is also the culture of lord now. And faction`s troops are the lord`s potential recruits.
This part works for any faction changes: treason, defection, etc. To check the changes, wait for 36 game hours and watch for latest lords defections. Then use cheat jump (hold ctrl and press left click on map) for teleportation to the lord. He should be recruiting troops of his new faction.

If you want to play old savegame and want to switch every lord`s culture to his current faction`s one, you could create new action in camp menu or put same trigger in an existing one. For example, edit the "module_scripts.py" file and let the cheat menu script "update_troop_political_notes" updates all lords cultures in a moment:
("update_troop_political_notes",
      [
(store_script_param, ":troop_no", 1),
(try_begin),
    (str_clear, s47),

(store_faction_of_troop, ":troop_faction", ":troop_no"),

    (faction_get_slot, ":faction_leader", ":troop_faction", slot_faction_leader),

    (str_clear, s40),
    (assign, ":logged_a_rivalry", 0),
    (try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
(call_script, "script_troop_get_relation_with_troop", ":troop_no", ":kingdom_hero"),
(lt, reg0, -10),

  (str_store_troop_name_link, s39, ":kingdom_hero"),
(try_begin),
(eq, ":logged_a_rivalry", 0),
(str_store_string, s40, "str_s39_rival"),
(assign, ":logged_a_rivalry", 1),
(else_try),
(str_store_string, s41, "str_s40"),
(str_store_string, s40, "str_s41_s39_rival"),
(try_end),
#nplus start .................................
(try_begin),
(eq, "$cheat_mode", 1),  #not necessary in this cheat script
                                        (try_begin),
                                            (troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_kingdom_hero),
                                            (store_faction_of_troop, ":troop_faction", ":kingdom_hero"),
                                            (troop_set_slot, ":kingdom_hero", slot_troop_original_faction, ":troop_faction"),
                                        (try_end),
(try_end),

#nplus end  ..................................
 
    (try_end),

    (str_clear, s46),
    (try_begin),
(ge, "$cheat_mode", 1),
(try_begin),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_martial),
(str_store_string, s46, "str_reputation_cheat_mode_only_martial_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_debauched),
(str_store_string, s46, "str_reputation_cheat_mode_only_debauched_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_selfrighteous),
(str_store_string, s46, "str_reputation_cheat_mode_only_pitiless_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_cunning),
(str_store_string, s46, "str_reputation_cheat_mode_only_calculating_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_quarrelsome),
(str_store_string, s46, "str_reputation_cheat_mode_only_quarrelsome_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_goodnatured),
(str_store_string, s46, "str_reputation_cheat_mode_only_goodnatured_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_upstanding),
(str_store_string, s46, "str_reputation_cheat_mode_only_upstanding_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_conventional),
(str_store_string, s46, "str_reputation_cheat_mode_only_conventional_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_adventurous),
(str_store_string, s46, "str_reputation_cheat_mode_only_adventurous_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_otherworldly),
(str_store_string, s46, "str_reputation_cheat_mode_only_romantic_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_moralist),
(str_store_string, s46, "str_reputation_cheat_mode_only_moralist_"),
(else_try),
(troop_slot_eq, ":troop_no", slot_lord_reputation_type, lrep_ambitious),
(str_store_string, s46, "str_reputation_cheat_mode_only_ambitious_"),
(else_try),
(troop_get_slot, reg11, ":troop_no", slot_lord_reputation_type),
(str_store_string, s46, "str_reputation_cheat_mode_only_reg11_"),
(try_end),

(try_begin),
(eq, "$cheat_mode", 1),
(try_for_range, ":love_interest_slot", slot_troop_love_interest_1, slot_troop_love_interests_end),
(troop_get_slot, ":love_interest", ":troop_no", ":love_interest_slot"),
(is_between, ":love_interest", kingdom_ladies_begin, kingdom_ladies_end),
(str_store_troop_name_link, s39, ":love_interest"),
(call_script, "script_troop_get_relation_with_troop", ":troop_no", ":love_interest"),
(str_store_string, s2, "str_love_interest"),
(try_begin),
(troop_slot_eq, ":troop_no", slot_troop_betrothed, ":love_interest"),
(str_store_string, s2, "str_betrothed"),
(try_end),
(str_store_string, s40, "str_s40_s39_s2_reg0"),
(try_end),
(try_end),

    (try_end),

    (str_store_string, s45, "str_other_relations_s40_"),

    (str_clear, s44),
    (try_begin),
(neq, ":troop_no", ":faction_leader"),
(call_script, "script_troop_get_relation_with_troop", ":troop_no", ":faction_leader"),
(str_store_string, s44, "str_relation_with_liege_reg0_"),
    (try_end),

(str_clear, s4:cool:,

    (try_begin),
(eq, "$cheat_mode", 1),
(store_current_hours, ":hours"),
(gt, ":hours", 0),
# (display_message, "@{!}Updating political factors"),
(call_script, "script_calculate_troop_political_factors_for_liege", ":troop_no", ":faction_leader"),
(str_store_string, s48, "str_sense_of_security_military_reg1_court_position_reg3_"),
(try_end),
(str_store_string, s47, "str_s46s45s44s48"),

(add_troop_note_from_sreg, ":troop_no", 3, "str_political_details_s47_", 1),

(try_end),
    ]),
Start game with cheats on, load your save, call console (Ctrl + `), type there cheatmenu and press enter.
Go for camping somewhere. Look at camp cheats in camp menus, there should be "Update political notes.". Click on it and wait for few seconds. Take a little move on a map to be sure.
Call the console again (Ctrl + `), type there nocheatmenu and press enter again. New scripts should be working after 36 game hours. Now you could save the game.
 
Literally nothing about recruitment is hardcoded.
Don't throw the baby out with the bathwater.
If you want a lord to recruit different soldiers, edit cf_reinforce_party script, don't change lord's original faction which is also used by other scripts.
 
Leonion said:
If you want a lord to recruit different soldiers, edit cf_reinforce_party script, don't change lord's original faction which is also used by other scripts.
Something like this?
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"), #would be used by default?#
      (party_get_slot, ":party_type",":party_no", slot_party_type),
#Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
#if i just remove this?# #(troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      (try_end),
#Rebellion changes end

      (try_begin),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
          (gt, ":town_lord", 0),
        (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction), 
        (else_try),
        (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),

      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
 
Leonion
I`ve checked it, just removed all other assignments for ":party_faction" in "cf_reinforce_party":
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"), #party`s faction is the only culture assignment we need here#
      (party_get_slot, ":party_type",":party_no", slot_party_type),
#Rebellion changes begin:
#      (try_begin),
#      (eq, ":party_type", spt_kingdom_hero_party),
#        (party_stack_get_troop_id, ":leader", ":party_no"),
#        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
#    (try_end),
#Rebellion changes end

#      (try_begin),
#      (eq, ":party_faction", "fac_player_supporters_faction"),
#        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
#        (try_begin),
#          (gt, ":town_lord", 0),
#        (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction), 
#        (else_try),
#        (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
#        (try_end),
#      (try_end),

#party`s faction ----> recruiting troop`s culture#

      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
It seems to be working fine, thank you!
When player creates his own kingdom "fac_player_supporters_faction" seems to be assigned to "fac_culture_1" (swadian) by default, but it can be easely changed by adding menu with culture choice.
 
Hello, as I am a Python noob ...

Can someone post the code file for this tweak (changing lord troop recruitement to be based on current faction)? Is it in Scripts.txt? Many (many, many :fruity:) thanks!
 
Brabantione
I`m also noob in module system, but let`s try this.

For the lords of other kingdoms only (your kingdom`s lords will use their original faction`s troops):
Code:
cf_reinforce_party -1
 44 21 1 1224979098644774912 2204 2 1224979098644774913 1224979098644774912 521 3 1224979098644774914 1224979098644774912 0 4 0 31 2 1224979098644774913 432345564227567630 521 3 1224979098644774915 1224979098644774912 7 4 0 32 2 1224979098644774915 0 520 3 1224979098644774913 1224979098644774915 14 5 0 521 3 1224979098644774913 1224979098644774912 61 3 0 3 0 522 3 1224979098644774916 1224979098644774913 77 522 3 1224979098644774917 1224979098644774913 78 522 3 1224979098644774918 1224979098644774913 79 2133 2 1224979098644774919 0 2136 3 1224979098644774920 0 100 4 0 1073741855 2 1224979098644774914 3 31 2 1224979098644774914 2 4 0 2147483678 2 1224979098644774920 65 2133 2 1224979098644774919 1224979098644774916 5 0 2133 2 1224979098644774919 1224979098644774917 3 0 5 0 31 2 1224979098644774914 13 4 0 2147483678 2 1224979098644774920 50 2133 2 1224979098644774919 1224979098644774916 5 0 2147483678 2 1224979098644774920 75 2133 2 1224979098644774919 1224979098644774917 5 0 2133 2 1224979098644774919 1224979098644774918 3 0 5 0 3 0 4 0 32 2 1224979098644774919 0 1675 2 1224979098644774912 1224979098644774919 3 0 
hire_men_to_kingdom_hero_party -1

For all lords (your kingdom`s lords will use "fac_player_supporters_faction"`s culture, swadian by default):
Code:
cf_reinforce_party -1
 34 21 1 1224979098644774912 2204 2 1224979098644774913 1224979098644774912 521 3 1224979098644774914 1224979098644774912 0 522 3 1224979098644774915 1224979098644774913 77 522 3 1224979098644774916 1224979098644774913 78 522 3 1224979098644774917 1224979098644774913 79 2133 2 1224979098644774918 0 2136 3 1224979098644774919 0 100 4 0 1073741855 2 1224979098644774914 3 31 2 1224979098644774914 2 4 0 2147483678 2 1224979098644774919 65 2133 2 1224979098644774918 1224979098644774915 5 0 2133 2 1224979098644774918 1224979098644774916 3 0 5 0 31 2 1224979098644774914 13 4 0 2147483678 2 1224979098644774919 50 2133 2 1224979098644774918 1224979098644774915 5 0 2147483678 2 1224979098644774919 75 2133 2 1224979098644774918 1224979098644774916 5 0 2133 2 1224979098644774918 1224979098644774917 3 0 5 0 3 0 4 0 32 2 1224979098644774918 0 1675 2 1224979098644774912 1224979098644774918 3 0 
hire_men_to_kingdom_hero_party -1
 
koban said:
Leonion
I`ve checked it, just removed all other assignments for ":party_faction" in "cf_reinforce_party":
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"), #party`s faction is the only culture assignment we need here#
      (party_get_slot, ":party_type",":party_no", slot_party_type),
#Rebellion changes begin:
#      (try_begin),
#      (eq, ":party_type", spt_kingdom_hero_party),
#        (party_stack_get_troop_id, ":leader", ":party_no"),
#        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
#    (try_end),
#Rebellion changes end

#      (try_begin),
#      (eq, ":party_faction", "fac_player_supporters_faction"),
#        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
#        (try_begin),
#          (gt, ":town_lord", 0),
#        (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction), 
#        (else_try),
#        (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
#        (try_end),
#      (try_end),

#party`s faction ----> recruiting troop`s culture#

      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
It seems to be working fine, thank you!
When player creates his own kingdom "fac_player_supporters_faction" seems to be assigned to "fac_culture_1" (swadian) by default, but it can be easely changed by adding menu with culture choice.

That seems to not be working on Viking Conquest, once I form a player faction the lords who defect to me end up with no troops at all and a script error pops up when I talk to them. I will try the solution in your first post, what was the reason you changed from using that?

Edit: Your first solution works for established factions, but don't bother starting your own faction. No one starts recruiting your units and I got this on a lord as well.

"SCRIPT ERROR ON OPCODE 1694: Invalid Party ID: -1; LINE NO: 7:
At dialog condition: dlga_lord_talk:lord_request_help. At dialog condition: dlga_lord_talk:lord_request_help. SCRIPT ERROR ON OPCODE 1694: Invalid Party ID: -1; LINE NO: 7:
At dialog condition: dlga_lord_talk:lord_request_help. At dialog condition: dlga_lord_talk:lord_request_help. SCRIPT ERROR ON OPCODE 1694: Invalid Party ID: -1; LINE NO: 7:
At dialog condition: dlga_lord_talk:lord_request_help. At dialog condition: dlga_lord_talk:lord_request_help. SCRIPT ERROR ON OPCODE 1694: Invalid Party ID: -1; LINE NO: 7:
At dialog condition: dlga_lord_talk:lord_request_help. At dialog condition: dlga_lord_talk:lord_request_help. SCRIPT ERROR ON OPCODE 1694: Invalid Party ID: -1; LINE NO: 7:
At dialog condition: dlga_lord_talk:lord_request_help. At dialog condition: dlga_lord_talk:lord_request_help."
 
koban said:
Leonion
I`ve checked it, just removed all other assignments for ":party_faction" in "cf_reinforce_party":
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"), #party`s faction is the only culture assignment we need here#
      (party_get_slot, ":party_type",":party_no", slot_party_type),
#Rebellion changes begin:
#      (try_begin),
#      (eq, ":party_type", spt_kingdom_hero_party),
#        (party_stack_get_troop_id, ":leader", ":party_no"),
#        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
#    (try_end),
#Rebellion changes end

#      (try_begin),
#      (eq, ":party_faction", "fac_player_supporters_faction"),
#        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
#        (try_begin),
#          (gt, ":town_lord", 0),
#        (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction), 
#        (else_try),
#        (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
#        (try_end),
#      (try_end),

#party`s faction ----> recruiting troop`s culture#

      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),
It seems to be working fine, thank you!
When player creates his own kingdom "fac_player_supporters_faction" seems to be assigned to "fac_culture_1" (swadian) by default, but it can be easely changed by adding menu with culture choice.

It seems for VC that the problem always arise when trying to start one's own faction, even though you're supposed to have already picked your culture when you pick your background in character creation. I guess getting a second pop up upon creating a faction might help. I've tried searching for it, but couldn't find anything on how to "easily" add a menu with culture choice.


EDIT: I tried removing just the lines not related to fac_player_supporters_faction.

  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),
     
      (store_faction_of_party, ":party_faction", ":party_no"),
      (party_get_slot, ":party_type",":party_no", slot_party_type),
     
      #Rebellion changes begin:
      #(try_begin),
        #(eq, ":party_type", spt_kingdom_hero_party),
        #(party_stack_get_troop_id, ":leader", ":party_no"),
        #(troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
      #(try_end),

      #Rebellion changes end
     
      (try_begin),
        (eq, ":party_no", "p_main_party"),
        (try_begin),
          (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
          (assign, ":party_faction", "$players_kingdom"),
        (else_try),
          (assign, ":party_faction", "fac_player_supporters_faction"),
        (try_end),
       
      (else_try),
        (eq, ":party_faction", "fac_player_supporters_faction"),
        (is_between, ":party_no", walled_centers_begin, walled_centers_end),
        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
        (try_begin),
          (gt, ":town_lord", 0),
          (troop_get_slot, ":party_faction", ":town_lord", slot_troop_original_faction),
        (else_try),
          (party_get_slot, ":party_faction", ":party_no", slot_center_original_faction),
        (try_end),
      (try_end),
     
      (faction_get_slot, ":party_template_a", ":party_faction", slot_faction_reinforcements_a),
      (faction_get_slot, ":party_template_b", ":party_faction", slot_faction_reinforcements_b),
      (faction_get_slot, ":party_template_c", ":party_faction", slot_faction_reinforcements_c),

Didn't see any script error on opcode this time but it appeared in rgl_log;
SCRIPT ERROR ON OPCODE 2330: Invalid Party ID: -1; LINE NO: 6:
At dialog consequence: dlga_lord_tell_objective:lord_pretalk.2. At dialog consequence: dlga_lord_tell_objective:lord_pretalk.2.

Also, my companion lords ended up having 0 troops. Once again, this worked on other factions, defected lords started getting reinforcements from current faction instead of original faction. It's pretty useless though if it leaves player faction lords without troops. Hoping someone has a solution for this.
 
Back
Top Bottom