Ability for player to buy and use multiple ships

Users who are viewing this thread

pan-boroda

Knight at Arms
Good day. There is a manual or a discussion thread on how to add a purchase and the ability for the player to use several types of ships (for example, a galley, carrack and nave) in the mod?
 
What do you want to achieve by this (by different type of vessels when one does the job already)? If you are talking about the ship mechanics (moving around in the sea), it was made in early days of original M&B and I presume it is hardcoded.
 
Upvote 0
No, I did not intend to change the mechanics.
Only corrected the galley icon so that the oars move when moving
I planned add 3 types of ships - naves, galleys and carracks. The naves are merchants, the galleys and carracks are military patrols.
On the basis of floris mod, I identified 3 types. When buying in cities on the sea, a normal icon appears. But the problem is that when mooring to the shore, the icon changes to one for all types. and when sailing also remains one for all.
 
Upvote 0
In general, I managed to make a purchase of 3 different types of ships - carracks, galleys and coggs
But there are a number of technical problems.
1) when buying any of the ships (provided that there are no other ships of the Player in the city), everything happens correctly, all icons are displayed correctly.
mb8.jpg
mb1.jpg

mb4.jpg
mb11.jpg

mb16.jpg
mb14.jpg
However, when mooring to the shore, the icon does not change to the icon that I would like when mooring, remaining the same as when sailing

mb12.jpg
mb2.jpg
mb15.jpg


2nd problem, if there are several ships in the city, when any of them depart from the city, the icon of a carrack (ship) is displayed on the global map, regardless of what type of ship I have chosen. At the same time, if you moor to the shore and then sail away, the icon changes to the correct one.
mb9.jpg
mb10.jpg
mb11.jpg

sailing away from the shore in a galley - the correct icon appears
mb17.jpg
mb18.jpg

