Age of Empires II: Definitive Edition

Age of Empires II: Definitive Edition

View Stats:
How or where to mod AI scripts?
So I just recently tweaked my mod so that the Armenians and the Georgians are no longer allowed to build Mule Carts with Full Tech Tree on, but there seems to be one small problem. When an AI player plays as either one of the aforementioned civs, they do not build any Lumber/Mining Camps for some reason. How do I modify the AI scripts in my mod so that the Armenian/Georgian AI players get to building Lumber/Mining Camps with FTT enabled?
Last edited by Mackinaw Bellerose; Mar 22, 2024 @ 11:48am
Originally posted by Pikemons:
search (defconst lumber-camp mule-cart) in customConstants.per; It changed the default lumber-camp of A&G to mule-cart, so modify it in your own way.
< >
Showing 1-7 of 7 comments
SpoOkyMagician Mar 27, 2024 @ 3:26pm 
edit: Oh and while this is old/out of date a bit, it's still mostly true. ( https://steamcommunity.com/sharedfiles/filedetails/?id=2690998749 )

Well, I don't own the expansions so, I am not entirely sure that would work. (Since they don't have access normally to those buildings. If they don't with FTT on, then you will have to modify the AI or make your own probably... I'll take a look into it.)

edit: Also, try controlling the AI player and see if the buildings are available to be built. You can use the hotkey: ctrl+shift+F<#> (any function number key 1 to 9.) with cheats enabled or 'Test' in the Editor. If still no, then you might be out of luck.

edit: After thinking about it, of course it should work since all other civs can build them... So yeah, if it does not work... you might be out of luck here. Maybe you can manually enable it via triggers? (Enable Object: Mining Camp and Lumber Camp.)

In the meantime, I recommend looking over this site: https://airef.github.io/index.html

edit: The real concern is this: https://airef.github.io/commands/commands-details.html#can-build

"It's available to the computer player's civ." which normally it's not so, most likely, it will return false... Umm...

edit: You 'could try' just a build command but...

"Important Note: Always use a can-build, can-build-with-escrow, or up-can-build condition in every rule where you use the build or up-build command. Without this condition, the building queue for this building may get stuck for the rest of the game."

That would be an issue too...

This would be much easier to test if I had them but, I can only speculate atm sorry.
Last edited by SpoOkyMagician; Mar 27, 2024 @ 3:55pm
Sorry for the sudden reply. I've been occupied with looking over all the files in the "ai" folder. But I do have more questions. Will I have to edit multiple .per files or just one to achieve my AI modding goal? And more specifically, where do I look to find the AI's standard FTT build order in the Dark Age (that has the Lumber/Mining Camps instead of the Mule Carts)?
Last edited by Mackinaw Bellerose; Mar 28, 2024 @ 1:29pm
SpoOkyMagician Mar 28, 2024 @ 4:04pm 
I would depend on what you intend to do/use. Do you ONLY want the standard AI (DE AI), HD AI, CD AI, or all 3? (or even just a custom AI.) Overall though, the easiest solution would be to use the AI builder in that case. (Unless, you want to do it from scratch.)

Note: If you intend to edit the CD version, you have to edit all the 'elite petersen' files in: 'AoE2DE\resources\_common\drs\gamedata_x2' otherwise, everything else is in the AI folder. (DE AI is in 'Promisory')

As for the FTT stuff, I believe the game automatically assumes this and should automatically correct itself as needed in the AI file. (with maybe exceptions when using "ALL-TECHS-ENABLED" for #load-if)
The author of this thread has indicated that this post answers the original topic.
Pikemons Apr 2, 2024 @ 7:13pm 
search (defconst lumber-camp mule-cart) in customConstants.per; It changed the default lumber-camp of A&G to mule-cart, so modify it in your own way.
Guys, I figured it out. All I had to do was delete the defconsts that contained the "mule-cart" values. Thanks for the help

EDIT: Turns out that trick worked for all AI types except for the CD version. I deleted the following block of code from "elite petersen constants.per2":

#load-if-defined ARMENIANS-CIV (defconst lumber-camp mule-cart) (defconst mining-camp mule-cart) #end-if #load-if-defined GEORGIANS-CIV (defconst lumber-camp mule-cart) (defconst mining-camp mule-cart) #end-if

...and the CD AI refuses to build any Lumber/Mining Camps with FTT enabled. Any other ideas?

EDIT: I've tried modifying the defconsts (replacing the "mule-cart" value with the respective building ID number according to the constant name, etc.) and adding new #load-if symbols (specifically, the #load-if-not-defined ALL-TECHS-ENABLED symbol) and the CD AI still won't build any Lumber/Mining Camps in FTT mode. Am I perhaps looking in the wrong .per2 file, or do I have to add a new block of code in one of the .per2 files? Any tips are greatly appreciated.

EDIT: I just found out I was missing essential .per2 files required to carry out the necessary changes, specifically PromiDE.per2 and randomgame.per2. Thanks again :)
Last edited by Mackinaw Bellerose; Apr 5, 2024 @ 4:26pm
Promiskuitiv  [developer] Jun 26, 2024 @ 9:00am 
There's also an active aoe2 AI scripting community around, in case you have any more questions to veteran scripters. :)

Sharing their discord link here: discord.gg/hEJ9GJNBCg.
Originally posted by Promiskuitiv:
There's also an active aoe2 AI scripting community around, in case you have any more questions to veteran scripters. :)

Sharing their discord link here: discord.gg/hEJ9GJNBCg.
Thanks, noted for future reference
< >
Showing 1-7 of 7 comments
Per page: 1530 50