Yes. It can be done easily. But I suggest not to use any conventional recruit-able troops if you want they will be removed from garrison after the siege withe less effort.
Let me give example :
Let me give example :
make some troops on your module_troops.py :
Define constants at your module_constants :
Now, the spawning part become :
And the cleansing become :
Code:
["angry_town_man1", BLA BLA BLA],
["angry_town_man2", BLA BLA BLA],
["angry_town_man3", BLA BLA BLA],
["angry_town_man4", BLA BLA BLA],
["angry_town_man5", BLA BLA BLA],
["angry_town_man6", BLA BLA BLA],
["militia1", BLA BLA BLA],
["militia2", BLA BLA BLA],
["militia3", BLA BLA BLA],
["militia4", BLA BLA BLA],
["militia5", BLA BLA BLA],
["militia6", BLA BLA BLA],
["angry_man_end", BLA BLA BLA -DUMMY TROOPS ONLY],
Define constants at your module_constants :
Code:
angry_man_begin = "trp_angry_town_man1"
angry_man_end = "trp_angry_man_end"
Now, the spawning part become :
Code:
#angry_town_man_begin
(try_begin),
#
# Give extra condition, like your relation to town. Make towns with high relation with you never spawn angry town men
#
(store_faction_of_party, ":faction", "$g_encountered_party"),
(try_begin), # just use party_force_add_members for any troops above, customize the number as you wish
(eq, ":faction", "fac_kingdom_1"),
(party_force_add_members,"$g_encountered_party","trp_angry_town_man1",10),
(party_force_add_members,"$g_encountered_party","trp_militia1",5),
(else_try),
(eq, ":faction", "fac_kingdom_2"),
(party_force_add_members,"$g_encountered_party","trp_angry_town_man2",5),
(else_try),
(eq, ":faction", "fac_kingdom_3"),
<CONTINUE FOR ALL FACTIONS>
(try_end),
(try_end),
#angry_town_man_end
And the cleansing become :
Code:
(0,
[#angry_town_man_begin // Clearing the angry men from town garrison
(map_free),
(try_begin),
(gt, "$g_angry_town_man_party", 0),
(try_for_range, ":troop_id", angry_man_begin, angry_man_end),
(party_count_members_of_type,":num","$g_angry_town_man_party",":troop_id"),
(try_begin),
(gt, ":num", 0),
(party_remove_members,"$g_angry_town_man_party",":troop_id",":num"),
(try_end),
(try_end),
(assign, "$g_angry_town_man_party", -1),
(try_end),
#angry_town_man_end
]),