OSP Code QoL Bodyguards/Escorts in Town/Village Scenes (Open Source)

Users who are viewing this thread

I created this account only to reply here. Can someone please tell me what am I supposed to do? I know nothing about coding. I downloaded Module System and set it up but I have no idea where should I copy paste these codes or what I am supposed to do with them. Can someone explain it to me like I'm a toddler?
EDIT: I managed to make it. Now the only problem is my companions don't follow me when I'm disguised.
EDIT2: Now my companions don't follow me into cities. When I visit a tavern I can see them around me but when I walk into streets, they are not with me.
 
Spaghetti said:
EDIT: I managed to make it. Now the only problem is my companions don't follow me when I'm disguised.
to make them follow you when you are disguised you need to make them do that by adding the trigger to it in module_mission_templates just like you added the triggers for towns and villages in the OP

Spaghetti said:
EDIT2: Now my companions don't follow me into cities. When I visit a tavern I can see them around me but when I walk into streets, they are not with me.
did you do it without messing around ? if you are not sure try this lower the renown needed for body guards and increase the number you can have in the block that you add to mission templates (check op again and read the comments to find you code) if y*not you might added it in a wrong way and messed something cuz it should still work !

if you still can't fix it tell me and i'll try to help you ! .                            imad
 
When I see it isn't working, I changed code, and voila!

modüle_mission_templates
Code:
bodyguard_trigger_a = (
   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),   
   ])
   
bodyguard_trigger_b = (
   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),
   ])
   
bodyguard_trigger_c = (
    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),
    ])

and
Code:
bodyguard_triggers,
change this to
Code:
bodyguard_trigger_a, bodyguard_trigger_b, bodyguard_trigger_c,

this works.
Thanks.
 
I'm playing Floris Evolved, as usual before starting a campaign I take a look at item and rebalance them.
The problem is when I started playing, I noticed something that really ground my gears: the bodyguard system.

Why is that with 1 leadership I get to command

30 + (base party size, I tweaked down to 5 to rebalance)
  5 + (1 leadership)
  6 + (charisma)
-----
41 people in total, and I can't get a single companion bodyguard until I reache 3 leadership? That doesn't make sense at all.
With my rebalancing, I have a max party size of 16, and that still is nonsense, I mean my companions get a freaking weekly wage too!

Basically what I want to do is tweak the script to give me
1 bodyguard per point of leadership,
1 additional bodyguard every 25 renown
increase guards cap size to 22 (the total numbers of companions in Floris evolved)

Problem is i tried to add it myself, but since I'm crap at Python, my only option rn is opening the txt file that contains the script and change some values (kind of like when you want to tweak party sizes by modifing the values of "game_get_party_companion_limit -1" in script.txt)
but I don't even know the location or what values I actually have to change.

Is there someone that can help me and telling me how to, or that is willing to mod the scripts himself, please?
 
raik3n87 said:
Python

Is there someone that can help me and telling me how to, or that is willing to mod the scripts himself, please?

not Python, but MBScript.

Code:
    (store_skill_level, ":leadership", skl_leadership, "trp_player"),  # leadership points you have
    (troop_get_slot, ":renown", "trp_player", slot_troop_renown),  # renown points
    (val_div, ":leadership", 3),  # divide your leadership by 3
    (val_div, ":renown", 400),   # divide your renown by 400
    (store_add, ":max_guards", ":renown", ":leadership"), # add the result from leadership and renown to get the number of guards
    (val_min, ":max_guards", 4), # 4 is the max number of guards here, so you get from 0 to 4.

    (ge, ":max_guards", 1),  # ge = greater or equal, so only continues if it has at least 1 guard

read the comments above and change the equations to your liking. Remember that it works with integers, not floats, so stuff like

3/2 = 1
2/3 = 0
anything/0 = error
 
Guys, I have a problem with bandit lair missions, I only spawn like 7 men and I'm facing dozens... is there a way to bring my whole army in the lair?
 
raik3n87 said:
Guys, I have a problem with bandit lair missions, I only spawn like 7 men and I'm facing dozens... is there a way to bring my whole army in the lair?

