# Ai question

**URL:** <https://forums.ageofempires.com/t/ai-question/248851>\
**Category:** II - Ask for Help\
**Created:** [February 13, 2024, 6:15pm UTC](https://forums.ageofempires.com/t/ai-question/248851 "2024-02-13T18:15:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamePorpoise303](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/sameporpoise303/32/29498_2.png) [@SamePorpoise303](https://forums.ageofempires.com/u/SamePorpoise303)\
**Post date:** [February 13, 2024, 6:15pm UTC](https://forums.ageofempires.com/t/ai-question/248851/1 "2024-02-13T18:15:05Z")

</div>

Dumb question probably (and hopefully!) but I’m an AI noob so how to tell the AI to attack (if enemy) or defend (if ally) where the human player has a market? What is the coding line needed? Also since we’re here how to tell them to attack/defend where signaled?

---

<div class="post-metadata">

**Author:** ![CanineCrown7153](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/caninecrown7153/32/107446_2.png) [@CanineCrown7153](https://forums.ageofempires.com/u/CanineCrown7153)\
**Post date:** [February 14, 2024, 3:36am UTC](https://forums.ageofempires.com/t/ai-question/248851/2 "2024-02-14T03:36:34Z")

</div>

This guide is exactly what you want. It targets a villager to a tree close to a lumbercamp. You want to target military units to a market, which I suppose it can be anywhere on the map .  
[https://airef.github.io/duc/articles/enmipho-intro-to-duc.html](https://airef.github.io/duc/articles/enmipho-intro-to-duc.html)

If you don’t have much experience with AI scripting, try to follow some easy examples, like this one  
[https://aok.heavengames.com/university/other/world-of-ai-scripting-chapter-1/](https://aok.heavengames.com/university/other/world-of-ai-scripting-chapter-1/)

Having made that tutorial, you can follow with the official AI AoE2 document, which is in the AoE2DE\Docs\All folder and it’s called ‘TC CP Strategy Builder.doc’

If you have any doubt, try asking at the UGC discord

> **[Join the All About UGC Discord Server!](https://discord.com/invite/W76GZcur)**
>
> Check out the All About UGC community on Discord - hang out with 92 other members and enjoy free voice and text chat.

or at the aiscripters discord

> **[Join the AI Scripters Discord Server!](https://discord.com/invite/ThQQDKxg)**
>
> Check out the AI Scripters community on Discord - hang out with 1069 other members and enjoy free voice and text chat.

Unrelated, but I asked about adding food with triggers and XS to wolves and sheeps at the UGC discord and it seems it’s bugged

---

<div class="post-metadata">

**Author:** ![SamePorpoise303](https://forums.ageofempires.com/user_avatar/forums.ageofempires.com/sameporpoise303/32/29498_2.png) [@SamePorpoise303](https://forums.ageofempires.com/u/SamePorpoise303)\
**Post date:** [February 14, 2024, 5:08am UTC](https://forums.ageofempires.com/t/ai-question/248851/3 "2024-02-14T05:08:37Z")

</div>

Thank you very much, I’m gonna look at the guides you posted and see if I can work it out!