Disembark code
Python:
 (
    "disembark",0,
    "Do you wish to disembark?^^\
 Do not to land on cliffs, unless you wish to get stuck.",
    "none",
    [],
    [
      ("disembark_yes",
      [    #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),  
      ], "Land the ship and leave it here for now.",
       [
        (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
        (store_party_size, ":party_size", ":ship_no"),
 
        (try_begin),
            (ge, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_guarded),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_ship),
            (party_set_icon, ":ship_no", "icon_ship_on_land"),
            (change_screen_return),
        (else_try),
            (lt, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_no_guard), #Wilderness
            (store_current_hours, ":time"),
            (val_add, ":time", 96),
            (party_set_slot, ":ship_no", slot_ship_time, ":time"),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_ship),
            (party_set_icon, ":ship_no", "icon_ship_on_land"),
            (change_screen_return),
            (display_message, "@You should leave 15 men behind to guard your ship, otherwise it might get stolen."),
        (try_end),            
             
        (party_set_slot, "p_main_party", slot_town_has_ship, 0),
        ]),
 
 
      ("disembark_yes_2",
        [
        ],
        "Dock at the port.",
 
        [
            (assign, reg1, 0),
            (try_for_range, ":town_no", towns_begin, towns_end),
                (party_slot_ge, ":town_no", slot_town_is_coastal, 1),
                (party_get_slot, ":radius", ":town_no", slot_town_is_coastal),
                (store_distance_to_party_from_party, ":dist", ":town_no", "p_main_party"),
                (val_add, ":radius", 2),
                (le, ":dist", ":radius"),
                (assign, "$g_player_icon_state", pis_normal),
                (party_set_flags, "p_main_party", pf_is_ship, 0),
                (party_relocate_near_party, "p_main_party", ":town_no", 0.5),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (party_set_slot, ":ship_no", slot_ship_center, ":town_no"),
                (disable_party, ":ship_no"),
                (party_get_slot, ":num_ships", ":town_no", slot_town_has_ship),
                (val_add, ":num_ships", 1),
                (party_set_slot, ":town_no", slot_town_has_ship, ":num_ships"),
                (assign, reg1, 1),
                (change_screen_return),
            (try_end),
            (try_begin),
                (eq, reg1, 0),
                (display_message, "@There is no port in the surrounding area."),
            (try_end),
        ]),    
 
 
        ("manage_crew", [], "Manage the crew.",
       [# (assign, ":ship_to_use", -1),
        # (try_for_parties, ":ship_no"),
            # (party_slot_eq, ":ship_no", slot_ship_center, 250),
            # (assign, ":ship_to_use", ":ship_no"),
        # (try_end),
        (party_get_slot, ":ship_to_use", "p_main_party", slot_town_has_ship),
        # (gt, ":ship_to_use", -1),
        #(assign, reg6, ":ship_to_use"),
        #(display_message,"@You now own a ship and can disembark from this town."),
        (set_encountered_party, ":ship_to_use"),
        #(change_screen_exchange_with_party, ":ship_to_use"),
        #(change_screen_give_members, ":ship_to_use"),
        (change_screen_exchange_members,0),
        #(party_clear, "p_temp_party"),
        #(call_script, "script_party_copy", "p_temp_party", ":ship_to_use"),    
        #(change_screen_exchange_with_party, "p_temp_party"),
        #(assign, "$g_next_menu", "mnu_disembark"),
        #(jump_to_menu, "mnu_manage_crew_done"),
        #(call_script, "script_party_add_party", ":ship_to_use", "p_temp_party"),
       ]),    
 
        ("disembark_yes_3",
        [
                #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),
 
            #(party_get_position, pos1, "p_main_party"),
            #(map_get_land_position_around_position, pos2, pos1, 1),
            #(party_set_position, "p_main_party", pos2),
            #(party_get_current_terrain, ":terrain", "p_main_party"),
            #(neq, ":terrain", 1),
            #(assign, reg20, ":terrain"),
            #(display_message, "@Terrain is {reg20}"),
            #(party_set_position, "p_main_party", pos1),
        ],
        "Yes, but send the ship to a port.",
 
        [
            # (try_for_parties, ":ship_no"),
                # (party_slot_eq, ":ship_no", slot_ship_center, 250),
                # (store_party_size, ":party_size", ":ship_no"),
            # (try_end),
            (try_begin),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (store_party_size, ":party_size", ":ship_no"),
                (ge, ":party_size", 30),    
                (jump_to_menu, "mnu_send_ship_to_town"),
            (else_try),
                (display_message, "@You need at least a 30 men crew to send the ship to a town"),
            (try_end),
        ]),
 
 
    ("disembark_no", [], "No.",
       [    (party_get_position, pos1, "p_main_party"),
            (map_get_water_position_around_position, pos2, pos1, 1),
            (party_set_position, "p_main_party", pos2),
            (rest_for_hours_interactive, 1, 1),
            (change_screen_return),
        ]),
    ]
  ),  

 (
    "disembark2",0,
    "Do you wish to disembark?^^\
 Do not to land on cliffs, unless you wish to get stuck.",
    "none",
    [],
    [
      ("disembark2_yes",
      [    #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),  
      ], "Land the ship and leave it here for now.",
       [
        (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
        (store_party_size, ":party_size", ":ship_no"),
 
        (try_begin),
            (ge, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_guarded),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_galley),
            (party_set_icon, ":ship_no", "icon_galley_on_land"),
            (change_screen_return),
        (else_try),
            (lt, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_no_guard), #Wilderness
            (store_current_hours, ":time"),
            (val_add, ":time", 96),
            (party_set_slot, ":ship_no", slot_ship_time, ":time"),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_galley),
            (party_set_icon, ":ship_no", "icon_galley_on_land"),
            (change_screen_return),
            (display_message, "@You should leave 15 men behind to guard your ship, otherwise it might get stolen."),
        (try_end),            
             
        (party_set_slot, "p_main_party", slot_town_has_ship, 0),
        ]),
 
 
      ("disembark_yes_2",
        [
        ],
        "Dock at the port.",
 
        [
            (assign, reg1, 0),
            (try_for_range, ":town_no", towns_begin, towns_end),
                (party_slot_ge, ":town_no", slot_town_is_coastal, 1),
                (party_get_slot, ":radius", ":town_no", slot_town_is_coastal),
                (store_distance_to_party_from_party, ":dist", ":town_no", "p_main_party"),
                (val_add, ":radius", 2),
                (le, ":dist", ":radius"),
                (assign, "$g_player_icon_state", pis_normal),
                (party_set_flags, "p_main_party", pf_is_ship, 0),
                (party_relocate_near_party, "p_main_party", ":town_no", 0.5),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (party_set_slot, ":ship_no", slot_ship_center, ":town_no"),
                (disable_party, ":ship_no"),
                (party_get_slot, ":num_ships", ":town_no", slot_town_has_ship),
                (val_add, ":num_ships", 1),
                (party_set_slot, ":town_no", slot_town_has_ship, ":num_ships"),
                (assign, reg1, 1),
                (change_screen_return),
            (try_end),
            (try_begin),
                (eq, reg1, 0),
                (display_message, "@There is no port in the surrounding area."),
            (try_end),
        ]),    
 
 
        ("manage_crew", [], "Manage the crew.",
       [# (assign, ":ship_to_use", -1),
        # (try_for_parties, ":ship_no"),
            # (party_slot_eq, ":ship_no", slot_ship_center, 250),
            # (assign, ":ship_to_use", ":ship_no"),
        # (try_end),
        (party_get_slot, ":ship_to_use", "p_main_party", slot_town_has_ship),
        # (gt, ":ship_to_use", -1),
        #(assign, reg6, ":ship_to_use"),
        #(display_message,"@You now own a ship and can disembark from this town."),
        (set_encountered_party, ":ship_to_use"),
        #(change_screen_exchange_with_party, ":ship_to_use"),
        #(change_screen_give_members, ":ship_to_use"),
        (change_screen_exchange_members,0),
        #(party_clear, "p_temp_party"),
        #(call_script, "script_party_copy", "p_temp_party", ":ship_to_use"),    
        #(change_screen_exchange_with_party, "p_temp_party"),
        #(assign, "$g_next_menu", "mnu_disembark"),
        #(jump_to_menu, "mnu_manage_crew_done"),
        #(call_script, "script_party_add_party", ":ship_to_use", "p_temp_party"),
       ]),    
 
        ("disembark_yes_3",
        [
                #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),
 
            #(party_get_position, pos1, "p_main_party"),
            #(map_get_land_position_around_position, pos2, pos1, 1),
            #(party_set_position, "p_main_party", pos2),
            #(party_get_current_terrain, ":terrain", "p_main_party"),
            #(neq, ":terrain", 1),
            #(assign, reg20, ":terrain"),
            #(display_message, "@Terrain is {reg20}"),
            #(party_set_position, "p_main_party", pos1),
        ],
        "Yes, but send the ship to a port.",
 
        [
            # (try_for_parties, ":ship_no"),
                # (party_slot_eq, ":ship_no", slot_ship_center, 250),
                # (store_party_size, ":party_size", ":ship_no"),
            # (try_end),
            (try_begin),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (store_party_size, ":party_size", ":ship_no"),
                (ge, ":party_size", 30),    
                (jump_to_menu, "mnu_send_ship_to_town"),
            (else_try),
                (display_message, "@You need at least a 30 men crew to send the ship to a town"),
            (try_end),
        ]),
 
 
    ("disembark_no", [], "No.",
       [    (party_get_position, pos1, "p_main_party"),
            (map_get_water_position_around_position, pos2, pos1, 1),
            (party_set_position, "p_main_party", pos2),
            (rest_for_hours_interactive, 1, 1),
            (change_screen_return),
        ]),
    ]
  ),

 (
    "disembark3",0,
    "Do you wish to disembark?^^\
 Do not to land on cliffs, unless you wish to get stuck.",
    "none",
    [],
    [
      ("disembark3_yes",
      [    #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),  
      ], "Land the ship and leave it here for now.",
       [
        (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
        (store_party_size, ":party_size", ":ship_no"),
 
        (try_begin),
            (ge, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_guarded),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_cog),
            (party_set_icon, ":ship_no", "icon_cog_on_land"),
            (change_screen_return),
        (else_try),
            (lt, ":party_size", 15),
            (assign, "$g_player_icon_state", pis_normal),
            (party_set_flags, "p_main_party", pf_is_ship, 0),
            (party_get_position, pos1, "p_main_party"),
            (party_set_position, "p_main_party", pos0),
            (party_relocate_near_party, ":ship_no", "p_main_party", 0),
            (party_set_slot, ":ship_no", slot_ship_center, ship_wild_no_guard), #Wilderness
            (store_current_hours, ":time"),
            (val_add, ":time", 96),
            (party_set_slot, ":ship_no", slot_ship_time, ":time"),
            (enable_party, ":ship_no"),
            (assign, ":ship_no", pis_cog),
            (party_set_icon, ":ship_no", "icon_cog_on_land"),
            (change_screen_return),
            (display_message, "@You should leave 15 men behind to guard your ship, otherwise it might get stolen."),
        (try_end),            
             
        (party_set_slot, "p_main_party", slot_town_has_ship, 0),
        ]),
 
 
      ("disembark_yes_2",
        [
        ],
        "Dock at the port.",
 
        [
            (assign, reg1, 0),
            (try_for_range, ":town_no", towns_begin, towns_end),
                (party_slot_ge, ":town_no", slot_town_is_coastal, 1),
                (party_get_slot, ":radius", ":town_no", slot_town_is_coastal),
                (store_distance_to_party_from_party, ":dist", ":town_no", "p_main_party"),
                (val_add, ":radius", 2),
                (le, ":dist", ":radius"),
                (assign, "$g_player_icon_state", pis_normal),
                (party_set_flags, "p_main_party", pf_is_ship, 0),
                (party_relocate_near_party, "p_main_party", ":town_no", 0.5),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (party_set_slot, ":ship_no", slot_ship_center, ":town_no"),
                (disable_party, ":ship_no"),
                (party_get_slot, ":num_ships", ":town_no", slot_town_has_ship),
                (val_add, ":num_ships", 1),
                (party_set_slot, ":town_no", slot_town_has_ship, ":num_ships"),
                (assign, reg1, 1),
                (change_screen_return),
            (try_end),
            (try_begin),
                (eq, reg1, 0),
                (display_message, "@There is no port in the surrounding area."),
            (try_end),
        ]),    
 
 
        ("manage_crew", [], "Manage the crew.",
       [# (assign, ":ship_to_use", -1),
        # (try_for_parties, ":ship_no"),
            # (party_slot_eq, ":ship_no", slot_ship_center, 250),
            # (assign, ":ship_to_use", ":ship_no"),
        # (try_end),
        (party_get_slot, ":ship_to_use", "p_main_party", slot_town_has_ship),
        # (gt, ":ship_to_use", -1),
        #(assign, reg6, ":ship_to_use"),
        #(display_message,"@You now own a ship and can disembark from this town."),
        (set_encountered_party, ":ship_to_use"),
        #(change_screen_exchange_with_party, ":ship_to_use"),
        #(change_screen_give_members, ":ship_to_use"),
        (change_screen_exchange_members,0),
        #(party_clear, "p_temp_party"),
        #(call_script, "script_party_copy", "p_temp_party", ":ship_to_use"),    
        #(change_screen_exchange_with_party, "p_temp_party"),
        #(assign, "$g_next_menu", "mnu_disembark"),
        #(jump_to_menu, "mnu_manage_crew_done"),
        #(call_script, "script_party_add_party", ":ship_to_use", "p_temp_party"),
       ]),    
 
        ("disembark_yes_3",
        [
                #Pos0 is set as the disembark position by the engine
            (position_get_x, ":x", pos0),
            (position_get_y, ":y", pos0),
            (store_sub, ":min_x", ":x", 1), #Radius of 5 map units...not the radius units from before, I don't think
            (store_add, ":max_x", ":x", 2),
            (store_sub, ":min_y", ":y", 1),
            (store_add, ":max_y", ":y", 2),
            (assign, ":no_cliffs", 1),
            (try_for_range, ":x", ":min_x", ":max_x"),
                (try_for_range, ":y", ":min_y", ":max_y"),
                    (position_set_x, pos1, ":x"),
                    (position_set_y, pos1, ":y"),
                    (party_set_position, "p_temp_party", pos1),
                    (party_get_position, pos1, "p_temp_party"),
                    (position_get_z, ":z", pos1),
                    (gt, ":z", 2), #There be cliffs
                    (assign, ":no_cliffs", 0),
                    (assign, ":max_y", 0),
                    (assign, ":max_x", 0),
                (try_end), #Ys
            (try_end), #Xs
            (init_position, pos1),
            (party_set_position, "p_temp_party", pos1), #Reset Temp Party Position
            (eq, ":no_cliffs", 1),
 
            #(party_get_position, pos1, "p_main_party"),
            #(map_get_land_position_around_position, pos2, pos1, 1),
            #(party_set_position, "p_main_party", pos2),
            #(party_get_current_terrain, ":terrain", "p_main_party"),
            #(neq, ":terrain", 1),
            #(assign, reg20, ":terrain"),
            #(display_message, "@Terrain is {reg20}"),
            #(party_set_position, "p_main_party", pos1),
        ],
        "Yes, but send the ship to a port.",
 
        [
            # (try_for_parties, ":ship_no"),
                # (party_slot_eq, ":ship_no", slot_ship_center, 250),
                # (store_party_size, ":party_size", ":ship_no"),
            # (try_end),
            (try_begin),
                (party_get_slot, ":ship_no", "p_main_party", slot_town_has_ship),
                (store_party_size, ":party_size", ":ship_no"),
                (ge, ":party_size", 30),    
                (jump_to_menu, "mnu_send_ship_to_town"),
            (else_try),
                (display_message, "@You need at least a 30 men crew to send the ship to a town"),
            (try_end),
        ]),
 
 
    ("disembark_no", [], "No.",
       [    (party_get_position, pos1, "p_main_party"),
            (map_get_water_position_around_position, pos2, pos1, 1),
            (party_set_position, "p_main_party", pos2),
            (rest_for_hours_interactive, 1, 1),
            (change_screen_return),
        ]),
    ]
  ),

