Community Forums > Games > Age of Empires II: The Conquerors > Random Map > This ai refuse to go to castle age and he take 2 attack sentence to us

This ai refuse to go to castle age and he take 2 attack sentence to us

 [_Tiger_]Mannco


Group: Standard Membership
Join Date: 27 April 2017
Posts:22
Edited 21 November 2019 - 1:27 am by [_Tiger_]Mannco
Hello I need your Help for 2 things my ai refuse to upgrade to castleby himselft age and take 2 attack sentence to use transport ship one for carry soldier then send the transport ship after long research on internet and migraine I giving up please somebody help me


;
;Knight
;
;Generated with AIBuilder

;This ai is meant for campaigns only. It's able to create units, research techs and attack. It also has some economic activity but not really enough to support the AI so it's possible to cheat to make up for the missing economic activity.


;***Set Constants***
;---GENERAL---
(defconst yes 1)
(defconst no 0)
(defconst aisignal 0)

;---GOALS---
(defconst unit1 spearman-line)
(defconst unit2 scout-cavalry-line)
(defconst unit3 knight-line)
(defconst unit4 skirmisher-line)
(defconst unit5 archer-line)
(defconst unit6 my-unique-unit-line)
(defconst unit7 militiaman-line)
(defconst siege1 scorpion-line)
(defconst siege2 mangonel-line)
(defconst siege3 battering-ram-line)
(defconst naval1 transport-ship)
(defconst naval2 galley-line)
(defconst naval3 fire-ship-line)
(defconst blacksmith-techs 5)
(defconst military-techs 6)
(defconst economic-techs 7)
(defconst university-techs 8)
(defconst monastery-techs 9)
(defconst dock-techs 10)
(defconst build-houses 11)
(defconst end-age 12)
(defconst allow-cheats 13)
(defconst use-market 14)
(defconst default-resign 15)
(defconst allow-advancing 16)
(defconst allow-signal 17)
(defconst active-at-start 18)
(defconst activate 19)
(defconst combi 20)

;---ATTACKS---
(defconst attack-timer 2)
(defconst interval-timer 3)
(defconst standby 0)
(defconst offence 1)
(defconst reset-attack 2)
(defconst attack-goal 3)

;---UPGRADES---
(defconst food-escrow 100)
(defconst wood-escrow 100)
(defconst gold-escrow 100)
(defconst stone-escrow 100)

;---OTHERS---
(defconst percentage-builders 5)
(defconst percentage-gatherers 95)
(defconst percentage-explorers 2)
(defconst food-gatherers 40)
(defconst wood-gatherers 30)
(defconst gold-gatherers 20)
(defconst stone-gatherers 10)
(defconst end-feudal 1)
(defconst end-castle 2)
(defconst end-imperial 3)
(defconst task-soldiers yes)

;---Amounts---
(defconst amount-farms 10)
(defconst amount-villagers 60)
(defconst amount-traders 0)
(defconst amount-sea-traders 0)
(defconst amount-fishing-ships 20)
(defconst amount-town-centers 1)
(defconst amount-lumber-camps 5)
(defconst amount-mills 1)
(defconst amount-mining-camp-gold 4)
(defconst amount-mining-camp-stone 2)
(defconst amount-barracks 4)
(defconst amount-archery-ranges 4)
(defconst amount-stables 5)
(defconst amount-siege-workshops 2)
(defconst amount-docks 1)
(defconst amount-universities 1)
(defconst amount-blacksmiths 1)
(defconst amount-markets 1)
(defconst amount-monasteries 1)
(defconst amount-castles 2)
(defconst amount-towers 10)
(defconst amount-bombard-towers 0)


;***Set Goals***
;---Upgrades---

(defrule
(true)
=>
(set-goal economic-techs yes)
(set-goal military-techs yes)
(set-goal blacksmith-techs yes)
(set-goal university-techs yes)
(set-goal monastery-techs yes)
(set-goal dock-techs yes)
(disable-self)
)

;---General---

(defrule
(true)
=>
(set-goal allow-advancing yes)
(set-goal build-houses yes)
(set-goal end-age end-castle)
(set-goal use-market no)
(set-goal allow-cheats no)
(set-goal default-resign no)
(set-goal allow-signal 0)
(set-goal active-at-start 1)
(disable-self)
)

