[anyone|plyr, "bodyguard_after_recruited", [(agent_get_simple_behavior, ":bhvr", "$g_talk_agent"),(lt, ":bhvr", 2)],
"Stay with me.", "close_window", [(agent_clear_scripted_mode, "$g_talk_agent"),
]],
[anyone|plyr, "bodyguard_after_recruited", [(agent_get_simple_behavior, ":bhvr", "$g_talk_agent"),(gt, ":bhvr", 1)],
"No need to keep following me.", "close_window", [(agent_get_position, pos1, "$g_talk_agent"),
(agent_set_scripted_destination, "$g_talk_agent", pos1),
]],
I have. I took your lead and added a very simple option to your debug menu:Somebody said:No problem. Have you verified prison breaks, etc?
("summon_prisoner",
[
(neg|party_slot_eq, "$current_town", slot_party_type, spt_village),
],
"Imprison Harlaus.",
[
(party_add_prisoners, "$current_town","trp_kingdom_1_lord",1),
(troop_set_slot, "trp_kingdom_1_lord", slot_troop_prisoner_of_party, "$current_town"),
]),
Ah! Of course. Just left it there from when it was spawn agent stuff, I suppose. OP modified to fit.Somebody said:Also, I'd put everything from (assign, ":entry_point", 0), to (modify_visitors_at_site, ":cur_scene"), outside the loop.
bodyguard_triggers =[
(ti_after_mission_start, 0, ti_once, [(neq, "$g_mt_mode", tcm_disguised)],
#condition for not sneaking in; to exclude prison-breaks, etc change to
# (eq, "$g_mt_mode", "tcm_default")
[
#Get number of bodyguards
(store_skill_level, ":leadership", skl_leadership, "trp_player"),
(troop_get_slot, ":renown", "trp_player", slot_troop_renown),
(val_div, ":leadership", 3),
(val_div, ":renown", 400),
(store_add, ":max_guards", ":renown", ":leadership"),
(val_min, ":max_guards", 4),
(ge, ":max_guards", 1),
#Get player info
(get_player_agent_no, ":player"),
(agent_get_team, ":playerteam", ":player"),
(agent_get_horse, ":use_horse", ":player"),
#If the player spawns with a horse, the bodyguard will too.
#Prepare Scene/Mission Template
(assign, ":entry_point", 0),
(assign, ":mission_tpl", 0),
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_village),
(assign, ":entry_point", 11),
#Village Elder's Entry
(assign, ":mission_tpl", "mt_village_center"),
(else_try),
(this_or_next|eq, "$talk_context", tc_prison_break),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_town_talk),
(assign, ":entry_point", 24),
#Prison Guard's Entry
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_castle),
(assign, ":mission_tpl", "mt_castle_visit"),
(else_try),
(assign, ":mission_tpl", "mt_town_center"),
(try_end),
(else_try),
(eq, "$talk_context", tc_tavern_talk),
(assign, ":entry_point", 17),
#First NPC Tavern Entry
(try_end),
(try_begin),
(neq, "$talk_context", tc_tavern_talk),
(gt, ":use_horse", 0),
(mission_tpl_entry_set_override_flags, ":mission_tpl", ":entry_point", 0),
(try_end), (store_current_scene, ":cur_scene"),
(modify_visitors_at_site, ":cur_scene"),
#Find and Spawn Bodyguards
(assign, ":bodyguard_count", 0),
(party_get_num_companion_stacks, ":num_of_stacks", "p_main_party"),
(try_for_range, ":i", 0, ":num_of_stacks"),
(party_stack_get_troop_id, ":troop_id", "p_main_party", ":i"),
(neq, ":troop_id", "trp_player"),
(troop_is_hero, ":troop_id"),
(neg|troop_is_wounded, ":troop_id"),
(val_add, ":bodyguard_count", 1),
(try_begin),
#For prison-breaks
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(troop_set_slot, ":troop_id", slot_troop_will_join_prison_break, 1),
(try_end),
(add_visitors_to_current_scene, ":entry_point", ":troop_id", 1),
(eq, ":bodyguard_count", ":max_guards"),
(assign, ":num_of_stacks", 0),
#Break Loop
(try_end),
#Stack Loop
(gt, ":bodyguard_count", 0),
#If bodyguards spawned...
(set_show_messages, 0),
(team_give_order, ":playerteam", 8, mordr_follow),
#Division 8 to avoid potential conflicts
(set_show_messages, 1),
]),
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent"),
(agent_get_troop_id, ":troop", ":agent"),
(neq, ":troop", "trp_player"),
(troop_is_hero, ":troop"),
(main_party_has_troop, ":troop"),
(get_player_agent_no, ":player"),
(agent_get_team, ":playerteam", ":player"),
(agent_get_position,pos1,":player"),
(agent_set_team, ":agent", ":playerteam"),
(agent_set_division, ":agent", 8),
(agent_add_relation_with_agent, ":agent", ":player", 1),
(agent_set_is_alarmed, ":agent", 1),
(store_random_in_range, ":shift", 1, 3),
(val_mul, ":shift", 100),
(position_move_y, pos1, ":shift"),
(store_random_in_range, ":shift", 1, 3),
(store_random_in_range, ":shift_2", 0, 2),
(val_mul, ":shift_2", -1),
(try_begin),
(neq, ":shift_2", 0),
(val_mul, ":shift", ":shift_2"),
(try_end),
(position_move_x, pos1, ":shift"),
(agent_set_position, ":agent", pos1),
]),
(ti_on_agent_killed_or_wounded, 0, 0,
[],
[
(store_trigger_param_1, ":dead_agent"),
(agent_get_troop_id, ":troop", ":dead_agent"),
(neq, ":troop", "trp_player"),
(troop_is_hero, ":troop"),
(main_party_has_troop, ":troop"),
(party_wound_members, "p_main_party", ":troop", 1),
]),
]
Lueii said:I am not sure where to put + bodyguard. Where in an example?
(try_end),
]),
]),
(
"village_center",0,-1,
"village center",
(try_end),
]),
] + bodyguard_triggers,
),
(
"village_center",0,-1,
"village center",
Yes, bodyguards (nice reference) could be assigned to the pilgrim outfit if you want to OK them for sneaking in, replace the first trigger with the following alternative version:Loner said:Is there a way to get one's Kevin Costner dressed in pilgrim (ie no ubber armor and weapon) whean sneaking into towns ? To respect the fact we are supposed to be stealthy peeps and making it harder (God, did I said that ? You must know that Rolf just got KO because AI is so wonderful once surrounded).
(ti_after_mission_start, 0, ti_once, [], #condition: to exclude sneaking in put (neq, "$g_mt_mode", tcm_disguised) within the [], to exclude prison-breaks, too use (eq, "$g_mt_mode", tcm_default")
[
#Get number of bodyguards
(store_skill_level, ":leadership", skl_leadership, "trp_player"),
(troop_get_slot, ":renown", "trp_player", slot_troop_renown),
(val_div, ":leadership", 3),
(val_div, ":renown", 400),
(store_add, ":max_guards", ":renown", ":leadership"),
(val_min, ":max_guards", 4),
(ge, ":max_guards", 1),
#Get player info
(get_player_agent_no, ":player"),
(agent_get_team, ":playerteam", ":player"),
(agent_get_horse, ":use_horse", ":player"), #If the player spawns with a horse, the bodyguard will too.
#Prepare Scene/Mission Template
(assign, ":entry_point", 0),
(assign, ":mission_tpl", 0),
(try_begin),
(eq, "$g_mt_mode", tcm_disguised),
(eq, "$sneaked_into_town", 0), #fail, caught
(assign, ":mission_tpl", "mt_sneak_caught_fight"),
#Find nearest visitor_source entry point near the player, depending on player's entry point
(try_begin),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(entry_point_get_position, pos0, 7),
(else_try),
(party_slot_eq, "$current_town", slot_party_type, spt_town),
(entry_point_get_position, pos0, 0),
(else_try),
(entry_point_get_position, pos0, 1),
(try_end),
(assign, ":smallest_dist", 100000),
(try_for_range, ":i", 2, 64),
(entry_point_get_position, pos1, ":i"),
(get_distance_between_positions, ":dist", pos0, pos1),
(lt, ":dist", ":smallest_dist"),
(assign, ":smallest_dist", ":dist"),
(assign, ":entry_point", ":i"),
(try_end),
(else_try_),
(party_slot_eq, "$current_town", slot_party_type, spt_village),
(assign, ":entry_point", 11), #Village Elder's Entry
(assign, ":mission_tpl", "mt_village_center"),
(else_try),
(this_or_next|eq, "$talk_context", tc_prison_break),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_town_talk),
(assign, ":entry_point", 24), #Prison Guard's Entry
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_castle),
(assign, ":mission_tpl", "mt_castle_visit"),
(else_try),
(assign, ":mission_tpl", "mt_town_center"),
(try_end),
(else_try),
(eq, "$talk_context", tc_tavern_talk),
(assign, ":entry_point", 17), #First NPC Tavern Entry
(try_end),
(try_begin),
(eq, "$g_mt_mode", tcm_disguised),
(mission_tpl_entry_set_override_flags, ":mission_tpl", ":entry_point", af_override_all),
(mission_entry_add_override_item, ":mission_tpl", ":entry_point", pilgrim_disguise),
(else_try),
(neq, "$talk_context", tc_tavern_talk),
(gt, ":use_horse", 0),
(mission_tpl_entry_set_override_flags, ":mission_tpl", ":entry_point", 0),
(try_end),
(store_current_scene, ":cur_scene"),
(modify_visitors_at_site, ":cur_scene"),
#Find and Spawn Bodyguards
(assign, ":bodyguard_count", 0),
(party_get_num_companion_stacks, ":num_of_stacks", "p_main_party"),
(try_for_range, ":i", 0, ":num_of_stacks"),
(party_stack_get_troop_id, ":troop_id", "p_main_party", ":i"),
(neq, ":troop_id", "trp_player"),
(troop_is_hero, ":troop_id"),
(neg|troop_is_wounded, ":troop_id"),
(val_add, ":bodyguard_count", 1),
(try_begin), #For prison-breaks
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(troop_set_slot, ":troop_id", slot_troop_will_join_prison_break, 1),
(try_end),
(add_visitors_to_current_scene, ":entry_point", ":troop_id", 1),
(eq, ":bodyguard_count", ":max_guards"),
(assign, ":num_of_stacks", 0), #Break Loop
(try_end), #Stack Loop
(try_begin),
(eq, "$g_mt_mode", tcm_disguised),
(mission_entry_clear_override_items, ":mission_tpl", ":entry_point"),
(try_end),
(gt, ":bodyguard_count", 0), #If bodyguards spawned...
(set_show_messages, 0),
(team_give_order, ":playerteam", 8, mordr_follow), #Division 8 to avoid potential conflicts
(set_show_messages, 1),
]),