Buy ship code
Python:
    ("Buy_a_ship",
    [],
    "Purchase a carrack (30000 silver coins)",
    [
    (try_begin),
        (party_get_slot, ":num_ships", "$current_town", slot_town_has_ship),
        (le, ":num_ships", 4),
        (store_troop_gold,":money","trp_player"),
        (ge,":money",30000),
        (troop_remove_gold,"trp_player",30000),
        (val_add, ":num_ships", 1),    
        (party_set_slot, "$current_town", slot_town_has_ship, ":num_ships"),
        (try_begin),
            (set_spawn_radius, 0),
            (spawn_around_party, "$current_town", "pt_ship"),
            (assign, ":new_ship", reg0),
            (party_set_slot, ":new_ship", slot_party_type, spt_ship),
            (party_set_slot, ":new_ship", slot_ship_center, "$current_town"),
            (assign, reg6, ":new_ship"),
        (try_end),
        (display_message,"@You now own a ship and can disembark from this town."),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 5),
        (display_message, "@There is no room for any further ships in this harbor."),
    (else_try),    
        (display_message,"@You don't have enough money to buy a ship."),
    (try_end),
    ]),

    ("Buy_a_galley",
    [],
    "Purchase a galley (25000 silver coins)",
    [
    (try_begin),
        (party_get_slot, ":num_ships", "$current_town", slot_town_has_ship),
        (le, ":num_ships", 4),
        (store_troop_gold,":money","trp_player"),
        (ge,":money",25000),
        (troop_remove_gold,"trp_player",25000),
        (val_add, ":num_ships", 1),    
        (party_set_slot, "$current_town", slot_town_has_ship, ":num_ships"),
        (try_begin),
            (set_spawn_radius, 0),
            (spawn_around_party, "$current_town", "pt_galley"),
            (assign, ":new_ship", reg0),
            (party_set_slot, ":new_ship", slot_party_type, spt_galley),
            (party_set_slot, ":new_ship", slot_ship_center, "$current_town"),
            (assign, reg6, ":new_ship"),
        (try_end),
        (display_message,"@You now own a ship and can disembark from this town."),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 5),
        (display_message, "@There is no room for any further ships in this harbor."),
    (else_try),    
        (display_message,"@You don't have enough money to buy a ship."),
    (try_end),
    ]),
 
    ("Buy_a_cog",
    [],
    "Purchase a cog (15000 silver coins)",
    [
    (try_begin),
        (party_get_slot, ":num_ships", "$current_town", slot_town_has_ship),
        (le, ":num_ships", 4),
        (store_troop_gold,":money","trp_player"),
        (ge,":money",15000),
        (troop_remove_gold,"trp_player",15000),
        (val_add, ":num_ships", 1),    
        (party_set_slot, "$current_town", slot_town_has_ship, ":num_ships"),
        (try_begin),
            (set_spawn_radius, 0),
            (spawn_around_party, "$current_town", "pt_cog"),
            (assign, ":new_ship", reg0),
            (party_set_slot, ":new_ship", slot_party_type, spt_cog),
            (party_set_slot, ":new_ship", slot_ship_center, "$current_town"),
            (assign, reg6, ":new_ship"),
        (try_end),
        (display_message,"@You now own a ship and can disembark from this town."),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 5),
        (display_message, "@There is no room for any further ships in this harbor."),
    (else_try),    
        (display_message,"@You don't have enough money to buy a ship."),
    (try_end),
    ]),    