;---Activation---
;when a signal is send or the AI is allowed to be active at start it will tell the AI to enable the activate goal. This goal will make the AI active. (Combi is for backwards compability)

(defrule
(or
(and
(event-detected trigger aisignal)
(goal allow-signal yes)
)
(goal active-at-start yes)
)
=>
(set-goal activate yes)
(set-goal combi yes)
(disable-self)
)


;***Setup***
;---Load Externals---
;load extra files. These files are generic and take care of the resigning of the AI, its upgrades and the active use of the market.

(load "builder resign")
(load "builder upgrades")
(load "builder market")

;---Immobile Behaviour---
;default behaviour is set to immobile

(defrule
(goal active-at-start no)
=>
(set-strategic-number sn-maximum-food-drop-distance 0)
(set-strategic-number sn-maximum-wood-drop-distance 0)
(set-strategic-number sn-maximum-gold-drop-distance 0)
(set-strategic-number sn-maximum-hunt-drop-distance 0)
(set-strategic-number sn-maximum-stone-drop-distance 0)
(set-strategic-number sn-food-gatherer-percentage 0)
(set-strategic-number sn-wood-gatherer-percentage 0)
(set-strategic-number sn-gold-gatherer-percentage 0)
(set-strategic-number sn-stone-gatherer-percentage 0)
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-percent-civilian-explorers 0)
(disable-self)
)

(defrule
(goal active-at-start no)
=>
(set-strategic-number sn-defense-distance 20)
(set-strategic-number sn-sentry-distance 20)
(set-strategic-number sn-percent-enemy-sighted-response 100)
(set-strategic-number sn-number-explore-groups 0)
(set-strategic-number sn-percent-attack-soldiers 0)
(set-strategic-number sn-task-ungrouped-soldiers 0)
(set-strategic-number sn-number-attack-groups 0)
(set-strategic-number sn-enemy-sighted-response-distance 10)
(set-strategic-number sn-total-number-explorers 0)
(set-strategic-number sn-minimum-town-size 0)
(set-strategic-number sn-maximum-town-size 0)
(disable-self)
)

;---Active Behaviour---
;when activated the AI will begin to play

(defrule
(goal activate yes)
=>
(set-strategic-number sn-percent-civilian-builders percentage-builders)
(set-strategic-number sn-percent-civilian-gatherers percentage-gatherers)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-number-explore-groups 1)
(set-strategic-number sn-total-number-explorers percentage-explorers)
(set-strategic-number sn-food-gatherer-percentage food-gatherers)
(set-strategic-number sn-wood-gatherer-percentage wood-gatherers)
(set-strategic-number sn-gold-gatherer-percentage gold-gatherers)
(set-strategic-number sn-stone-gatherer-percentage stone-gatherers)
(disable-self)
)

(defrule
(goal activate yes)
=>
(set-strategic-number sn-maximum-hunt-drop-distance 30)
(set-strategic-number sn-mill-max-distance 30)
(set-strategic-number sn-maximum-gold-drop-distance 20)
(set-strategic-number sn-maximum-stone-drop-distance 20)
(set-strategic-number sn-maximum-food-drop-distance 10)
(set-strategic-number sn-maximum-wood-drop-distance 20)
(set-strategic-number sn-task-ungrouped-soldiers task-soldiers)
(disable-self)
)

;***AI Behaviour***
;
Dodging rules
;ability of the AI to dodge enemy missiles shot at them and maintaining distance when engaging with enemies. The lower the number how better they are at it.

(defrule
(difficulty == easiest)
=>
(set-difficulty-parameter ability-to-maintain-distance 90)
(set-difficulty-parameter ability-to-dodge-missiles 90)
(disable-self)
)

(defrule
(difficulty == easy)
=>
(set-difficulty-parameter ability-to-maintain-distance 70)
(set-difficulty-parameter ability-to-dodge-missiles 70)
(disable-self)
)

(defrule
(difficulty == moderate)
=>
(set-difficulty-parameter ability-to-maintain-distance 50)
(set-difficulty-parameter ability-to-dodge-missiles 50)
(disable-self)
)

(defrule
(difficulty == hard)
=>
(set-difficulty-parameter ability-to-maintain-distance 30)
(set-difficulty-parameter ability-to-dodge-missiles 30)
(disable-self)
)

