OSP Code Campaign [WIP] Way of the Sea - water travel -

Users who are viewing this thread

                                                                Way of the Sea

                                                                ---An alternative water travel method---

Way of the Sea seeks to eliminate drawbacks from previous water travel methods, by allowing both the player and ai to travel on water. This is done via ports. Ports allow parties to land at a nearby village/town, whereas the nearby village/town lets the party board a ship and set sail from the port.

The modder can freely place ports on the map. Think of ports like magnets, if the port is close enough to a village or town, it will automatically link itself to it, currently the link radius is 10. If there is no village/town within 10m, the port will not be used. There is also no need to manually adjust game_menus for each port, as the option to "board a ship", only appears, if there is a linked port. There is no fixed number of ports, if you need more, just add more ports to module_parties and place them on the map, the code will do the rest :wink:

A sample AI path using land->water->land travel would be:
travel to town->get relocated to nearby port->water travel to exit port->get relocated to nearby town->travel to destination

Screenshots in order: 1)Town menu, 2) Using "go aboard a ship", 3) Port menu:
2ecjdop.jpg

jqp2ts.jpg

2d6ope.jpg

How to add this to your own mod:
Injecting call_script: Longest part of the whole thing
Use "Search in files", search for "party_set_ai_object" in the whole module system and replace the whole line with the following (Tip: when inserting the code, start from the bottom of the file and work your way of the search results, that way the lines of not yet touched stuff do not shift):
        (assign, "$g_party_no", ":party_no"),
        (assign, "$g_target_center", ":target_center"),
        (call_script, "script_calculate_distances"),        #F&B injected
Make sure to change the bolded variables to the ones used in each particular location.

