celestialred said:
(try_for_range, ":troop_no", kingdom_1_lords_begin, kingdom_1_lords_end),
(troop_slot_ge , "trp_american_standard_bearer", slot_party_standard_bearer, 0)
(add_companion_party, "trp_american_standard_bearer")
(try_end)
I have a grave feeling this is completely incorrect syntax. Any help?
Your feeling is quite correct.
In order to do this without any scripting, you could simply add a standard bearer to the reinforcement party templates of those factions and ensure they each have such a troop...but if your concern is that the party has a standard bearer at all times, that won't do as they could die or end up with multiple bearers after a few reinforcements, so scripting would likely be best.
You'll want to loop through all parties, not through a range of troops:
(try_for_parties, ":party_no"),
will get you started there. If you are talking lord's parties in the field, you want to be sure that
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_hero_party),
Then, you'll want to check if that party has the troop you want. For that, you'll need to loop through the party's troop stacks. For that, you'll need:
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(try_for_range, ":stack", 0, ":num_stacks"),
(party_stack_get_troop_id, ":troop", ":party_no", ":stack"),
and that should get you started looping through the troops a party actually has. Check for equality with the appropriate standard bearer (likely the best way to do this would be to store the relevant standard bearer's troop ID in a
faction slot and then retrieve it via (store_faction_of_party) and (faction_get_slot). So you won't need your _begin, _end looping ranges, at least not for this. See scripts and the use of slots like slot_faction_tier_1_troop for more ideas here.
Finally, the command to add your troop is
(party_add_members,<party_id>,<troop_id>,<number>),
though you might want to use (party_force_add_members,<party_id>,<troop_id>,<number>),
in case the lord is at his party member limit