(defrule
(difficulty == hardest)
=>
(set-difficulty-parameter ability-to-maintain-distance 0)
(set-difficulty-parameter ability-to-dodge-missiles 0)
(disable-self)
)

;***Production***
;---Homebase Stats---

(defrule
(goal activate yes)
=>
(set-strategic-number sn-maximum-town-size 15)
(set-strategic-number sn-camp-max-distance 20)
(set-strategic-number sn-mill-max-distance 30)
(set-strategic-number sn-percent-enemy-sighted-response 50)
(set-strategic-number sn-enemy-sighted-response-distance 15)
(set-strategic-number sn-blot-exploration-map 0)
(set-strategic-number sn-sentry-distance 20)
(disable-self)
)

;---Farming and Civilians---

(defrule
(goal activate yes)
(building-type-count-total farm less-than amount-farms)
(or
(building-type-count-total mill > 0)
(building-type-count-total town-center > 0)
)
(idle-farm-count <= 1)
(can-build farm)
=>
(build farm)
)

(defrule
(goal activate yes)
(unit-type-count-total villager < amount-villagers)
(can-train villager)
=>
(train villager)
)

(defrule
(goal activate yes)
(unit-type-count-total trade-cart < amount-traders)
(can-train trade-cart)
=>
(train trade-cart)
)

(defrule
(goal activate yes)
(unit-type-count-total trade-cog < amount-sea-traders)
(can-train trade-cog)
=>
(train trade-cog)
)

(defrule
(goal activate yes)
(unit-type-count-total fishing-ship < amount-fishing-ships)
(dropsite-min-distance food < 20)
(can-train fishing-ship)
=>
(train fishing-ship)
)

;---Economic Buildings---

(defrule
(goal activate yes)
(building-type-count-total town-center < amount-town-centers)
(can-build town-center)
=>
(build town-center)
)

(defrule
(goal activate yes)
(housing-headroom less-than 4)
(population-headroom greater-than 0)
(can-build house)
(goal build-houses 1)
=>
(build house)
)

(defrule
(goal activate yes)
(resource-found wood)
(dropsite-min-distance wood > 4)
(building-type-count-total lumber-camp < amount-lumber-camps)
(can-build lumber-camp)
=>
(build lumber-camp)
)

(defrule
(goal activate yes)
(building-type-count-total mill < amount-mills)
(dropsite-min-distance food > 5)
(can-build mill)
=>
(build mill)
)

(defrule
(goal activate yes)
(resource-found gold)
(building-type-count-total mining-camp < amount-mining-camp-gold)
(dropsite-min-distance gold > 5)
(can-build mining-camp)
=>
(build mining-camp)
)

(defrule
(goal activate yes)
(resource-found stone)
(building-type-count-total mining-camp < amount-mining-camp-stone)
(dropsite-min-distance stone > 5)
(can-build mining-camp)
=>
(build mining-camp)
)

;---Military and Research Buildings---

(defrule
(goal activate yes)
(building-type-count-total barracks < amount-barracks)
(can-build barracks)
=>
(build barracks)
)

(defrule
(goal activate yes)
(building-type-count-total archery-range < amount-archery-ranges)
(can-build archery-range)
=>
(build archery-range)
)

(defrule
(goal activate yes)
(building-type-count-total stable < amount-stables)
(can-build stable)
=>
(build stable)
)

(defrule
(goal activate yes)
(building-type-count-total siege-workshop < amount-siege-workshops)
(can-build siege-workshop)
=>
(build siege-workshop)
)

(defrule
(goal activate yes)
(building-type-count-total dock < amount-docks)
(can-build dock)
=>
(build dock)
)

(defrule
(goal activate yes)
(building-type-count-total university < amount-universities)
(can-build university)
=>
(build university)
)

(defrule
(goal activate yes)
(building-type-count-total blacksmith < amount-blacksmiths)
(can-build blacksmith)
=>
(build blacksmith)
)

(defrule
(goal activate yes)
(building-type-count-total market < amount-markets)
(can-build market)
=>
(build market)
)

(defrule
(goal activate yes)
(building-type-count-total monastery < amount-monasteries)
(can-build monastery)
=>
(build monastery)
)

(defrule
(goal activate yes)
(building-type-count-total castle < amount-castles)
(can-build castle)
=>
(build castle)
)

(defrule
(goal activate yes)
(building-type-count-total watch-tower-line < amount-towers)
(can-build watch-tower-line)
=>
(build watch-tower-line)
)