script 1: Add to script_game_start:
(try_for_range, ":port", ports_begin, ports_end),
(party_set_slot, ":port", slot_party_type, spt_port),
(try_end),
script 2: Add anywhere (this is where the decisions are being made)
#################### F&B begin script calculate_distances
  ("calculate_distances",
  [
      (assign, ":party_no", "$g_party_no"),
      (assign, ":target_center", "$g_target_center"),
  (try_begin),
      (party_is_active, ":party_no"),
      (try_begin), #### water-water
        (party_is_active, ":party_no"),     
        (party_get_current_terrain, ":terrain", ":party_no"),
        (this_or_next|eq, ":terrain", 0),
        (eq, ":terrain", :cool:,
        (try_begin),
            (party_get_slot, ":target", ":party_no", slot_party_destination),
            (ge, ":target", 1),
        (else_try),
            (assign, ":target", ":target_center"),
        (try_end),
        (party_is_active, ":target"),
        (party_get_current_terrain, ":terrain", ":target"),
        (this_or_next|eq, ":terrain", 0),
        (eq, ":terrain", :cool:,
        (party_set_ai_object, ":target", ":party_no"),
      (else_try),  ### water-land
        (party_is_active, ":party_no"),
        (party_get_current_terrain, ":terrain", ":party_no"),
        (this_or_next|eq, ":terrain", 0),
        (eq, ":terrain", :cool:,
        (try_begin),
            (party_get_slot, ":target", ":party_no", slot_party_destination),
            (ge, ":target", 1),
        (else_try),
            (assign, ":target", ":target_center"),
        (try_end),
        (party_is_active, ":target"),
        (party_get_current_terrain, ":terrain", ":target"),
        (this_or_next|neg|eq, ":terrain", 0),
        (neg|eq, ":terrain", :cool:,
        (party_set_slot, ":party_no", slot_using_port, 2),
        (assign, ":closest_port_dist", 99999),
        (try_for_range, ":port", ports_begin, ports_end),
            (party_is_active, ":port"),
            (store_distance_to_party_from_party, ":dist", ":port", ":target"),
            (le, ":dist", ":closest_port_dist"),
            (assign, ":closest_port_dist", ":dist"),
            (assign, ":closest_port", ":port"),
        (try_end),
        (try_begin),
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_hero_party),
            (party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_state),
            (party_set_slot, ":party_no", slot_party_orig_ai_state, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_ai_state, spai_holding_center),
        (try_end),
##### Substate fix?
        (try_begin),
(party_slot_ge, ":party_no", slot_party_ai_substate, 1),
          (party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_substate),
            (party_set_slot, ":party_no", slot_party_orig_ai_substate, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_ai_substate, 0),
        (try_end),
        (party_set_slot, ":party_no", slot_party_destination, "$g_target_center"),
        (get_party_ai_behavior, ":behavior", ":party_no"),
        (party_set_slot, ":party_no", slot_exit_port, ":closest_port"),
        (party_set_slot, ":party_no", slot_ai_behavior, ":behavior"),
        (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
        (party_set_ai_object, ":party_no", ":closest_port"),   
      (else_try), ### land-water
        (party_is_active, ":party_no"),
        (party_get_current_terrain, ":terrain", ":party_no"),
        (this_or_next|neg|eq, ":terrain", 0),
        (neg|eq, ":terrain", :cool:,
        (try_begin),
            (party_get_slot, ":target", ":party_no", slot_party_destination),
            (ge, ":target", 1),
        (else_try),
            (assign, ":target", ":target_center"),
        (try_end),
        (party_is_active, ":target"),
        (party_get_current_terrain, ":terrain", ":target"),
        (this_or_next|eq, ":terrain", 0),
        (eq, ":terrain", :cool:,   
        (assign, ":closest_settlement_dist", 99999),
        (try_for_range, ":target", centers_begin, centers_end),
            (this_or_next|party_slot_eq, ":target", slot_party_type, spt_town),
            (party_slot_eq, ":target", slot_party_type, spt_village),
            (party_slot_eq, ":target", slot_center_has_port, 1),
            (store_distance_to_party_from_party, ":dist", ":target", ":party_no"),
            (le, ":dist", ":closest_settlement_dist"),     
            (assign, ":closest_settlement_dist", ":dist"),
            (assign, ":entry", ":target"),
        (try_end),
        (get_party_ai_behavior, ":behavior", ":party_no"),
        (party_get_slot, ":entry_port", ":entry", slot_centers_port_is),
        (party_set_slot, ":party_no", slot_entry_port, ":entry_port"),
        (party_set_slot, ":party_no", slot_using_port, 1),
(try_begin),
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_hero_party),
(party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_state),
(party_set_slot, ":party_no", slot_party_orig_ai_state, ":party_ai_state"), 
(party_set_slot, ":party_no", slot_party_ai_state, spai_holding_center),
(try_end),
        (try_begin),
(party_slot_ge, ":party_no", slot_party_ai_substate, 1),
            (party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_substate),
            (party_set_slot, ":party_no", slot_party_orig_ai_substate, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_ai_substate, 0),
        (try_end),
        (party_set_slot, ":party_no", slot_ai_behavior, ":behavior"),
        (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
        (party_set_slot, ":party_no", slot_entry_center, ":entry"),
        (party_set_ai_object, ":party_no", ":entry"),     
      (else_try),  ### land-water-land
        (party_is_active, ":party_no"),
        (assign, ":closest_port_dist", 99999),
        (try_for_range, ":port", ports_begin, ports_end),
            (party_is_active, ":port"),
            (store_distance_to_party_from_party, ":distance", ":party_no", ":port"),
            (le, ":distance", ":closest_port_dist"), 
            (assign, ":closest_port_dist", ":distance"),
            (assign, ":closest_port", ":port"),
        (try_end),
        (assign, ":closest_exit_port_dist", 99999),
        (party_is_active, ":target_center"),
        (try_for_range, ":port", ports_begin, ports_end),
            (party_is_active, ":port"),
            (store_distance_to_party_from_party, ":distance", ":target_center", ":port"),
            (le, ":distance", ":closest_exit_port_dist"),         
            (assign, ":closest_exit_port_dist", ":distance"),
            (assign, ":closest_exit_port", ":port"),
        (try_end),
        (neg|eq, ":closest_port", ":closest_exit_port"),      ## bug fix. for land->water->land, the ports should not be the same
        (store_distance_to_party_from_party, ":distance_betw_ports", ":closest_exit_port", ":closest_port"),
        (store_distance_to_party_from_party, ":direct_distance", ":party_no", ":target_center"),
        (val_div, ":distance_betw_ports", 2),
        (val_add, ":closest_port_dist", ":closest_exit_port_dist"),
        (val_add, ":closest_port_dist", ":distance_betw_ports"),
        (val_mul, ":direct_distance", 2),
        (le, ":closest_port_dist", ":direct_distance"),
        (party_get_slot, ":entry_fief", ":closest_port", slot_ports_center_is),       
        (get_party_ai_behavior, ":behavior", ":party_no"),
(try_begin),
(party_slot_eq, ":party_no", slot_party_type, spt_kingdom_hero_party),
(party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_state),
(party_set_slot, ":party_no", slot_party_orig_ai_state, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_ai_state, spai_holding_center),
(try_end),
        (try_begin),
(party_slot_ge, ":party_no", slot_party_ai_substate, 1),
            (party_get_slot, ":party_ai_state", ":party_no", slot_party_ai_substate),
            (party_set_slot, ":party_no", slot_party_orig_ai_substate, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_ai_substate, 0),
        (try_end),
        (party_set_slot, ":party_no", slot_party_destination, ":target_center"),       
        (party_set_slot, ":party_no", slot_using_port, 1),
        (party_set_slot, ":party_no", slot_entry_port, ":closest_port"), 
        (party_set_slot, ":party_no", slot_exit_port, ":closest_exit_port"),       
        (party_set_slot, ":party_no", slot_ai_behavior, ":behavior"),
        (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
        (party_set_slot, ":party_no", slot_entry_center, ":entry_fief"),
        (party_set_ai_object, ":party_no", ":entry_fief"),     
      (else_try),  #land-land without ports
        (party_set_ai_object, ":party_no", "$g_target_center"),
        (party_set_slot, ":party_no", slot_exit_port, -1),
        (party_set_slot, ":party_no", slot_entry_port, -1),
        (party_set_slot, ":party_no", slot_using_port, -1),
        (party_set_slot, ":party_no", slot_entry_center, -1),
############ Fixing recruiting and raiding
(try_begin),
(this_or_next|party_slot_eq, ":party_no", slot_party_ai_state, spai_visiting_village),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_patrolling_around_center),
(party_is_active, ":target_center"),
            (party_get_position, pos1, ":target_center"),
            (map_get_random_position_around_position, pos2, pos1, 1),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
(else_try),
(this_or_next|party_slot_eq, ":party_no", slot_party_ai_state, spai_besieging_center),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_raiding_around_center),
(party_is_active, ":target_center"),
            (party_get_position, pos1, ":target_center"),
            (map_get_random_position_around_position, pos2, pos1, 2),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
(try_end),
      #include mountain fortress
#      (call_script, "script_calculate_mountain_distances"),
      #include mountain fortress 
      (try_end),
  (try_end),
script 3: Add this to game_event_party_encounter

(else_try),
(party_slot_eq, "$g_encountered_party", slot_party_type, spt_port),
(jump_to_menu, "mnu_port"),
so it looks like this:
        (else_try),
          (party_slot_eq, "$g_encountered_party", slot_party_type, spt_village),
          (jump_to_menu, "mnu_village"),
(else_try),
  (party_slot_eq, "$g_encountered_party", slot_party_type, spt_port),
  (jump_to_menu, "mnu_port")
script 4 : script party_set_ai_state needs to be adjusted:
There are four blocks which set a position, they have to be commented/deleted, so that they aren't used. script_calculate_distances and the simple_trigger will calculate their own positions, if necessary.
The blocks are beneath these:
-spai_besieging_center
-spai_patrolling_around_center
-spai_visiting_village
-spai_raiding_around_center

Here's how it should look like after the changes:
          (else_try),
            (eq, ":new_ai_state", spai_besieging_center),
           
#            (party_get_position, pos1, ":new_ai_object"),
#            (map_get_random_position_around_position, pos2, pos1, 2),
#            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
#            (party_set_ai_target_position, ":party_no", pos2),
#            (party_set_ai_object, ":party_no", ":new_ai_object"),

            (party_set_flags, ":party_no", pf_default_behavior, 0),
            (party_set_slot, ":party_no", slot_party_follow_me, 1),
            (party_set_slot, ":party_no", slot_party_ai_substate, 0),
(assign, "$g_party_no", ":party_no"),
(assign, "$g_target_center", ":new_ai_object"),
(call_script, "script_calculate_distances"),        #F&B injected  

Simple_triggers: Add anywhere
######################### F&B begin Trigger for AI using ports
(1,
  [
(try_for_parties, ":party_no"),
(assign, ":target_center", -1),
(assign, ":dist", -1),
(assign, ":entry_center", -1),
(assign, ":cur_icon", -1),
(assign, ":port", -1),
(assign, ":exit_port", -1),
(assign, ":behavior", -1),
(assign, ":party_ai_state", -1),
(assign, ":ai_object", -1),
(party_is_active, ":party_no"),
  (try_begin),      #### moving party from land to sea
      (party_slot_eq, ":party_no", slot_using_port, 1),
      (party_get_slot, ":entry_center", ":party_no", slot_entry_center),
      (store_distance_to_party_from_party, ":dist", ":party_no", ":entry_center"),
      (le, ":dist", 0),
  (try_begin),
      (party_get_icon, ":cur_icon", ":party_no"),
      (party_set_slot, ":party_no", slot_party_save_icon, ":cur_icon"),
  (try_end),

      (party_get_slot, ":port", ":party_no", slot_entry_port),
      (party_is_active, ":party_no"),
      (party_is_active, ":port"), 
(try_begin),
(party_relocate_near_party, ":party_no", ":port", 0),
(else_try),
(display_message, "@ Report Relocation bug"),
(try_end),
      (party_set_icon, ":party_no", "icon_ship"),
      (party_set_flags, ":party_no", pf_is_ship, 1), 
      (party_get_slot, ":exit_port", ":party_no", slot_exit_port),
  (party_is_active, ":exit_port"),
      (try_begin), ##### If party wants to get back on land
        (party_slot_ge, ":party_no", slot_exit_port, 1),
        (party_get_slot, ":exit_port", ":party_no", slot_exit_port),       
        (is_between, ":exit_port", ports_begin, ports_end),
        (party_set_slot, ":party_no", slot_using_port, 2),           
        (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
        (party_set_ai_object, ":party_no", ":exit_port"), 
### Accompany fix. This will update all pathing of lords that follow the player
(try_for_parties, ":lord"),
(party_slot_eq, ":lord", slot_party_type, spt_kingdom_hero_party),
(party_slot_eq, ":lord", slot_party_ai_state, spai_accompanying_army),
(get_party_ai_object, ":ai_object", ":lord"),
(eq, ":ai_object", ":party_no"),
(assign, "$g_party_no", ":lord"),
(assign, "$g_target_center", ":party_no"),
(call_script, "script_calculate_distances"),
(try_end),     
      (else_try), ##### If party stays on water       
        (party_get_slot, ":behavior", ":party_no", slot_ai_behavior),
          (party_set_ai_behavior, ":party_no", ":behavior"),     
        (party_get_slot, ":target_center", ":party_no", slot_party_destination),
(try_begin),
(party_slot_ge, ":party_no", slot_party_orig_ai_state, 1),
(party_get_slot, ":party_ai_state", ":party_no", slot_party_orig_ai_state),
(party_set_slot, ":party_no", slot_party_ai_state, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_orig_ai_state, -1),
(try_end),
        (party_set_slot, ":party_no", slot_using_port, -1),
        (party_set_slot, ":party_no", slot_exit_port, -1),
        (party_set_slot, ":party_no", slot_entry_port, -1),
        (party_set_slot, ":party_no", slot_entry_center, -1), 
        (party_set_slot, ":party_no", slot_party_destination, -1),
(party_set_ai_object, ":party_no", ":target_center"),
### Accompany fix. This will update all pathing of lords that follow the party
(try_for_parties, ":lord"),
(party_slot_eq, ":lord", slot_party_type, spt_kingdom_hero_party),
(party_slot_eq, ":lord", slot_party_ai_state, spai_accompanying_army),
(get_party_ai_object, ":ai_object", ":lord"),
(eq, ":ai_object", ":party_no"),
(assign, "$g_party_no", ":lord"),
(assign, "$g_target_center", ":party_no"),
(call_script, "script_calculate_distances"),
(try_end),
      (try_end),

  (else_try),        ### moving units from sea to land
      (party_slot_eq, ":party_no", slot_using_port, 2),
      (party_get_slot, ":exit_port", ":party_no", slot_exit_port),
  (party_is_active, ":exit_port"),
      (store_distance_to_party_from_party, ":dist", ":party_no", ":exit_port"),
      (le, ":dist", 0),
  (party_get_slot, ":target", ":exit_port", slot_ports_center_is),
      (party_is_active, ":party_no"),
      (party_is_active, ":target"),

      (party_get_slot, ":icon", ":party_no", slot_party_save_icon),
      (party_set_icon, ":party_no", ":icon"),
      (party_set_flags, ":party_no", pf_is_ship, 0),
      (party_set_slot, ":party_no", slot_exit_port, -1),
      (party_set_slot, ":party_no", slot_entry_port, -1),
      (party_set_slot, ":party_no", slot_using_port, -1),
      (party_set_slot, ":party_no", slot_entry_center, -1),     
      (party_get_slot, ":behavior", ":party_no", slot_ai_behavior),
      (party_set_ai_behavior, ":party_no", ":behavior"),
(try_begin),
(party_slot_ge, ":party_no", slot_party_orig_ai_state, 1),
(party_get_slot, ":party_ai_state", ":party_no", slot_party_orig_ai_state),
(party_set_slot, ":party_no", slot_party_ai_state, ":party_ai_state"),
(party_set_slot, ":party_no", slot_party_orig_ai_state, -1),
(try_end),   
      (party_get_slot, ":target_center", ":party_no", slot_party_destination),
      (party_set_slot, ":party_no", slot_party_destination, -1),
      (party_set_ai_object, ":party_no", ":target_center"),
      (try_begin),
        (party_slot_eq, ":party_no", slot_party_type, spt_village_farmer),
        (party_set_flags, ":party_no", pf_civilian),
      (else_try),
        (party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan),
        (party_set_flags, ":party_no", pf_show_faction),
      (try_end),
(party_get_position, pos0, ":exit_port"),
(assign, ":ub", 10),
(assign, ":radius", 1),
(assign, ":iteration", 1),
(try_for_range, ":iteration", 0, ":ub"),
(try_begin),
(map_get_land_position_around_position, pos1, pos0, ":radius"),
(party_set_position, ":party_no", pos1),
(assign, ":ub", 1),
(else_try),
(le, ":iteration", :cool:,
(val_add, ":radius", 1),
(val_add, ":iteration", 1),
(else_try),
(party_relocate_near_party, ":party_no", ":target", 1),
(else_try),
(display_message, "@ Report Relocation 2 bug"),
(try_end),
(try_end),
############ Fixing recruiting and raiding
(try_begin),
(this_or_next|party_slot_eq, ":party_no", slot_party_ai_state, spai_visiting_village),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_patrolling_around_center),
(party_is_active, ":target_center"),
            (party_get_position, pos1, ":target_center"),
            (map_get_random_position_around_position, pos2, pos1, 1),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
(else_try),
(this_or_next|party_slot_eq, ":party_no", slot_party_ai_state, spai_besieging_center),
(party_slot_eq, ":party_no", slot_party_ai_state, spai_raiding_around_center),
(party_is_active, ":target_center"),
            (party_get_position, pos1, ":target_center"),
            (map_get_random_position_around_position, pos2, pos1, 2),
            (party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_point),
            (party_set_ai_target_position, ":party_no", pos2),
(try_end),
##### Marshall fix 
### Accompany fix. This will update all pathing of lords that follow the player
(try_for_parties, ":lord"),
(party_slot_eq, ":lord", slot_party_type, spt_kingdom_hero_party),
(party_slot_eq, ":lord", slot_party_ai_state, spai_accompanying_army),
(get_party_ai_object, ":ai_object", ":lord"),
(eq, ":ai_object", ":party_no"),
(assign, "$g_party_no", ":lord"),
(assign, "$g_target_center", ":party_no"),
(call_script, "script_calculate_distances"),
(try_end),
##### Marshall fix
  (try_end), #land->sea vs sea->land
(try_end), #party loop
  ]),

######################### F&B end Trigger for AI using ports 
constants: Add anywhere
Add above slot_center_has_prisoner_tower and shift the constants around, so that it fits in:
slot_center_has_port = xxx
Add these anywhere
##F&B begin
slot_party_state  = 595
slot_party_destination = 600
spt_port = 610
slot_exit_port = 611
slot_using_port = 612 ### 0 not using ports, 1 going from land to water, 2 going from water to land
slot_entry_port = 613
slot_entry_center = 614
slot_party_intermediate_destination = 61
slot_ai_behavior = 617
slot_party_flag = 618
slot_ai_target_position = 619
slot_centers_port_is = 620
slot_ports_center_is = 621
slot_party_orig_ai_state = 623
slot_party_orig_ai_object = 624
ports_begin = "p_port_1"
ports_end = "p_spawn_points_end"
##F&B end

parties: Add above spawn_points_end, or else adjust ports_end in constants accordingly:
#### Water travel ports
  ("port_1","Port 1",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-333.97, -172.24),[]),
  ("port_2","Port 2",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-311.29, -96.3:cool:,[]),
  ("port_3","Port 3",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-55.49, -59.4:cool:,[]),
  ("port_4","Port 4",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-78.8, -39.55),[]),
  ("port_5","Port 5",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(20.8, -22.12),[]),
  ("port_6","Port 6",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(274.33, -6.06),[]),
  ("port_7","Port 7",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-155.4, -224.61),[]),
  ("port_8","Port 8",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(18.84, 35.96),[]),
  ("port_9","Port 9",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-70.05, 12.42),[]),
  ("port_10","Port 10",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(86.05, -26.52),[]),
  ("port_11","Port 11",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(130.68, 39.62),[]),
  ("port_12","Port 12",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-244.51, 60.62),[]),
  ("port_13","Port 13",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-101.78, 264.12),[]),
  ("port_14","Port 14",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(199.55, 236.01),[]),
  ("port_15","Port 15",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]),
  ("port_16","Port 16",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]),
  ("port_17","Port 17",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]),
  ("port_18","Port 18",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]),
  ("port_19","Port 19",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]),
  ("port_20","Port 20",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[]), 