Code:
  ("bandit_lair",mtf_battle_mode|mtf_synch_inventory,charge,
    "Ambushing a bandit lair",
    [
      (0,mtef_team_0|mtef_use_exact_number,af_override_horse, aif_start_alarmed, 7,[]),
 
I'm trying to replicate floris' deserter recruiting system for bandits and manhunters too, without success
If I add  a modified version of the hiring part of the deserter cv to the manhunter cv, no dialog options appear in the manhunters' and instead there's a double dialog option in the deserters'

"MANHUNTER CONVERSATION"
dlga_start:manhunter_talk_b 131081 0  1 31 2 144115188075856110 2 Hey,_you_there!_You_seen_any_outlaws_around_here?  92  0 NO_VOICEOVER
dlga_start:manhunter_talk_b 131089 0  1 31 2 144115188075856110 2 Hey,_you_there!_You_seen_any_outlaws_around_here?  92  0 NO_VOICEOVER
dlga_start:manhunter_talk_b 131097 0  1 31 2 144115188075856110 2 Hey,_you_there!_You_seen_any_outlaws_around_here?  92  0 NO_VOICEOVER
dlga_manhunter_talk_b:manhunter_talk_b1 69631 92  0 Yes,_they_went_this_way_about_an_hour_ago.  93  0 NO_VOICEOVER
dlga_manhunter_talk_b1:close_window 4095 93  0 I_knew_it!_Come_on,_lads,_lets_go_get_these_bastards!_Thanks_a_lot,_friend.  6  1 2133 2 144115188075856011 1 NO_VOICEOVER
dlga_manhunter_talk_b:manhunter_talk_b2 69631 92  0 No,_haven't_seen_any_outlaws_lately.  94  0 NO_VOICEOVER
dlga_manhunter_talk_b2:close_window 4095 94  0 Bah._They're_holed_up_in_this_country_like_rats,_but_we'll_smoke_them_out_yet._Sooner_or_later.  6  1 2133 2 144115188075856011 1 NO_VOICEOVER

"DESERTER CONVERSATION"
dlga_start:deserter_paid_talk 131104 0  5 31 2 144115188075856110 2 521 3 1224979098644774912 144115188075856273 3 2270 1 1224979098644774913 2121 3 1224979098644774914 1224979098644774912 1224979098644774913 32 2 1224979098644774914 0 What_do_you_want?_You_want_to_pay_us_some_more_money?  1281  0 NO_VOICEOVER
dlga_deserter_paid_talk:deserter_paid_talk_2a 69631 1281  0 Sorry_to_trouble_you._I'll_be_on_my_way_now.  1282  0 NO_VOICEOVER
dlga_deserter_paid_talk_2a:close_window 4095 1282  0 Yeah._Stop_fooling_around_and_go_make_some_money._I_want_to_see_that_purse_full_next_time_I_see_you.  6  1 2133 2 144115188075856011 1 NO_VOICEOVER
dlga_deserter_paid_talk:deserter_paid_talk_2b 69631 1281  0 No._It's_your_turn_to_pay_me_this_time.  1283  0 NO_VOICEOVER
dlga_deserter_paid_talk_2b:close_window 4095 1283  0 What_nonsense_are_you_talking_about?_You_want_trouble?_You_got_it.  6  2 501 3 144115188075856273 3 0 1644 2 144115188075856273 0 NO_VOICEOVER
dlga_start:deserter_talk 131104 0  1 31 2 144115188075856110 2 We_are_the_free_brothers._We_will_fight_only_for_ourselves_from_now_on._Now_give_us_your_gold_or_taste_our_steel.  1284  0 NO_VOICEOVER
dlga_deserter_talk:close_window 69631 1284  0 When_I'm_done_with_you,_you'll_regret_ever_leaving_your_army.  6  0 NO_VOICEOVER
dlga_deserter_talk:deserter_barter 69631 1284  0 There's_no_need_to_fight._I_am_ready_to_pay_for_free_passage.  1285  0 NO_VOICEOVER
dlga_deserter_talk:deserter_recruit 69631 1284  4 2154 2 1224979098644774912 648518346341351424 1652 3 1224979098644774913 144115188075856273 0 1073741856 2 1224979098644774912 0 110 1 1224979098644774913 I_will_give_you_money_and_good_protection_if_you_join_my_party.  1286  0 NO_VOICEOVER
dlga_deserter_recruit:deserter_recruit_2 4095 1286  0 Sounds_like_a_good_deal._To_show_us_your_good_will,_pay_us_{reg5}_denars_and_we_will_join_you.  1287  17 1650 2 1224979098644774912 144115188075856273 2133 2 1224979098644774913 0 6 3 1224979098644774914 0 1224979098644774912 1652 3 1224979098644774915 144115188075856273 1224979098644774914 1653 3 1224979098644774916 144115188075856273 1224979098644774914 1 2 936748722493063191 1224979098644774915 2133 2 1224979098644774917 72057594037927936 2107 2 1224979098644774917 1224979098644774916 2105 2 1224979098644774913 1224979098644774917 3 0 2133 2 144115188075856007 1224979098644774913 2170 3 1224979098644774918 1369094286720630791 360287970189639680 2122 3 1224979098644774919 3 1224979098644774918 2121 3 1224979098644774920 100 1224979098644774919 2107 2 144115188075856007 1224979098644774920 2108 2 144115188075856007 100 2133 2 72057594037927941 144115188075856007 NO_VOICEOVER
dlga_deserter_recruit_2:deserter_recruit_3a 69631 1287  3 2149 2 72057594037927938 360287970189639680 30 2 72057594037927938 144115188075856007 2133 2 72057594037927941 144115188075856007 All_right_here's_your_{reg5}_denars.  1288  4 1529 2 360287970189639680 144115188075856007 1106 2 1585267068834417040 16711680 2123 3 1224979098644774912 144115188075856007 -50 1 3 936748722493063446 360287970189639680 1224979098644774912 NO_VOICEOVER
dlga_deserter_recruit_2:deserter_barter_3b 69631 1287  0 I_don't_have_that_much_money_with_me  1289  0 NO_VOICEOVER
dlga_deserter_recruit_3a:close_window 4095 1288  0 Ok,_we_are_at_your_service_from_now_on.  6  4 1 3 936748722493063338 648518346341351424 144115188075856273 1661 1 144115188075856273 1232 1 144115188075856273 2133 2 144115188075856011 1 NO_VOICEOVER
dlga_deserter_barter:deserter_barter_2 4095 1285  0 Good._You_are_clever._Now,_having_a_look_at_your_baggage,_I_reckon_a_fellow_like_you_could_pretty_easily_afford_{reg5}_denars._We_wouldn't_want_to_be_too_greedy,_now_would_we?_Pay_us,_and_then_you_can_go.  1290  14 2149 2 1224979098644774912 360287970189639680 1540 2 1224979098644774913 360287970189639680 6 3 1224979098644774914 0 1224979098644774913 1541 3 1224979098644774915 360287970189639680 1224979098644774914 30 2 1224979098644774915 0 4 0 33 3 1224979098644774915 288230376151711834 288230376151711868 2230 2 1224979098644774916 1224979098644774915 2105 2 1224979098644774912 1224979098644774916 3 0 3 0 2123 3 144115188075857209 1224979098644774912 10 2111 2 144115188075857209 10 2133 2 72057594037927941 144115188075857209 NO_VOICEOVER
dlga_deserter_barter_2:deserter_barter_3a 69631 1290  3 2149 1 72057594037927938 30 2 72057594037927938 144115188075857209 2133 2 72057594037927941 144115188075857209 All_right_here's_your_{reg5}_denars.  1291  1 1529 2 360287970189639680 144115188075857209 NO_VOICEOVER
dlga_deserter_barter_2:deserter_barter_3b 69631 1290  0 I_don't_have_that_much_money_with_me  1289  0 NO_VOICEOVER
dlga_deserter_barter_3b:close_window 4095 1289  0 Too_bad._Then_we'll_have_to_sell_you_to_the_slavers.  6  0 NO_VOICEOVER
dlga_deserter_barter_3a:close_window 4095 1291  0 Heh._That_wasn't_difficult,_now,_was_it?_All_right._Go_now.  6  5 2270 1 1224979098644774912 2105 2 1224979098644774912 72 501 3 144115188075856273 3 1224979098644774912 1644 2 144115188075856273 72 2133 2 144115188075856011 1 NO_VOICEOVER
 
Back
Top Bottom