(defrule
(goal activate yes)
(building-type-count-total bombard-tower < amount-bombard-towers)
(can-build bombard-tower)
=>
(build bombard-tower)
)

;***Assault rules***
;---Assault stats---

(defrule
(goal activate yes)
=>
(set-strategic-number sn-do-not-scale-for-difficulty-level no)
(set-strategic-number sn-wall-targeting-mode no)
(disable-self)
)

;
Offence
;activate the first attack (the amount of time for this is represented by 600)

(defrule
(goal activate yes)
=>
(enable-timer attack-timer 600)
(set-goal attack-goal standby)
(disable-self)
)

;first attack is activated and a new timer (amount of time being 600) is enabled to already activate the next attack later on

(defrule
(timer-triggered attack-timer)
(goal attack-goal standby)
(military-population >= 10)
(defend-soldier-count >= 10)
(not (town-under-attack))
=>
(set-strategic-number sn-percent-enemy-sighted-response 60)
(set-strategic-number sn-enemy-sighted-response-distance 40)
(set-goal attack-goal offence)
(disable-timer attack-timer)
(enable-timer attack-timer 600);Interval between attacks
)

;the ai stops his attacks and resets everything until the next wave
(defrule
;(goal attack-goal reset-attack)
(timer-triggered interval-timer)
=>
(disable-timer interval-timer)
(set-goal attack-goal standby)
)

;the ai will keep his units at his base when on standby

(defrule
(goal attack-goal standby)
=>
(set-strategic-number sn-group-form-distance 25)
(set-strategic-number sn-maximum-attack-group-size 0)
(set-strategic-number sn-minimum-attack-group-size 0)
(set-strategic-number sn-number-attack-groups 0)
(set-strategic-number sn-number-boat-attack-groups 0)
(set-strategic-number sn-minimum-boat-attack-group-size 0)
(set-strategic-number sn-maximum-boat-attack-group-size 0)
(disable-timer interval-timer)
(enable-timer interval-timer 10)
;(set-goal attack-goal reset-attack)
)

;the ai gathers his troops and attacks the enemy with the amount stated below

(defrule
(goal attack-goal offence) ;Attacking - Groups
=>
(set-strategic-number sn-group-form-distance 5)
(set-strategic-number sn-number-attack-groups 2)
(set-strategic-number sn-maximum-attack-group-size 15)
(set-strategic-number sn-minimum-attack-group-size 15)
(set-strategic-number sn-number-boat-attack-groups 2)
(set-strategic-number sn-minimum-boat-attack-group-size 7)
(set-strategic-number sn-maximum-boat-attack-group-size 7)
(set-goal attack-goal reset-attack)
)

;---Defence---
;Not implemented anymore


;***Production2***
;---Military---
;a scout unit for exploring

(defrule
(goal activate yes)
(unit-type-count-total scout-cavalry-line < 2)
(can-train scout-cavalry-line)
=>
(train scout-cavalry-line)
)

;___EASIEST___

(defrule
(goal activate yes)
(unit-type-count-total unit1 < 7)
(can-train unit1)
(difficulty == easiest)
=>
(train unit1)
)

(defrule
(goal activate yes)
(unit-type-count-total unit2 < 3)
(can-train unit2)
(difficulty == easiest)
=>
(train unit2)
)

(defrule
(goal activate yes)
(unit-type-count-total unit3 < 13)
(can-train unit3)
(difficulty == easiest)
=>
(train unit3)
)

(defrule
(goal activate yes)
(unit-type-count-total unit4 < 7)
(can-train unit4)
(difficulty == easiest)
=>
(train unit4)
)

(defrule
(goal activate yes)
(unit-type-count-total unit5 < 5)
(can-train unit5)
(difficulty == easiest)
=>
(train unit5)
)

(defrule
(goal activate yes)
(unit-type-count-total unit6 < 7)
(can-train unit6)
(difficulty == easiest)
=>
(train unit6)
)

(defrule
(goal activate yes)
(unit-type-count-total unit7 < 3)
(can-train unit7)
(difficulty == easiest)
=>
(train unit7)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege1 < 2)
(can-train siege1)
(difficulty == easiest)
=>
(train siege1)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege2 < 1)
(can-train siege2)
(difficulty == easiest)
=>
(train siege2)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege3 < 1)
(can-train siege3)
(difficulty == easiest)
=>
(train siege3)
)

