Why are the attackers attacking the town? I like military-style campaigns, and I like well-motivated antagonists, whose goal is not "get killed for XP and donate their gear to the PC's", but something a little more in their own interests!
Figure out why the attack is happening, and you're on your way to crafting an adventure. Some possibilities:
-- "Gun Boat Diplomacy" -- It's a murder raid to punish the town for something it did. Most likely, since your PC's are pirates, it's to punish the town for hosting pirates, and specifically for hosting the PC's.
-- "Protectorate" -- The goal is to make the local ruler knuckle under and surrender to colonization by the invaders. Their goal is either to kidnap the grandee, steal something that matters to him, or kill a lot of people and destroy a lot of stuff to make him lose face.
-- "Conquest" -- The goal is remove the local rulers and replace them with new rulers. The mission is to kill or drive the military and the ruler(s).
-- "Overlord" -- The goal of the invasion is to remove the evil foreigners who rule the town. The invaders are the good guys.
-- "Rescue Mission" -- The attackers are trying to free some of their own who are being held prisoner, or free slaves or kidnap victims held in the town.
-- "Viking raid" -- The goal of the raid is money. They are happy to bribed to leave, to steal anything that isn't nailed down, or take hostages.
-- "Slavers" -- The goal is to take slaves.
-- "Hostile takeover" -- The goal of the raid is to steal ships or otherwise horn in on local trade/resources.
-- "Hit and Run" -- The goal of the raid is to destroy resources and eliminate personnel. This is a good goal for a force that's strong enough to win with surprise and concentrated forces, but can't stand and fight -- a guerrilla force.
-- "Pre-emptive Strike" -- The goal of the raid is to destroy resources and eliminate personnel that were being readied for an attack on the attackers.