How to make custom .aip files work

Modding, Map Editor, IES Scripting and Other Questions
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

How to make custom .aip files work

Post by Bogdan »

Hi everyone! I've already discuss this theme in other topic, but I think it's something other people could be interested in.
I know there's a way to use custom .aip in scenario with command

Code: Select all

AI_ChangePersonality(playerID, "bully.aip");
However, I can't find the way to make this work as there's no obvious place for custom aips. I tried to put .aip file in different Documents\Empire Earth II folders and also in Empire Earth 2 Gold Edition\aips, but it never worked; the scenario continues to use Skirmish_Default.aip every time.

Nevertheless, there's a scenario in Unofficial Patch, which uses (or tries to) custom aips. It's "Survival Egypt" in EE2X. I've found this in its code:

Code: Select all

AI_ChangePersonality(4, "/EE2X/run/AIPS_EE2X/Skirmish_Default.aip");
AI_ChangePersonality(4, "/EE2X/run/AIPS_EE2X/Skirmish_Hardest.aip");
AI_ChangePersonality(2, "/EE2X/run/AIPS_EE2X/Skirmish_Default.aip");
AI_ChangePersonality(2, "/EE2X/run/AIPS_EE2X/Skirmish_Hardest.aip");
So I put .aip file in Empire Earth 2 Gold Edition\aips and tried

Code: Select all

AI_ChangePersonality(5, "/EE2/run/AIPS/myfile.aip");
but, unfortunately, no result. May be this command is only suitable for EE2X or may be AI_ChangePersonality doesn't work at all. May be there's other way to control AI behaviour? Does anyone know?

User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: How to make custom .aip files work

Post by Dr.MonaLisa »

Have you tried to use:
AI_ChangePersonality(4, "Skirmish_Default.aip");

(without the "/EE2X/run/AIPS_EE2X/" path)?

I never used custom aips so can't help much. Hopefully someone else would know it.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: How to make custom .aip files work

Post by Bogdan »

Nope.. Because scenario is already using Skirmish_Default, by default. I’ve used my own aip’s name, of course, but it didn’t work.
User avatar
calsch03
Posts: 43
Joined: 04 Dec 2015, 11:24
Location: The Netherlands
Has thanked: 7 times
Been thanked: 2 times
Contact:

Re: How to make custom .aip files work

Post by calsch03 »

Hello Bogdan,

I've messed around with aip's in the past. The aip's have to be placed in the Empire Earth 2 Gold Edition\aips or for the expansion AIPS_EE2X folders.
Aip files are a bit tricky to get to work and to be honest, they don't work well for survival Egypt as the AI don't build most buildings.

I've get it to work in a hobby project. I've modified the aip for the three kingdoms scenario so the ai would use builders instead of civilians.
In the script the aip must be called like this:
Screenshot_1.png
Screenshot_1.png (8.8 KiB) Viewed 3335 times
If you use aip's, it's very important that you use the following setting in the map editor. The AI script has to be set on None, otherwise your aip doesn't work.
Some aip's require a specific civilisation like mine, but that's not for every aip script.
Screenshot_2.png
Screenshot_2.png (50.83 KiB) Viewed 3335 times
I've also been working on a campaign. For that I've used the Skirmish aip. I've combined it with the civilization aip and some aggressive military aip's, this works a lot better than just the skirmish aip and it feels a lot more like the skirmish AI. You can try and add the Hardest.aip to this if you want, but for me this wasn't necessary as the AI was already good enough for the first mission. ;)
Screenshot_3.png
Screenshot_3.png (5.81 KiB) Viewed 3335 times
Feel free to ask if you have any more questions.
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: How to make custom .aip files work

Post by Bogdan »

Thank you for your help! The answer was really just lying on the surface. Now, after I set map editor right, I can finally use my .aip file.

Unfortunately, there's now an error message every time AI capturing a territory:
Unhandled Exception.png
Unhandled Exception.png (6.44 KiB) Viewed 3325 times
Mona, may be you know what it's all about?
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: How to make custom .aip files work

Post by Dr.MonaLisa »

No, it's somewhere near:
nonononono.PNG
nonononono.PNG (97.15 KiB) Viewed 3320 times
There are AI related functions close this part of the code, but it's never possible to detect what's wrong by the EIP address.

You could load a default AI script and see if still crashes. If it doesn't, then there must be an error in the new file you created. So then, long time need to be spent to detect what exactly causes it. This is how EE2 scripting works :/

Btw. thanks calsch03, for detailed guide!
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: How to make custom .aip files work

Post by Bogdan »

Default .aips work fine. Ok, thank you, I’ll try to make .aip file with the minimum changes compared to the default one.
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: How to make custom .aip files work

Post by Bogdan »

Hm, looks like the game is still crashes with an .aip file with no changes compared to the Skirmish_Default one.
So I think there's no way to load custom .aip with no issues, default files only
User avatar
calsch03
Posts: 43
Joined: 04 Dec 2015, 11:24
Location: The Netherlands
Has thanked: 7 times
Been thanked: 2 times
Contact:

Re: How to make custom .aip files work

Post by calsch03 »

Hi Bogdan,

I may have found a solution for your crash with custom aip. You need to make a new aip file and start with the following code:

Code: Select all

// $Header: /run/AIPS/Skirmish_Default.aip 38    5/05/05 3:46p Kwasserman $
// The basic skirmish aip, EVERYONE should load this first, then override only the interesting bits

#include "AipStructures.h"
After that you only copy the stuff from the Skirmish_Default.aip that you want to change and change it in the new file.
In your script you need to first load the unmodified Skirmish_Default.aip and after that load your custom aip. The game will now load the vanilla aip and overwrite some values with your custom aip.

Code: Select all

AI_ChangePersonality(2, "Skirmish_Default.aip");
AI_ChangePersonality(2, "Civ_Turkish.aip");
AI_ChangePersonality(2, "Skirmish_Custom.aip");
In my tests this removed the crashing problem when the ai captures a new territory.

I've copied your changes in the Skirmish_Custom.aip.
Byzantium_aip_test.zip
(544.78 KiB) Downloaded 182 times
User avatar
Bogdan
Posts: 149
Joined: 25 Feb 2017, 17:26
Location: Kyiv, Ukraine
Been thanked: 3 times

Re: How to make custom .aip files work

Post by Bogdan »

Unfortunately, I have the same issue again. In addition, AI armies are stuck from time to time, despite all the efforts
Attachments
Unhandled Exception 2.png
Unhandled Exception 2.png (6.47 KiB) Viewed 3271 times
Post Reply

Return to “Questions”