Adding Customized Heroes/Companions Into Town or Castle Garrison

Users who are viewing this thread

Wolfkhar

Recruit
I adding some new companions or heroes in the game but instead recruiting them via taverns, I planned to put them into chosen town or castle garrison so I can just take them from the garrison after I conquered the castle or town.

This is a script that I got from one of experience member here, the script is about adding troop party template into any towns/castles as well as refresh them at certain time

***So, I planned to use this script to "JUST ADDING THE CUZTOMIZED COMPANIONS/HEROES INTO THE TOWNS/CASTLES WITHOUT REFRESH THEM''. (I don't want my companions duplicates pop up)***

("refresh_mercenary_camp_troops",
[
(store_script_param_1, ":camp_no"),
(assign, ":ideal_size", 300), # Past this value the troop pool of the camp will be reset

(try_begin),
(eq, ":camp_no", "p_town_23"),
(assign, ":party_template", "pt_warriders"),
(try_end),

(party_get_num_companions, ":party_size", ":camp_no"),
(try_begin),
(gt, ":party_size", ":ideal_size"), # We're past the ideal number of troops in the camp
(party_clear,":camp_no"), # Reset the troop pool
(party_add_template, ":camp_no", ":party_template"),
(else_try),
(party_add_template, ":camp_no", ":party_template"),
(try_end),

]),

I really appreciate if someone can help me to modify the script or just share any required script
 
first of all, don't bother with ideal size and all that ****, save yourself the headache
you're adding just 1 troop, it won't change much

second of all, here you can do what operators do:
for your case it's chapter "Parties and party templates"

third of all, here's a code that adds trp_npc1 to p_town_23:
Python:
(try_begin),
    #it's in try-end block, because hero_can_join is a can-fail operation that would prevent execution of all code below it
    #but if we put it in try-end block, it will only cancel execution of code until the end of try-end block
    (hero_can_join,"p_town_23"), #first make sure if there is enough space in the party, for towns it shouldn't matter, but just in case
    (party_add_members,"p_town_23","trp_npc1",1), #add one Borcha to it
(try_end),

or even more simply, with just 1 line of code:
Python:
(party_force_add_members,"p_town_23","trp_npc1",1), #force add one Borcha, party capacity check will be skipped

To avoid "duplicates" (to make sure companions don't appear in taverns), just make sure to set their troop slot (slot_troop_cur_center) to -1.
For example with (troop_set_slot,"trp_npc1",slot_troop_cur_center,-1),
And also make sure this slot is never again set for them, because it does, periodically (repeating simple trigger), and also occasionally (for example if party with companion in it is defeated).

You will need to edit:
• script_party_remove_all_companions (puts companions of defeated party in random town)
• script_player_join_faction (puts companions in player's prisons in random towns)
script_update_companion_candidates_in_taverns (this is the main script that puts companions in taverns)
Find where in those scripts slot_troop_cur_center is being set with troop_set_slot and comment that out.
 
Last edited:
Hello. Thank you for your help that I managed to put my hero into a town and I can take/put back whenever I want. Currently, I still trying to figure out to avoid the duplicate because the town keep on reproduced the hero just like every town regenerate their army.

Actually, the hero is a custom one not from the original companions and I managed to put him in a town with the script that you shared

("assign_heroes",
[

(try_begin),
(hero_can_join,"p_town_23"),
(party_add_members,"p_town_23","trp_odelbert",1),
(try_end),


]),
first of all, don't bother with ideal size and all that ****, save yourself the headache
you're adding just 1 troop, it won't change much

second of all, here you can do what operators do:
for your case it's chapter "Parties and party templates"

third of all, here's a code that adds trp_npc1 to p_town_23:
Python:
(try_begin),
    #it's in try-end block, because hero_can_join is a can-fail operation that would prevent execution of all code below it
    #but if we put it in try-end block, it will only cancel execution of code until the end of try-end block
    (hero_can_join,"p_town_23"), #first make sure if there is enough space in the party, for towns it shouldn't matter, but just in case
    (party_add_members,"p_town_23","trp_npc1",1), #add one Borcha to it
(try_end),

or even more simply, with just 1 line of code:
Python:
(party_force_add_members,"p_town_23","trp_npc1",1), #force add one Borcha, party capacity check will be skipped

To avoid "duplicates" (to make sure companions don't appear in taverns), just make sure to set their troop slot (slot_troop_cur_center) to -1.
For example with (troop_set_slot,"trp_npc1",slot_troop_cur_center,-1),
And also make sure this slot is never again set for them, because it does, periodically (repeating simple trigger), and also occasionally (for example if party with companion in it is defeated).

You will need to edit:
• script_party_remove_all_companions (puts companions of defeated party in random town)
• script_player_join_faction (puts companions in player's prisons in random towns)
script_update_companion_candidates_in_taverns (this is the main script that puts companions in taverns)
Find where in those scripts slot_troop_cur_center is being set with troop_set_slot and comment that out.
 
Last edited:
Back
Top Bottom