[Pathfinder 2e] Monster AI | Designing Skirmisher

This is a detailed example of skirmisher creature Monster AI creation for Pathfinder 2e system.

For the full instruction of how to make Monster AI for Pathfinder 2E system, please refer to article here. For all the articles related to Pathfinder 2e monster AI, please refer to the main page.

Skirmisher

Higher Speed than typical

One of the key trait for this group is that these creatures have higher speed. Three action system with higher speed than other creatures allow these creature to perform hit & run tactics even without special encounter action. This is particularly valid because in Pathfinder 2E, creatures do not have capability of reaction attack by default.

Skirmisher’s primary tactics is melee hit & run

The benefit of this tactics can be viewed from what I call productive net action. Productive actions are defined as non-movement i.e. potential damaging or other board condition changing actions.

For hit & run tactics, these monster generally have two scenarios to deal with.

  1. Starting its turn with PC next to it.
  2. Starting its turn away from PC.

With the first scenario, skirmisher can attack twice and retreat. Given it having higher speed than average PC, if it takes a full stride distance, PC wanting to melee attack this creature require to spend two actions to close the gap. So the PC can only have 1 attack chance in subsequent turn. The skirmisher can do the same again so another 2 attacks. Therefore, with this scenario skirmisher gets 4 productive actions in two consecutive turns while PC would have only 2 productive actions.

In the second scenario, skirmisher uses its first action to close the gap then attack and retreat. So 1 productive action this turn. Following this, if PC tries to close the gap just as the first scenario, PC can get only 1 productive action. If PC decides to ignore and deal with another creature and keeping its current position, PC actually has 0 productive action against this skirmisher.

Hit & run tactics can be elegantly coded as below.

Until this reaches to 🎯: 👣 Stride
While action is available:
 	Melee Strike⚔️ jaws
 	3️⃣ If attacked at least once: Stride📍[retreat]

For this exact purpose, I have created action # syntax.

As a user of this AI, 3️⃣ under the while loop should get your attention. This indicates on the monster’s third action, whatever follows execute. Another way to look is if it first or second action, you don’t even need to look at the line.

The line has if the condition. It is basically checking, the monster has at least used one jaws strike and has a place to retreat. If so, it uses the third action for retreating.

This prevents situation like move, move and retreat, which is clearly wrong thing to do for the monster. This also tells monster to just use all 3 actions for jaws attack when its cornered.

Smarter Variant

Smarter creatures should be able to adopt when its tactics are not working as intended. For the case of hit & run, attack of opportunity is a paradigmatic example. If the creature have high enough intelligence, it will use “step” action to avoid giving the target another attack chance.

If 🎯 has attack of opportunity:
  If in ⚔️ combat: ⚔️ jaws ➡️ 👣 (step) ➡️ retreat
  else: 👣 (stride) ➡️ ⚔️ jaws ➡️ 👣 (step)

This will reduce potential number of attack advantage the monster gets, but skirmisher should prefer longer fight over rushing to finish the game at the risk of giving more chance for PC to hit it. In melee combat, it will be 1 attack/turn for both the monster and PC i.e. net neutral. If it ignored and try hitting PC twice and then take regular retreat movement, it gets 2 attack/turn but so does PC with its attack opportunity. This is still net neutral but the game will end faster. For the case of starting at distance, it will be 1:2 attack per turn and again letting PC do attack of opportunity will end the game sooner.

Another layer of distinguishing smarter AI is to look at actual speed of the target and monster itself. The benefit of the hit & run tactics happens only when the monster has higher speed than the target. So one can consider incorporating this as part of special tactics.

For the both cases, we should keep thematic coherence. To me, normal monsters figuring out the speed of a PC or even the capability of the PC be able to do attack of opportunity at first glance does not make sense.

Examples

Boar

For the creature’s stat block, please refer to Archives of Nethys.

Boar’s signature move is Boar charge. For two actions, it can move up to 80 feet (2 strides) and a strike. When the movement is at least 20ft, it gains a +2 circumstance bonus to its attack roll.

In addition to standard, hit & run tactics, this has a reaction “Ferocity”. Reactions are part of stat block and strictly speaking it is not necessary part of AI but I felt it is good to put in AI as a reminder when reaction triggers.

This can be depicted as below.

When HP becomes 0: Ferocity
If this is wounded: pastedGraphic_1.pngflee

Giant Rat

For giant rat stat block, please refer to Archives of Nethys.

This is a prototypical skirmisher. The creature’s stat contour with high dexterity and higher than average speed, unequivocally makes it “skirmisher”. Given it has only a single mode of attack, this is the most straight forward version of skirmisher.

Giant Centipedes

For the stat block of this creature, please refer to Archives of Nethys.

From AI stand point, this is identical to the Giant Rat.

Kobold Warrior

For the Kobold Warrior stat block, please refer to Archives of Nethys.

Stat contour with high dexterity indicates Kobold warrior to be skirmisher. This is supported by situational, speed advantage with Hurried Retreat ability.

Above statement from official guide also supports this.

Key Design Decisions

Sneak Attack = Flanking Tactics

The sneak attack passive ability triggers with flat-footed condition.

Flat-Footed

You’re distracted or otherwise unable to focus your full attention on defense. You take a –2 circumstance penalty to AC. Some effects give you the flat-footed condition only to certain creatures or against certain attacks. Othersespecially conditions—can make you universally flatfooted against everything. If a rule doesn’t specify that the condition applies only to certain circumstances, it applies to all of them; for example, many effects simply say “The target is flat-footed.”

Core Rulebook p620

Flanking

When you and an ally are flanking a foe, it has a harder time defending against you. A creature is flat-footed (taking a –2 circumstance penalty to AC) to creatures that are flanking it.

To flank a foe, you and your ally must be on opposite sides of the creature.

Core Rulebook p476

they often set up ambushes or hit-and-run assaults that allow them to do the most damage possible without being harmed in return.

Bestiary volume 1 page 212

Based on the two rules above, Kobold Warrior use flanking as part its core tactics. This is coded by adding criteria in the target and melee position sections.

🎯 In 2 strides range > another ally gather > Closest > flanked by this > Most wounded
📍[melee] flanking

Throwing Spear?

Based on all other parts pointing kobold as hit & run skirmisher, there is no surprise but I did perform average damage analysis.

Spear is substantially better than the sling option. In fact, sling having reload 1, it won’t even have real third action option.

The challenge here to me was deciding what to do with spear (ranged) option. Throwing it is one time action so it is certainly lower average damage/turn potential than multiple spear attacks in melee.

From the max average damage per turn perspective, spear (melee)[2.6] + spear (melee)[1.6] followed by spear (ranged) [1] give 5.2. However, losing spear forces it to switch to ranged next turn, which is less efficient.

After consulting reddit forum, I came up with two valid use case scenarios:

  1. Kobold believes it won’t have melee combat again.
  2. Kobold believes it won’t have next turn and no option to flee. So it uses this as if the last word.

The first scenario is hard to predict. The latter case on the other hand can be coded as below.

If HP≤3 & unable to flee:
 	While action is available & spear is available: ⚔️spear + 3️⃣ 🏹 spear
        Swap to sling (2 actions) ➡️ Use ranged attack tactics

Above block executes on heavily injured state (defined as >60% max HP damage) and not able to flee. The first line in the block says use as many melee spear as possible before throwing it. The second line says if it gets lucky enough and surviving following turn, it needs to switch to ranged tactics since it no longer has spear to use for melee attack. This would mean it will use slings but from suboptimal, likely in the melee range.

Giant Spider

Giant spider is an original monster in the beginner’s kit.

Key design decisions

Skirmisher or Sniper?

Giant spider from beginner’s kit is a good example that not everything follows textbook. Stat contour analysis says this is a high dexterity, high AC creature.

The creature has ranged strike option so at first this would look like a sniper, but the ranged strike itself does not inflict any damage to the target. So primary means of damaging the target is melee strike.

On the other hand, at the first glance, it does not have the classic “higher than typical speed” as a skirmisher.

However, web trap essentially makes the affected target speed down to 0. So the ranged attack is really a setup of getting “speed advantage”.

Therefore, giant spider is a skirmisher.

Web Trap + Hit & Run

In order for this to be able to use hit & run tactics, it needs to first use its ranged attack (web trap). Only after that setup, it can use hit & run.

This can be elegantly coded as followings:

If 🎯 is not Web Trap:
	Until this reaches to 📍(web): 👣 (stride)
	Until 🎯 is Web Trap: 🏹 web
Until this reaches to 🎯: 👣 (stride)
While action is available: ⚔️ fangs
If this has space to retreat: 3️⃣ 📍(retreat) 

The last 3 lines are essentially same as Giant Rat. The difference is If condition before these lines.

These codes will cover several situations.

Scenario 1: Web, attack and retreat

Scenario 2: Reach (move), attack and retreat

Scenario 3: Starting adjacent to target who is web trapped – attack, attack and retreat

Scenario 4: Starting adjacent to target who is not web trapped – web, attack and reach

Given its web is a ranged attack, I need to define optional ranged attack position [📍(web)]. In Pathfinder 2E system, ranged attack does not have universal penalty. From attacker side, web does not have any penalty. If target has attack of opportunity, using ranged attack adjacent to the target will trigger the counter attack. However, going back to golden rule #1 of Monster AI, “View from Monster’s perspective“, the spider would not know if target has such capability. So it would use web ranged strike even if it were next to the target. Therefore, the optimal position is:

📍(web) ≤30ft from 🎯