#Wulf + Floris begin
    ("sail_from_port",
    [], "Set sail with your ship",
    [
    (try_begin),
        (party_slot_eq, "$current_town", slot_town_has_ship, 1),
        (assign, ":break", 0),
        (try_for_parties, ":ship_no"),
            (eq, ":break", 0),
            (party_slot_eq, ":ship_no", slot_party_type, spt_ship),
            (party_slot_eq, ":ship_no", slot_ship_center, "$current_town"),
            (party_get_num_companions, reg6, ":ship_no"),
            (party_get_num_companions, reg7, "p_main_party"),
            (val_add, reg7, reg6),
            (is_between, reg7, 30, 51),
            (party_set_slot, ":ship_no", slot_ship_center, ship_player_sailing), #Represents the player
            (party_set_slot, "p_main_party", slot_town_has_ship, ":ship_no"), #Records that the Player Party has this ship
            (assign, ":break", 1),
        (try_end),
        (eq, ":break", 1),        
        (party_set_slot, "$current_town", slot_town_has_ship, 0),
        (assign, "$g_player_icon_state", pis_ship),
        (party_set_flags, "p_main_party", pf_is_ship, 1),    
        (party_get_position, pos1, "p_main_party"),
        (party_get_slot, ":dist", "$current_town", slot_town_is_coastal),
        (val_add, ":dist", 2),
        (map_get_water_position_around_position, pos2, pos1, ":dist"),
        (party_set_position, "p_main_party", pos2),
        (assign, "$g_main_ship_party", -1),  #CABA - might also store the ship party ID here??
        (change_screen_return),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 2),
        (jump_to_menu, "mnu_choose_ship"), #CABA--move this to a presentation?
    (else_try),
        (display_message,"@You don't own a ship or your crew exceeds the boundaries."),
    (try_end),
     
    (try_begin),
        (party_slot_eq, "$current_town", slot_town_has_ship, 1),
        (assign, ":break", 0),
        (try_for_parties, ":ship_no"),
            (eq, ":break", 0),
            (party_slot_eq, ":ship_no", slot_party_type, spt_galley),
            (party_slot_eq, ":ship_no", slot_ship_center, "$current_town"),
            (party_get_num_companions, reg6, ":ship_no"),
            (party_get_num_companions, reg7, "p_main_party"),
            (val_add, reg7, reg6),
            (is_between, reg7, 40, 70),
            (party_set_slot, ":ship_no", slot_ship_center, ship_player_sailing), #Represents the player
            (party_set_slot, "p_main_party", slot_town_has_ship, ":ship_no"), #Records that the Player Party has this ship
            (assign, ":break", 1),
        (try_end),
        (eq, ":break", 1),        
        (party_set_slot, "$current_town", slot_town_has_ship, 0),
        (assign, "$g_player_icon_state", pis_galley),
        (party_set_flags, "p_main_party", pf_is_ship, 1),      
        (party_get_position, pos1, "p_main_party"),
        (party_get_slot, ":dist", "$current_town", slot_town_is_coastal),
        (val_add, ":dist", 2),
        (map_get_water_position_around_position, pos2, pos1, ":dist"),
        (party_set_position, "p_main_party", pos2),
        (assign, "$g_main_ship_party", -1),  #CABA - might also store the ship party ID here??
        (change_screen_return),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 2),
        (jump_to_menu, "mnu_choose_ship"), #CABA--move this to a presentation?
    (else_try),
        (display_message,"@You don't own a ship or your crew exceeds the boundaries."),
    (try_end),
     
    (try_begin),
        (party_slot_eq, "$current_town", slot_town_has_ship, 1),
        (assign, ":break", 0),
        (try_for_parties, ":ship_no"),
            (eq, ":break", 0),
            (party_slot_eq, ":ship_no", slot_party_type, spt_cog),
            (party_slot_eq, ":ship_no", slot_ship_center, "$current_town"),
            (party_get_num_companions, reg6, ":ship_no"),
            (party_get_num_companions, reg7, "p_main_party"),
            (val_add, reg7, reg6),
            (is_between, reg7, 20, 40),
            (party_set_slot, ":ship_no", slot_ship_center, ship_player_sailing), #Represents the player
            (party_set_slot, "p_main_party", slot_town_has_ship, ":ship_no"), #Records that the Player Party has this ship
            (assign, ":break", 1),
        (try_end),
        (eq, ":break", 1),        
        (party_set_slot, "$current_town", slot_town_has_ship, 0),
        (assign, "$g_player_icon_state", pis_cog),
        (party_set_flags, "p_main_party", pf_is_ship, 1),
        (party_get_position, pos1, "p_main_party"),
        (party_get_slot, ":dist", "$current_town", slot_town_is_coastal),
        (val_add, ":dist", 2),
        (map_get_water_position_around_position, pos2, pos1, ":dist"),
        (party_set_position, "p_main_party", pos2),
        (assign, "$g_main_ship_party", -1),  #CABA - might also store the ship party ID here??
        (change_screen_return),
    (else_try),
        (party_slot_ge, "$current_town", slot_town_has_ship, 2),
        (jump_to_menu, "mnu_choose_ship"), #CABA--move this to a presentation?
    (else_try),
        (display_message,"@You don't own a ship or your crew exceeds the boundaries."),
    (try_end),
    ]),
       
    ("manage_ships",
    [],
    "Manage ships.",
    [    (assign, reg6, -1),
        (assign, reg8, -1),
        (str_clear, s11),
        (str_clear, s12),
        (str_clear, s14),
        (start_presentation, "prsnt_manage_ships"),
    ]),
 
    ("View_notes",
    [],
    "View the ship registry.",
    [(jump_to_menu, "mnu_ship_notes"),
    ]),
 
    ("back_to_town_menu",
    [],
    "Head back.",
    [(jump_to_menu,"mnu_town"),
    ]),
    ]),

And because of what these 2 problems I can not figure it out in any way
 
Last edited:
Upvote 0
Thank you all for your help, I was able to register 3 types of ships with the correct ship icon in the voyage. Unfortunately, the issue of changing the icon at rest when disembarking or at a stop has not yet been resolved

mb72.jpg
mb73.jpg
mb74.jpg
mb75.jpg
mb77.jpg
mb78.jpg
mb80.jpg
mb81.jpg
mb82.jpg
mb83.jpg
mb85.jpg
mb86.jpg
 
Upvote 0
Back
Top Bottom