#F&B end ports
game_menus Part 1: Place this twice, above town_leave in mnu_town & above village_leave in mnu_village
#F&B begin water travel improved
("water_travel", [
(party_slot_eq, "$current_town", slot_center_has_port, 1),
    (neg|party_slot_eq, "$current_town", slot_village_state, svs_looted),
], "Go aboard a ship",
[
(try_begin),
(store_faction_of_party, ":faction_port", "$g_encountered_party"),
(store_faction_of_party, ":faction_party", "p_main_party"),
(store_relation, ":relation", ":faction_port", ":faction_party"),   
(ge, ":relation", 0),
(party_get_slot, ":port", "$current_town", slot_centers_port_is),
(party_relocate_near_party, "p_main_party", ":port", 0),
(party_set_icon, "p_main_party", "icon_ship"),
(party_set_flags, "p_main_party", pf_is_ship, 1),
### Accompany fix. This will update all pathing of lords that follow the player
(try_for_parties, ":lord"),
# (party_slot_eq, ":lord", slot_party_type, spt_kingdom_hero_party),
(party_slot_eq, ":lord", slot_party_ai_state, spai_accompanying_army),
(get_party_ai_object, ":ai_object", ":lord"),
(eq, ":ai_object", "p_main_party"),
(assign, "$g_party_no", ":lord"),
(assign, "$g_target_center", "p_main_party"),
(call_script, "script_calculate_distances"),
(try_end),
(change_screen_return),
(else_try),
(display_message, "@ You are not allowed entry to the port"),
(try_end),
], "Board the ship"),
#F&B end water travel improved

game_menus Part 2: Port menu
#### F&B begin port menu
("port", mnf_enable_hot_keys, "You arrive at the port of {s4}", "none",
[(party_get_slot, ":center_no", "$g_encountered_party", slot_ports_center_is),
(str_store_party_name, s4, ":center_no"),
        (try_begin),
          (party_get_slot, ":center_lord", ":center_no", slot_town_lord),
          (ge, ":center_lord", 0),
          (set_fixed_point_multiplier, 100),
          (position_set_x, pos0, 70),
          (position_set_y, pos0, 5),
          (position_set_z, pos0, 75),
          (set_game_menu_tableau_mesh, "tableau_troop_note_mesh", ":center_lord", pos0),
        (try_end),
],
[
("land",[
(party_get_slot, ":center_no", "$g_encountered_party", slot_ports_center_is),
(store_faction_of_party, ":faction_port", s4),
(store_faction_of_party, ":faction_party", "p_main_party"),
(store_relation, ":relation", ":faction_port", ":faction_party"),   
(ge, ":relation", 0),
    (neg|party_slot_eq, s4, slot_village_state, svs_looted),
# (str_store_party_name, s5, ":center_no"),
],"Land here",
[(party_get_slot, ":center", "$g_encountered_party", slot_ports_center_is),
(party_relocate_near_party, "p_main_party", ":center"),
(party_set_icon, "p_main_party", "icon_player"),
(party_set_flags, "p_main_party", pf_is_ship, 0),
### Accompany fix. This will update all pathing of lords that follow the player
(try_for_parties, ":lord"),
(party_slot_eq, ":lord", slot_party_type, spt_kingdom_hero_party),
(party_slot_eq, ":lord", slot_party_ai_state, spai_accompanying_army),
(get_party_ai_object, ":ai_object", ":lord"),
(eq, ":ai_object", "p_main_party"),
(assign, "$g_party_no", ":lord"),
(assign, "$g_target_center", "p_main_party"),
(call_script, "script_calculate_distances"),
(try_end),
(change_screen_return, 0),
]),
("dont_land0", [(party_get_slot, ":center_no", "$g_encountered_party", slot_ports_center_is),
(party_slot_eq, ":center_no", slot_village_state, svs_looted),],
"{s4} has been looted and cannot be crossed. Come back later",
[(change_screen_return, 0)]),

("dont_land",[
(party_get_slot, ":center_no", "$g_encountered_party", slot_ports_center_is),
(store_faction_of_party, ":faction_port", ":center_no"),
(store_faction_of_party, ":faction_party", "p_main_party"),
(str_store_faction_name, s0, ":faction_port"),
(store_relation, ":relation", ":faction_port", ":faction_party"),   
(lt, ":relation", 0),
],"{s0} don't allow you to land here. Leave.",
[(change_screen_return, 0),
]),
("port_leave",
[
(party_get_slot, ":center_no", "$g_encountered_party", slot_ports_center_is),
(store_faction_of_party, ":faction_port", ":center_no"),
(store_faction_of_party, ":faction_party", "p_main_party"),
(store_relation, ":relation", ":faction_port", ":faction_party"),   
(ge, ":relation", 0),
],
"Leave",
[(change_screen_return, 0)]),
]),
#### F&B end water travel

