For a melee attack: Your ability modifier would be your Strength modifier unless you have Weapon Finesse and your Dexterity modifier is greater than your Strength modifier, in which case you would use your Dexterity modifier instead.
For a ranged attack: Your ability modifier would be your Dexterity modifier unless you have Zen Archery and your Wisdom modifier is greater than your Dexterity modifier, in which case you would use your Wisdom modifier instead.
†=For player characters the Small stature feat notes the size modifier for small PCs and grants a +1 to hit. However creatures have their size set by their appearance and that reflects the bonus or penalty they recieve.
+20 AB capEdit
There is an engine enforced cap of +20 to bonuses from feats and spells. However there are some bonuses that do not count towards this cap.
Things that do count towards the cap:
- Attack bonuses on weapons
- Enhancement bonuses on weapons (including enhancement bonuses from spells like Holy Sword and (Greater) Magic Weapon)
- True Strike
- (Greater/Mass) Reduce Person/Reduce Animal
- (Mass) Snake’s Swiftness
- Haste (and all those spell like abilties that grant Haste)
- (Greater) Heroism
- Tenser's Transformation
- War Cry
- Inspire Courage
- Divine Favor
- (Mass) Aid
- (Greater) Magic Fang
- Nature's Avatar
- Divine wrath
- Battle Master
Things that do not count towards the cap:
- Ability modifier bonus to AB
- Weapon Focus
- Greater Weapon Focus
- Epic Weapon Focus
- Superior Weapon Focus
- Epic Prowess
- Bane of Enemies
- Small stature/Size modifier to AB
- Good Aim
- Eldritch Master
- Charisma modifier added during smites (Smite Good, Smite Evil, Smite Infidel)
- Stormlord Enhanced Weapon bonus
- Arcane Archer Enhance Arrows bonus
- Circumstantial Bonuses
Abilities like Divine Power and Legionnaire's march increase BAB instead of AB and do not count towards the cap. Community feats (such as from Kaedrin's PrC Pack) are considered magic bonuses and count towards the cap.