Well, for one, you should definitely take a look at some of the AI scripts in module_scripts.
You should also set a slot for towns that have ports. (something like "slot_town_has_port")
Also, maybe create some new AI states.
While you're at it, you should create some invisible parties on the ocean to serve as navigation guide points for the lord-ship-parties.
Here's some concept scripting I whipped up in a moment of blind passion and fury; you can try applying it to some of the AI scripts. No guarantee it'll work.
# script_party_set_ai_state
# Input: arg1 = party_no, arg2 = new_ai_state, arg3 = action_object (if necessary)
# Output: none (Can fail)
(party_get_attached_to, ":attached_to_party", ":party_no"),
(assign, ":party_is_in_town", 0),
(try_begin),
(is_between, ":attached_to_party", centers_begin, centers_end),
(assign, ":party_is_in_town", ":attached_to_party"),
(try_end),
(assign ":party_is_in_port", 0),
(try_begin),
(party_slot_eq, ":attached_to_party", slot_town_has_port, 1),
(assign ":party_is_in_port", 1),
(try_end),
...
(else_try),
(eq, ":new_ai_state", spai_sail_from_port), #or something.
(eq, ":party_is_in_port", 1),
(party_get_position, pos1, ":party_no"),
(map_get_water_position_around_position, pos2, pos1, 6),
(party_set_position, ":party_no", pos2),
(party_set_icon, "party_no", "icon_ship"),
(party_set_ai_patrol_radius, ":party_no", 5),
(try_end),
When it comes to the AI on the water and disembarking, that's when you've got to create some invisible parties floating on the water to serve as location points to help navigation and movement.
Hopefully someone will find my mad outburst to be somewhat enlightening/helpful.