Triggers:
#### F&B disable all ports, then reenable the ones, that are close
(0.0, 0, ti_once, [],
[
(try_for_range, ":port", ports_begin, ports_end),
(disable_party, ":port"),
(try_end),
]),


##### F&B begin rename ports
  (0.0, 0, ti_once, [],
      [
      (try_for_range, ":port", ports_begin, ports_end),
      (assign, ":min_dist", 11),
        (try_for_range, ":closest_settlement", centers_begin, centers_end),
# (assign, ":target", -1),
            (this_or_next|party_slot_eq, ":closest_settlement", slot_party_type, spt_town),
            (party_slot_eq, ":closest_settlement", slot_party_type, spt_village),
            (store_distance_to_party_from_party, ":dist", ":closest_settlement", ":port"),
            (le, ":dist", ":min_dist"),
            (assign, ":min_dist", ":dist"),
            (assign, ":target", ":closest_settlement"),
        (try_end),
(le, ":min_dist", 10),
(is_between, ":target", centers_begin, centers_end),
(enable_party, ":port"),
(party_set_slot, ":target", slot_center_has_port, 1),
(party_set_slot, ":target", slot_centers_port_is, ":port"),
(party_set_slot, ":port", slot_ports_center_is, ":target"),
# (party_set_slot, ":target", slot_center_has_port, 1),
      (str_store_party_name, s4, ":target"),
      (party_set_name, ":port", "@{s4}'s port"),
      (try_end),     
     
      ]), 
#### F&B end rename ports
The script is still WIP. I've tried to make the script as basic and flexible as possible, which may result in some strange ai travel decisions.

Credits:
Ruthven for the original water travel code and inspiration
Brytenwalda team for slot_party_save_icon


Feedback, questions and/or possible ways to improve are welcome.
 
You are welcome.

This version of water travel will also find it's way into dynamic world for two reasons:

-the whole ocean is passable, as it does not rely on the bridge_terrain workaround
-coastal villages & towns will be able to build a port. And when they downgrade, the port can be removed. Thus settlement prosperity and war raiding will have an impact on the available water travel routes.
 
Of course. You can place the ports anywhere, as long as it is on water. It is not advised to place a port on land, as that would mess with the script and cause parties to get stuck.

Masterancza said:
How it works with AI? Is it work?
In my original post, open the spoiler "How to add this to your own mod:" and inside that, open the spoiler "script 2". That script decides, whether the ai will use a port.

It boils down to this line:
(le, ":closest_port_dist", ":direct_distance"),

It estimates total travel distance via ports:
distance from party to port
+distance from port to exit port
+distance from exit port to target

and checks, if that distance is shorter than if the party travels directly to it's target. If the distance via ports is shorter, the party will use the port.
 
So, I tried it, did all the required changed to game files(the installation couldn't be moew straight-forward, very good work), but it gives me a ton of errors. Where am I wrong? Here's the compiler:

Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 47551, in <module>
    (party_set_slot, ":party_no", slot_party_destination, ":target_center"),
NameError: name 'slot_party_destination' is not defined
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .
 
Also forgot about the script: game_event_party_encounter.
The bolded part should be added to it, so that the port menu works.
        (else_try),
          (party_slot_eq, "$g_encountered_party", slot_party_type, spt_village),
          (jump_to_menu, "mnu_village"),
(else_try),
  (party_slot_eq, "$g_encountered_party", slot_party_type, spt_port),
  (jump_to_menu, "mnu_port")

Even though I think most people will just use the embark option, instead of visiting the port.
 
So, it compiled fine after the added constant, but when I added these two new lines of script, this happened:
Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "C:\Program Files\Mount&Blade Warband3\Modules\Module_system 1.153\module_scripts.py", line 2876, in <module>
    (else_try),
TypeError: 'tuple' object is not callable
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

Any ideas?
Also, before that, the town menu worked fine, but in the port menu it showed the "chamberlain" options.
 
You must have missed a comma.

And yes, the last addition to game_event_party_encounter is to show the actual port menu, instead of the chamberlain options.

HyperCharge said:
Nice.Can i change that to make suitable for my mod ?

Just,removing the menu.

It will be good for sea traders.

Yes, you may. Probably should have added OSP somewhere in the original post to make it obvious.
 
Holy **** you keep making more awesome scripts! :grin:

Looks very cool, I will keep an eye on this.
 
Hmm.

You meaning with that;

search all of "party_set_ai_object" in all of module_ files,and put that code to above or bottom of that operation;

Code:
(assign, "$g_party_no", ":party_no"),
         (assign, "$g_target_center", ":target_center"),
         (call_script, "script_calculate_distances"),         #F&B injected

Did i understand true ?
 
Yes:
-search for "party_set_ai_object" in all module files.
-add the three lines
-delete the line with (party_set_ai_object. Or place a "#" in front of it, so that it gets ignored. "script_calculate_distances" will assign "party_set_ai_object". We don't want other code to override the scripts travel decision.
 
You're doing real good work here man.

Feel free to use the Lighthouse icon from ACOK if you want something other than a village icon for the ports.

I'm on my phone right now, and not going to be near a PC for a couple of days so can't check the code right now, but does the port only apply to towns, or is it all parties?
 
Back
Top Bottom