;___EASY___

(defrule
(goal activate yes)
(unit-type-count-total unit1 < 13)
(can-train unit1)
(difficulty == easy)
=>
(train unit1)
)

(defrule
(goal activate yes)
(unit-type-count-total unit2 < 7)
(can-train unit2)
(difficulty == easy)
=>
(train unit2)
)

(defrule
(goal activate yes)
(unit-type-count-total unit3 < 27)
(can-train unit3)
(difficulty == easy)
=>
(train unit3)
)

(defrule
(goal activate yes)
(unit-type-count-total unit4 < 13)
(can-train unit4)
(difficulty == easy)
=>
(train unit4)
)

(defrule
(goal activate yes)
(unit-type-count-total unit5 < 10)
(can-train unit5)
(difficulty == easy)
=>
(train unit5)
)

(defrule
(goal activate yes)
(unit-type-count-total unit6 < 13)
(can-train unit6)
(difficulty == easy)
=>
(train unit6)
)

(defrule
(goal activate yes)
(unit-type-count-total unit7 < 7)
(can-train unit7)
(difficulty == easy)
=>
(train unit7)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege1 < 3)
(can-train siege1)
(difficulty == easy)
=>
(train siege1)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege2 < 2)
(can-train siege2)
(difficulty == easy)
=>
(train siege2)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege3 < 3)
(can-train siege3)
(difficulty == easy)
=>
(train siege3)
)

;___MODERATE___

(defrule
(goal activate yes)
(unit-type-count-total unit1 < 20)
(can-train unit1)
(difficulty == moderate)
=>
(train unit1)
)

(defrule
(goal activate yes)
(unit-type-count-total unit2 < 10)
(can-train unit2)
(difficulty == moderate)
=>
(train unit2)
)

(defrule
(goal activate yes)
(unit-type-count-total unit3 < 40)
(can-train unit3)
(difficulty == moderate)
=>
(train unit3)
)

(defrule
(goal activate yes)
(unit-type-count-total unit4 < 20)
(can-train unit4)
(difficulty == moderate)
=>
(train unit4)
)

(defrule
(goal activate yes)
(unit-type-count-total unit5 < 15)
(can-train unit5)
(difficulty == moderate)
=>
(train unit5)
)

(defrule
(goal activate yes)
(unit-type-count-total unit6 < 20)
(can-train unit6)
(difficulty == moderate)
=>
(train unit6)
)

(defrule
(goal activate yes)
(unit-type-count-total unit7 < 10)
(can-train unit7)
(difficulty == moderate)
=>
(train unit7)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege1 < 5)
(can-train siege1)
(difficulty == moderate)
=>
(train siege1)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege2 < 3)
(can-train siege2)
(difficulty == moderate)
=>
(train siege2)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege3 < 4)
(can-train siege3)
(difficulty == moderate)
=>
(train siege3)
)

;___HARD___
(defrule

(goal activate yes)
(unit-type-count-total unit1 < 27)
(can-train unit1)
(difficulty == hard)
=>
(train unit1)
)

(defrule
(goal activate yes)
(unit-type-count-total unit2 < 13)
(can-train unit2)
(difficulty == hard)
=>
(train unit2)
)

(defrule
(goal activate yes)
(unit-type-count-total unit3 < 53)
(can-train unit3)
(difficulty == hard)
=>
(train unit3)
)

(defrule
(goal activate yes)
(unit-type-count-total unit4 < 27)
(can-train unit4)
(difficulty == hard)
=>
(train unit4)
)

(defrule
(goal activate yes)
(unit-type-count-total unit5 < 20)
(can-train unit5)
(difficulty == hard)
=>
(train unit5)
)
(defrule
(goal activate yes)
(unit-type-count-total unit6 < 27)
(can-train unit6)
(difficulty == hard)
=>
(train unit6)
)
(defrule
(goal activate yes)
(unit-type-count-total unit7 < 13)
(can-train unit7)
(difficulty == hard)
=>
(train unit7)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege1 < 7)
(can-train siege1)
(difficulty == hard)
=>
(train siege1)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege2 < 4)
(can-train siege2)
(difficulty == hard)
=>
(train siege2)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege3 < 5)
(can-train siege3)
(difficulty == hard)
=>
(train siege3)
)

