DMcain
Veteran
Ok, here goes. I've added a castle/town improvement called 'Troop Barracks'. I've already figured out and made the changes to the module_game_menus.py, module_scripts.py and module_constants.py. I want the new trigger to do 2 things, once per week.
1) Train my garrison - weekly xp gain.
2) Recruit troops
Now, while playing I've noticed some REALLY large NPC garrisons (600+ in Curaw last time I visited with no lords present). I've found the 2 triggers that deal with these for the AI lords, but I have no clue on how to put in a check to see if the center is player owned AND has troop barracks. So, instead of putting in checks, I've decided to go with a new weekly trigger.
Here's the code for the AI garrison. I don't want mine to trigger every day, just weekly.
And here's the bit for training the AI garrisons. This one is buried in another trigger so was kinda tricky to find.
My goal is to make a new trigger, combining these 2.
1 - Check to see if center is player owned
2 - Check to see if center has troop barracks (slot_center_has_barracks)
3 - Give some xp to current garrison. I don't really care how they progress through the troop trees, but train the current garrison before we hire new guys.
4 - Hire more troops
So, I have no real knowledge of coding for M&B. I can do simple changes. But when it comes to something like this, I'm at a loss on how to accomplish it. So if any one would like to put this together for me, I would appreciate it.
1) Train my garrison - weekly xp gain.
2) Recruit troops
Now, while playing I've noticed some REALLY large NPC garrisons (600+ in Curaw last time I visited with no lords present). I've found the 2 triggers that deal with these for the AI lords, but I have no clue on how to put in a check to see if the center is player owned AND has troop barracks. So, instead of putting in checks, I've decided to go with a new weekly trigger.
Here's the code for the AI garrison. I don't want mine to trigger every day, just weekly.
Code:
#Hiring men with center wealths (once a day)
(24,
[
(try_for_range, ":troop_no", kingdom_heroes_begin, kingdom_heroes_end),
(troop_get_slot, ":party_no", ":troop_no", slot_troop_leaded_party),
(ge, ":party_no", 1),
(party_get_attached_to, ":cur_attached_party", ":party_no"),
(is_between, ":cur_attached_party", centers_begin, centers_end),
(party_slot_eq, ":cur_attached_party", slot_center_is_besieged_by, -1), #center not under siege
(call_script, "script_hire_men_to_kingdom_hero_party", ":troop_no"), #Hiring men with current wealth
(try_end),
(try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
(neg|party_slot_eq, ":center_no", slot_town_lord, "trp_player"), #center does not belong to player.
(party_slot_ge, ":center_no", slot_town_lord, 1), #center belongs to someone.
(party_get_slot, ":cur_wealth", ":center_no", slot_town_wealth),
(party_slot_eq, ":center_no", slot_center_is_besieged_by, -1), #center not under siege
(assign, ":hiring_budget", ":cur_wealth"),
(val_div, ":hiring_budget", 5),
(gt, ":hiring_budget", reinforcement_cost),
(call_script, "script_cf_reinforce_party", ":center_no"),
(val_sub, ":cur_wealth", reinforcement_cost),
(party_set_slot, ":center_no", slot_town_wealth, ":cur_wealth"),
(try_end),
]),
And here's the bit for training the AI garrisons. This one is buried in another trigger so was kinda tricky to find.
Code:
(try_for_range, ":center_no", walled_centers_begin, walled_centers_end),
(store_random_in_range, ":rand", 0, 100),
(lt, ":rand", 10),
(party_get_slot, ":center_lord", ":center_no", slot_town_lord),
(neq, ":center_lord", "trp_player"),
(party_upgrade_with_xp, ":center_no", 3000),
(try_end),
My goal is to make a new trigger, combining these 2.
1 - Check to see if center is player owned
2 - Check to see if center has troop barracks (slot_center_has_barracks)
3 - Give some xp to current garrison. I don't really care how they progress through the troop trees, but train the current garrison before we hire new guys.
4 - Hire more troops
So, I have no real knowledge of coding for M&B. I can do simple changes. But when it comes to something like this, I'm at a loss on how to accomplish it. So if any one would like to put this together for me, I would appreciate it.