# AI scripting: Herders are not included in the \`villager-food\` set

**URL:** <https://forums.ageofempires.com/t/ai-scripting-herders-are-not-included-in-the-villager-food-set/276670>\
**Category:** II - Report a Bug\
**Created:** [June 28, 2025, 1:15pm UTC](https://forums.ageofempires.com/t/ai-scripting-herders-are-not-included-in-the-villager-food-set/276670 "2025-06-28T13:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Super-Skurken](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/super-skurken/32/142158_2.png) [@Super-Skurken](https://forums.ageofempires.com/u/Super-Skurken)\
**Post date:** [June 28, 2025, 1:15pm UTC](https://forums.ageofempires.com/t/ai-scripting-herders-are-not-included-in-the-villager-food-set/276670/1 "2025-06-28T13:15:31Z")

</div>

### ▶ GAME INFORMATION

👇 _These details are CRITICAL; DO NOT skip them or your issue may not be reviewed._

- **GAME BUILD #:** 18848918
- **GAME PLATFORM:** Steam
- **OPERATING SYSTEM:** Windows 11

### ▶ ISSUE EXPERIENCED

`villager-food` is a handy set to use for roughly counting or selecting all food villagers. It should obviously include the new herders that work on animals on pastures, but it does not! Note, however, that the villager counts in the resource bar are correct.

### ▶ FREQUENCY OF ISSUE

👇 _How often does the issue occur?_

- **100%** of the time / matches I play (ALWAYS)

### ▶ REPRODUCTION STEPS

To verify the issue, simply add the following snippet to a working Khitans AI, making sure to first define `gl-1` to a vacant goal ID and define the missing herder constants (1891 and 1892) and `KHITANS-CIV`:

```auto
#load-if-defined KHITANS-CIV
	(defrule
		(true)
	=>
		(up-get-fact unit-type-count villager-food gl-1)
		(up-modify-goal gl-1 c:max 0)
		(up-chat-data-to-self "villager-food: %d" g: gl-1)
		(up-get-fact unit-type-count female-herder gl-1)
		(up-modify-goal gl-1 c:max 0)
		(up-get-fact unit-type-count male-herder gl-2)
		(up-modify-goal gl-1 c:max 0)
		(up-modify-goal gl-1 g:+ gl-2)
		(up-chat-data-to-self "herders: %d" g: gl-1)
		(set-goal gl-1 -1)
		(set-goal gl-2 -1)
	)
#end-if

```

Once food economy has made the transition over to pastures, `villager-food` will go to (or near) zero, while the number of herders keeps growing.

### ▶ EXPECTED RESULT

👇 _What was SUPPOSED to happen if the bug you encountered were not present?_

The expected outcome would be convergence of the numbers, since herders should be included in `villager-food` and should over time dominate the food villager population.

### ▶ IMAGE

👇 _ALWAYS attach a PICTURE (.jpg, .png, .gif) or VIDEO (.mp4, YouTube link) that highlights the problem._

 ![image](https://forums.ageofempires.com/uploads/default/original/3X/d/8/d8fd5814d71dd8225d40af045cea3febb4457d4f.jpeg)  
 ![image](https://forums.ageofempires.com/uploads/default/original/3X/5/1/51aed9d1a9b7a609a0a686d8e814ebc35b819e1a.png)

### ▶ GAME FILES (SAVE / RECORDING)

👇 _Attach a SAVE GAME (.aoe2spgame) or GAME RECORDING (.aoe2record) of the match where you encountered the issue. Link it below if using an external file service._  
[SP Replay v101.103.16877.0 @2025.06.28 150709.aoe2record](https://forums.ageofempires.com/uploads/short-url/2lcr5w6wcyorrip5OW37QtX4006.aoe2record) (1.5 MB)  
The problem appears clearly towards the end of the recording.

(I am sorry about the not very optimized build order, although I know the rough idea has potential, especially with Goths on maps with deer that can be pushed in en masse, justifying the early barracks and late mill.)  
\*

---

<div class="post-metadata">

**Author:** ![Super-Skurken](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/super-skurken/32/142158_2.png) [@Super-Skurken](https://forums.ageofempires.com/u/Super-Skurken)\
**Post date:** [June 28, 2025, 1:36pm UTC](https://forums.ageofempires.com/t/ai-scripting-herders-are-not-included-in-the-villager-food-set/276670/2 "2025-06-28T13:36:55Z")

</div>

A bonus to the fix would be if you could also add a `villager-herder` set that combines the two herder IDs. (While we’re at it, I wouldn’t exactly hate a `wild-chicken` set either, since they typically need separate treatment from pushable huntables in the deer class.)

---

<div class="post-metadata">

**Author:** ![Super-Skurken](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/super-skurken/32/142158_2.png) [@Super-Skurken](https://forums.ageofempires.com/u/Super-Skurken)\
**Post date:** [October 15, 2025, 12:50pm UTC](https://forums.ageofempires.com/t/ai-scripting-herders-are-not-included-in-the-villager-food-set/276670/3 "2025-10-15T12:50:17Z")

</div>

The latest patch notes claim that this issue has been fixed. I assume that this is the case.

What remains is the feature request for `villager-herder`.
