Characters armed with melee weapons (or with sufficiently dangerous natural weapons) threaten an area around them. If they can attack into it, they threaten it, provided that they're not otherwise incapacitated or caught off guard. When an opponent lets their guard down in an area threatened by an enemy, that enemy may be entitled to an Attack of Opportunity. This is a free attack at the opportunistic character's full Attack Bonus, and characters are typically limited to one Attack of Opportunity per round.
A variety of actions provoke Attacks of Opportunity, including moving out of - but not into - threatened areas, attacking an armed character while unarmed, casting spells or shooting ranged weapons in melee combat, standing up from prone, drinking a potion or using a scroll. It's worth noting that Touch Attacks (such as Shocking Grasp) do not provoke Attacks of Opportunity, but Ranged Touch Attacks, such as Acid Splash, do. Spellcasters can choose to Cast Defensively (in fact, in Pathfinder: Kingmaker, it's automatically assumed you're casting defensively) to avoid provoking an Attack of Opportunity. This isn't guaranteed, however, as casters must succeed at a Concentration check (DC 15) to avoid provoking an Attack of Opportunity. A variety of feats exist to mitigate Attacks of Opportunity in various circumstances.
|Common Actions that Provoke Attacks of Opportunity|
|Attack (spell, touch)*|
|Attack (spell, ranged touch)*|
|Cast a spell*|
|Drink a potion|
|Move into threatened area**|
|Move out of threatened area**|
|Stand from prone position|
|Use a scroll|
*Casting a Quickened spell does not provoke an Attack of Opportunity.
*While making a Touch Attack with a spell may not provoke an Attack of Opportunity, casting the spell itself might.
*Casters automatically attempt to cast defensively, if they pass a Concentration (DC 15) check, they do not provoke an Attack of Opportunity while casting.
**Taking a Five-Foot Step doesn't provoke an Attack of Opportunity.
**Characters will automatically attempt a Mobility (DC 15) check to move out of threatened areas without provoking an Attack of Opportunity.
In most cases, Attacks of Opportunity can be avoided by knowing the rules and playing smart. If you keep your archers and casters out of reach and don't try to heal in areas threatened by enemies you'll avoid most preventable Attacks of Opportunity. Other scenarios are harder to avoid, namely moving out of a threatened area. Sometimes the risk is worth the reward, for example when you want to flank an enemy. This is best done with a character with a high Mobility score, as they can perform an Acrobatics check (Mobility DC 15) to move out of threatened areas without provoking an Attack of Opportunity. This must be manually selected, and can be found in the abilities tab above the action bar. While Acrobatics is active, the character will move at half speed.
Larger creatures or enemies employing weapons with reach (or both!) threaten more areas, making it harder to attack them without provoking an Attack of Opportunity. After all, if a medium-sized creature threatens a five-foot radius and a large-sized creature threatens a ten-foot radius, the former will have to move through a threatened area to even reach the larger opponent. Aside from engaging a character using Acrobatics (who may not be the most well-protected, due to their presumably lighter armor) Five-Foot Steps do not provoke Attacks of Opportunity. This allows a character to manuever safely (albeit slowly) through an opponent's threatened area in order to engage - or flank - them.