Just an FYI. It can be either..
Gunnery Check = 1d20 + the gunner’s base attack bonus or the gunner’s ranks in the Piloting skill + the gunner’s Dexterity modifier + bonuses from computer systems + bonuses from the captain and science officers + range penalty
https://www.aonsrd.com/Rules.aspx?ID=199
madman..