;___HARDEST___

(defrule
(goal activate yes)
(unit-type-count-total unit1 < 33)
(can-train unit1)
(difficulty == hardest)
=>
(train unit1)
)

(defrule
(goal activate yes)
(unit-type-count-total unit2 < 17)
(can-train unit2)
(difficulty == hardest)
=>
(train unit2)
)

(defrule
(goal activate yes)
(unit-type-count-total unit3 < 67)
(can-train unit3)
(difficulty == hardest)
=>
(train unit3)
)

(defrule
(goal activate yes)
(unit-type-count-total unit4 < 33)
(can-train unit4)
(difficulty == hardest)
=>
(train unit4)
)

(defrule
(goal activate yes)
(unit-type-count-total unit5 < 25)
(can-train unit5)
(difficulty == hardest)
=>
(train unit5)
)
(defrule
(goal activate yes)
(unit-type-count-total unit6 < 33)
(can-train unit6)
(difficulty == hardest)
=>
(train unit6)
)
(defrule
(goal activate yes)
(unit-type-count-total unit7 < 17)
(can-train unit7)
(difficulty == hardest)
=>
(train unit7)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege1 < 8)
(can-train siege1)
(difficulty == hardest)
=>
(train siege1)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege2 < 5)
(can-train siege2)
(difficulty == hardest)
=>
(train siege2)
)

(defrule
(goal activate yes)
(not (town-under-attack))
(unit-type-count-total siege3 < 7)
(can-train siege3)
(difficulty == hardest)
=>
(train siege3)
)

;---Naval---
;___EASIEST___

(defrule
(goal activate yes)
(difficulty == easiest)
(unit-type-count-total naval1 < 2)
(can-train naval1)
=>
(train naval1)
)

(defrule
(goal activate yes)
(difficulty == easiest)
(unit-type-count-total naval2 < 3)
(can-train naval2)
=>
(train naval2)
)

(defrule
(goal activate yes)
(difficulty == easiest)
(unit-type-count-total naval3 < 1)
(can-train naval3)
=>
(train naval3)
)

;___EASY___

(defrule
(goal activate yes)
(difficulty == easy)
(unit-type-count-total naval1 < 3)
(can-train naval1)
=>
(train naval1)
)

(defrule
(goal activate yes)
(difficulty == easy)
(unit-type-count-total naval2 < 7)
(can-train naval2)
=>
(train naval2)
)

(defrule
(goal activate yes)
(difficulty == easy)
(unit-type-count-total naval3 < 3)
(can-train naval3)
=>
(train naval3)
)

;___MODERATE___

(defrule
(goal activate yes)
(difficulty == moderate)
(unit-type-count-total naval1 < 5)
(can-train naval1)
=>
(train naval1)
)
(defrule
(goal activate yes)
(difficulty == moderate)
(unit-type-count-total naval2 < 10)
(can-train naval2)
=>
(train naval2)
)
(defrule
(goal activate yes)
(difficulty == moderate)
(unit-type-count-total naval3 < 4)
(can-train naval3)
=>
(train naval3)
)

;___HARD___

(defrule
(goal activate yes)
(difficulty == hard)
(unit-type-count-total naval1 < 7)
(can-train naval1)
=>
(train naval1)
)

(defrule
(goal activate yes)
(difficulty == hard)
(unit-type-count-total naval2 < 13)
(can-train naval2)
=>
(train naval2)
)

(defrule
(goal activate yes)
(difficulty == hard)
(unit-type-count-total naval3 < 5)
(can-train naval3)
=>
(train naval3)
)

;___HARDEST___

(defrule
(goal activate yes)
(difficulty == hardest)
(unit-type-count-total naval1 < 8)
(can-train naval1)
=>
(train naval1)
)

(defrule
(goal activate yes)
(difficulty == hardest)
(unit-type-count-total naval2 < 17)
(can-train naval2)
=>
(train naval2)
)

(defrule
(goal activate yes)
(difficulty == hardest)
(unit-type-count-total naval3 < 7)
(can-train naval3)
=>
(train naval3)
)

;***Market sales***

(defrule
(goal activate yes)
(gold-amount >= 1500)
(wood-amount <= 200)
(commodity-buying-price wood <= 150)
(can-buy-commodity wood)
(goal use-market 1)
=>
(buy-commodity wood)
)

