SP Tutorial Module System Recruit your custom troops in your own Kingdom

Currently Viewing (Users: 0, Guests: 1)

Wulfe3127

Recruit
Best answers
0
Atamawood said:
LtpLegend said:
I don't use the module system so none of that helps me for now at least I guess I will go try and learn it again..

I also tried your menu text and it does not work. The option doesn't even appear.

EDIT: Ok im in the module system now and I made this

("Imperial",[],"Imperial.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_imperial_levy"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_imperial_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_imperial_levy_bowman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_imperial_soldier"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_imperial_calvary"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_7_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_7_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_7_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
one thing I see though is its asking for pt_kingdom at the bottom thats a party_template telling the npc how many of each troops to recruit. So now I guess I have to make one for these guys.

So in party_templates module I did this
("kingdom_7_reinforcements_a", "{!}kingdom_7_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_imperial_footman,2,6),(trp_imperial_levy,4,7),(trp_imperial_levy_bowman,2,5)] ),
("kingdom_7_reinforcements_b", "{!}kingdom_7_reinforcements_b", 0, 0, fac_commoners, 0, [(trp_imperial_soldier,2,6),(trp_imperial_soldier,4,7),(trp_imperial_archer,2,5)] ),
("kingdom_7_reinforcements_c", "{!}kingdom_7_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_imperial_calvary,3,:cool:,(trp_imperial_axeman,2,5),(trp_imperial_axeguard,2,3)] ),

sgould I change faction commoners to fac_player_supporters_faction ?

now I think I have to assign player supported to kingdom 7? or change kingdom 7 to player supports not sure

what does {!} mean?

my script code
#Rebellion changes end

#      (try_begin),
#        (eq, ":party_faction", "fac_player_supporters_faction"),
#        (party_get_slot, ":town_lord", ":party_no", slot_town_lord),
#      (try_begin),
        ##diplomacy begin
#          (is_between, "$g_player_culture", npc_kingdoms_begin, npc_kingdoms_end),
#          (assign, ":party_faction", "$g_player_culture"),
         
#          (try_begin), #debug
#            (eq, "$cheat_mode", 1),
#          (str_store_party_name, s11, ":party_no"),
#            (display_message, "@pt in {s11}"),
#          (try_end),
         
#        (else_try),
        ##diplomacy end
#          (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),

as you can see my diplomacy mod interjects I hope I don't get red lines for commenting it out. This feature let you choose what faction culture you wanted. I'm just changing it to the one you used then overriding what they recruit.
Well the reason you don't see it is because you have to create a menu that goes to that (sorry I didn't post that little bit!) Now since your using the Module system this shall be easier. I added this

("camp_action_change_troops",0,
  "Which faction?",
  "none",
  [],
    [
      ("Swadian",[],"Swadian.",
      [(faction_set_slot, "fac_player_supporters_faction",  slot_faction_tier_1_troop, "trp_swadian_recruit"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_tier_2_troop, "trp_swadian_militia"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_tier_3_troop, "trp_swadian_footman"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_tier_4_troop, "trp_swadian_infantry"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_tier_5_troop, "trp_swadian_knight"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_1_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_1_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_1_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("Vaegir",[],"Vaegir.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_vaegir_recruit"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_vaegir_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_vaegir_veteran"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_vaegir_infantry"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_vaegir_knight"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_2_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_2_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_2_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("Khergit",[],"Khergit.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_khergit_tribesman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_khergit_skirmisher"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_khergit_horseman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_khergit_horse_archer"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_khergit_veteran_horse_archer"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_3_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_3_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_3_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("Nord",[],"Nord.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_nord_recruit"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_nord_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_nord_trained_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_nord_warrior"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_nord_veteran"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_4_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_4_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_4_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("Rhodok",[],"Rhodok.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_rhodok_tribesman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_rhodok_spearman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_rhodok_trained_spearman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_rhodok_veteran_spearman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_rhodok_sergeant"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_5_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_5_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_5_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("Sarranid",[],"Sarranid.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_sarranid_recruit"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_sarranid_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_sarranid_archer"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_sarranid_horseman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_sarranid_mamluke"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_6_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_6_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_6_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),
        ]
      ),
     
      ("cancel",[],"Cancel.",
      [(jump_to_menu, "mnu_camp"),
        ]
      ),
      ]
  ),

To the bottom of game_menus along with this

("action_change_troops",[(eq, "$players_kingdom_name_set", 1),],"Change your kingdom's default troops.",
      [(jump_to_menu, "mnu_camp_action_change_troops"),
        ]
      ),

Which I acually added with the rest of the camp actions but you could add it anywhere.

Now assuming you have an unmodded version of the module system (which I'm sure you don't) you have to add these to module_scripts and I'm sure you can mess around with them a bit to get them to work with your modded stuff.

So under module_scripts go to the update_volunteer_troops_in_village and the update_npc_volunteer_troops_in_village scripts and replace:
(party_get_slot, ":center_culture", ":center_no", slot_center_culture),
with
(store_faction_of_party, ":center_culture", ":center_no"),

And the last little part I'll post again,

("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_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),

Just cut out that stuff in the red and your done! yay

Now for everyone just tuning in,
What this does is forces factions to recruit their own troops, it also changes the culture of troops you recruit based on what faction owns it. (Example: Swadians capture a Nordic town, you then recruit Swadians from the once Nordic villages.)
Also the big menu part comes ONLY into play when you make your become a King for your own country. What it does is add a menu to the camp actions which allows for you to set the "culture" you AND your vassals recruit, whether you want Nord troops or Sarranids, or perhaps Rhodoks one day and Vaegirs the next.

For you creating your own troop trees and what not, I'm sure there is a way to make one of these,

("Sarranid",[],"Sarranid.",
      [(faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_1_troop, "trp_sarranid_recruit"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_2_troop, "trp_sarranid_footman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_3_troop, "trp_sarranid_archer"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_4_troop, "trp_sarranid_horseman"),
      (faction_set_slot, "fac_player_supporters_faction", slot_faction_tier_5_troop, "trp_sarranid_mamluke"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_a, "pt_kingdom_6_reinforcements_a"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_b, "pt_kingdom_6_reinforcements_b"),
      (faction_set_slot, "fac_player_supporters_faction",  slot_faction_reinforcements_c, "pt_kingdom_6_reinforcements_c"),
      (jump_to_menu, "mnu_camp"),

For the troops you created and then have both you and your vassals recruit these men from the villages YOU own.

Note: These menus DO NOT appear if YOU are currently not a King of your own country.

So follow those steps and thats what they do, sorry the steps I've posted was never quite clear in the past. I hope this sums it up and it really is a great little tweak imo.


New: These codes are the same thing as the stuff above but only how they appear in the .txt files with the numbers. So this will help you all that don't use the module system which I still recommend you getting into if your going to do any modding.

So first of all locate "cf_reinforce_party -1" in scripts.txt and replace the entire line with

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

Then find "update_volunteer_troops_in_village -1" in scripts.txt and replace the entire line with

35 23 2 1224979098644774912 1 521 3 1224979098644774913 1224979098644774912 26 2204 2 1224979098644774914 1224979098644774912 522 3 1224979098644774915 1224979098644774914 41 2133 2 1224979098644774916 1 2123 3 1224979098644774917 1224979098644774913 10 6 3 1224979098644774918 0 1224979098644774917 2136 3 1224979098644774919 0 100 2147483678 2 1224979098644774919 10 2136 3 1224979098644774919 0 2 1561 3 1224979098644774920 1224979098644774915 1224979098644774919 4 0 2147483680 2 1224979098644774920 0 1561 3 1224979098644774920 1224979098644774915 0 3 0 32 2 1224979098644774920 0 2105 2 1224979098644774916 1 2133 2 1224979098644774915 1224979098644774920 3 0 2133 2 1224979098644774921 12 4 0 30 2 1224979098644774913 5 2133 2 1224979098644774921 1224979098644774913 2108 2 1224979098644774921 2 2105 2 1224979098644774921 10 5 0 2147483678 2 1224979098644774913 0 2133 2 1224979098644774921 0 3 0 2107 2 1224979098644774921 3 2120 3 1224979098644774922 2 1224979098644774916 2108 2 1224979098644774921 1224979098644774922 2136 3 1224979098644774923 0 1224979098644774921 501 3 1224979098644774912 92 1224979098644774915 501 3 1224979098644774912 93 1224979098644774923

Then right below that at "update_npc_volunteer_troops_in_village -1" replace the entire line with

23 23 2 1224979098644774912 1 2204 2 1224979098644774913 1224979098644774912 522 3 1224979098644774914 1224979098644774913 41 2133 2 1224979098644774915 1 6 3 1224979098644774916 0 5 2136 3 1224979098644774917 0 100 2147483678 2 1224979098644774917 10 2136 3 1224979098644774917 0 2 1561 3 1224979098644774918 1224979098644774914 1224979098644774917 4 0 2147483680 2 1224979098644774918 0 1561 3 1224979098644774918 1224979098644774914 0 3 0 32 2 1224979098644774918 0 2105 2 1224979098644774915 1 2133 2 1224979098644774914 1224979098644774918 3 0 2133 2 1224979098644774919 12 2120 3 1224979098644774920 2 1224979098644774915 2108 2 1224979098644774919 1224979098644774920 2136 3 1224979098644774921 0 1224979098644774919 501 3 1224979098644774912 90 1224979098644774914 501 3 1224979098644774912 91 1224979098644774921

Now exit scripts.txt and find menus.txt.

Here you need to add two things. You can add them at the bottom or perhaps with the other camp menu stuff or what ever you want to do.

Here is the camp_action, I added it with the other camp_actions

mno_action_change_troops  1 31 2 144115188075856605 1  Change_your_kingdom's_default_troops.  1 2060 1 864691128455135449  .

and the last part where it selects the faction

menu_camp_action_change_troops 0 Which_faction? none 0 7
mno_Swadian  0  Swadian.  9 502 3 432345564227567630 41 360287970189639715 502 3 432345564227567630 42 360287970189639716 502 3 432345564227567630 43 360287970189639717 502 3 432345564227567630 44 360287970189639718 502 3 432345564227567630 45 360287970189639724 502 3 432345564227567630 77 576460752303423524 502 3 432345564227567630 78 576460752303423525 502 3 432345564227567630 79 576460752303423526 2060 1 864691128455135255  .  mno_Vaegir  0  Vaegir.  9 502 3 432345564227567630 41 360287970189639729 502 3 432345564227567630 42 360287970189639730 502 3 432345564227567630 43 360287970189639734 502 3 432345564227567630 44 360287970189639735 502 3 432345564227567630 45 360287970189639738 502 3 432345564227567630 77 576460752303423527 502 3 432345564227567630 78 576460752303423528 502 3 432345564227567630 79 576460752303423529 2060 1 864691128455135255  .  mno_Khergit  0  Khergit.  9 502 3 432345564227567630 41 360287970189639743 502 3 432345564227567630 42 360287970189639744 502 3 432345564227567630 43 360287970189639745 502 3 432345564227567630 44 360287970189639746 502 3 432345564227567630 45 360287970189639747 502 3 432345564227567630 77 576460752303423530 502 3 432345564227567630 78 576460752303423531 502 3 432345564227567630 79 576460752303423532 2060 1 864691128455135255  .  mno_Nord  0  Nord.  9 502 3 432345564227567630 41 360287970189639753 502 3 432345564227567630 42 360287970189639754 502 3 432345564227567630 43 360287970189639755 502 3 432345564227567630 44 360287970189639756 502 3 432345564227567630 45 360287970189639757 502 3 432345564227567630 77 576460752303423533 502 3 432345564227567630 78 576460752303423534 502 3 432345564227567630 79 576460752303423535 2060 1 864691128455135255  .  mno_Rhodok  0  Rhodok.  9 502 3 432345564227567630 41 360287970189639766 502 3 432345564227567630 42 360287970189639767 502 3 432345564227567630 43 360287970189639768 502 3 432345564227567630 44 360287970189639769 502 3 432345564227567630 45 360287970189639770 502 3 432345564227567630 77 576460752303423536 502 3 432345564227567630 78 576460752303423537 502 3 432345564227567630 79 576460752303423538 2060 1 864691128455135255  .  mno_Sarranid  0  Sarranid.  9 502 3 432345564227567630 41 360287970189639779 502 3 432345564227567630 42 360287970189639780 502 3 432345564227567630 43 360287970189639785 502 3 432345564227567630 44 360287970189639787 502 3 432345564227567630 45 360287970189639788 502 3 432345564227567630 77 576460752303423539 502 3 432345564227567630 78 576460752303423540 502 3 432345564227567630 79 576460752303423541 2060 1 864691128455135255  .  mno_cancel  0  Cancel.  1 2060 1 864691128455135255  .
I have copypasted both of the 'camp_action' part that you have included at the bottom of your post here, but I keep getting 'unexpected end of file' error. Can you tell me how to fix this problem?