In "Smuggling for Thomas O'Reily", assuming you chose to stick with him rather than give in to the smuggler gang on the beach, you end up having to capture a ship. You've probably just left Port Royale port. So you're near the fort, and so is the smuggler's ship, which is flying a pirate flag. If you don't get into position to board it really quickly (and if you don't have the "Instant Boarding" perk), the fort will soon sink the ship.
Suggestion: give the ship a Personal flag instead. That should mean its relations are the same as yours. If you're friendly to Britain, the fort won't fire on the ship. If you're not, either you're moored at a beach, or you're in a battleship and got into port by destroying the fort - either way, the fort won't fire on the ship. Also set both the "recognized" and "skipRM" attributes for the captain, so he will attack you and there shouldn't be any weirdness resulting from you sinking or capturing a "Personal" ship.
Suggestion: give the ship a Personal flag instead. That should mean its relations are the same as yours. If you're friendly to Britain, the fort won't fire on the ship. If you're not, either you're moored at a beach, or you're in a battleship and got into port by destroying the fort - either way, the fort won't fire on the ship. Also set both the "recognized" and "skipRM" attributes for the captain, so he will attack you and there shouldn't be any weirdness resulting from you sinking or capturing a "Personal" ship.