(defrule
(goal activate yes)
(gold-amount >= 1500)
(food-amount <= 200)
(commodity-buying-price food <= 150)
(can-buy-commodity food)
(goal use-market 1)
=>
(buy-commodity food)
)

(defrule
(goal activate yes)
(gold-amount >= 500)
(food-amount <= 100)
(can-buy-commodity food)
(goal use-market 1)
=>
(buy-commodity food)
)

(defrule
(goal activate yes)
(gold-amount >= 2000)
(stone-amount <= 500)
(commodity-buying-price stone <= 100)
(can-buy-commodity stone)
(goal use-market 1)
=>
(buy-commodity stone)
)

(defrule
(goal activate yes)
(gold-amount >= 1500)
(stone-amount <= 200)
(commodity-buying-price stone <= 200)
(can-buy-commodity stone)
(goal use-market 1)
=>
(buy-commodity stone)
)

(defrule
(goal activate yes)
(wood-amount >= 2000)
(or
(gold-amount < 200)
(food-amount < 200)
)
(can-sell-commodity wood)
(goal use-market 1)
=>
(sell-commodity wood)
)

(defrule
(goal activate yes)
(food-amount >= 2000)
(or
(gold-amount < 200)
(wood-amount < 200)
)
(can-sell-commodity food)
(goal use-market 1)
=>
(sell-commodity food)
)

(defrule
(goal activate yes)
(stone-amount >= 1500)
(or
(or
(gold-amount < 200)
(wood-amount < 200)
)
(food-amount < 200)
)
(commodity-selling-price stone >= 70)
(can-sell-commodity stone)
(goal use-market 1)
=>
(sell-commodity stone)
)

;***Resigning***

(defrule
(goal activate yes)
(building-type-count town-center < 1)
(building-type-count castle < 1)
(military-population <= 5)
(goal default-resign 1)
=>
(set-goal 1 19)
(disable-self)
)

;***Cheats***

(defrule
(goal activate yes)
(goal allow-cheats 1)
=>
(enable-timer 1 0)
(disable-self)
)

(defrule
(timer-triggered 1)
(or
(difficulty == easiest)
(difficulty == easy)
)
=>
(cc-add-resource food 0)
(cc-add-resource wood 0)
(cc-add-resource gold 0)
(cc-add-resource stone 0)
(disable-timer 1)
(enable-timer 1 0)
)

(defrule
(timer-triggered 1)
(difficulty == moderate)
=>
(cc-add-resource food 0)
(cc-add-resource wood 0)
(cc-add-resource gold 0)
(cc-add-resource stone 0)
(disable-timer 1)
(enable-timer 1 0)
)

(defrule
(timer-triggered 1)
(or
(difficulty == hard)
(difficulty == hardest)
)
=>
(cc-add-resource food 0)
(cc-add-resource wood 0)
(cc-add-resource gold 0)
(cc-add-resource stone 0)
(disable-timer 1)
(enable-timer 1 0)
)



Note: this ai is generated from the forgottenempire ai builder

Link | Reply | Quote
 +[email protected]


Group: VCom Lead
Join Date: 25 May 2011
Posts:2744
Posted 21 November 2019 - 8:45 am
This Ai is made for the original aoe2FE mod version's exe, which can read those defconst which are implemented here.

(defconst end-feudal 1)
(defconst end-castle 2)
(defconst end-imperial 3)


These lines won't work with regular aoc without more specifications. You need something like:

(defrule
(can-research castle-age)
=>
(research castle-age)
)


I also recommend read these guides:

[You must login to view link]
[You must login to view link]
[You must login to view link]
Link | Reply | Quote
 [_Tiger_]Mannco


Group: Standard Membership
Join Date: 27 April 2017
Posts:22
Edited 21 November 2019 - 11:39 pm by [_Tiger_]Mannco
I watch the guide I can't find for the boat Guess i have to make a defrule *edited*
Link | Reply | Quote
 [_Tiger_]Mannco


Group: Standard Membership
Join Date: 27 April 2017
Posts:22
Posted 28 November 2019 - 8:35 pm
you can close thread


Link | Reply | Quote
[1]
Displaying 1 - 4 out of 4 posts
Forum Jump:
1 User(s) are reading this topic (in the past 30 minutes)
0 members, 1 guests

Most active threads in past week: