HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making the AI wake up.

04-18-2007, 01:55 PM#1
Sagan
I'm using AMAI on a custom map, and sometimes it will just stop doing anything. For example when I change alliances per trigger in some situations.

The AI will usually continue doing what it did before, most often that means building units, but nothing else. Once I had the situation, where the AI would do nothing, stayed at 12 supply, but after 5 minutes or so it sent out a whisp to an empty gold mine and built an expansion there...

Anyway the AI usually starts working again as soon one of its expansions gets attacked. So I was wondering if there is a way to force this behaviour.

Is there?
04-18-2007, 04:12 PM#2
Strategy Master
I think the main question is why AMAI stops doing anything. I somehow dont see how changing alliance will make AMAI stop working.

Are using the default AMAI or are u using your own custom made AMAI. If your using the default AMAI make sure the custom map uses the 'latest melee patch' data in map options otherwise AMAI dosn't work correctly for some reason which is yet to be determined.

If ur using a custom made amai you might want to check ur strategies are set up correctly.

Another issue is does AMAI have enough resources to build an expansion when AMAI stops working. Sometimes AMAI does seem to stall when it wants an expansion but cant for some reason.
04-18-2007, 04:41 PM#3
Sagan
The modification I made is like this: Whenever a players main building goes below 33% hitpoints, that player will become a vassal of the player who attacked him. So that the strongest players will soon have a large team.

So now AMAI attacks a main building, and that building goes below 33% of hit points. I change the alliance of the two players to be allies. The attacker won't stop attacking automatically, so I order all of his nearby units to "stop". What happens most of the time now is, that the attacker will continue to build units and send all of those units to that building, where they will just stand and do nothing. I can see why it would do that, because it hasn't finished what it was planning to do originally. But it has also happened to me, that the attacked player will do nothing. And I have no explanation for that...

In both cases the players will continue playing normally, when they are attacked. (at least most of the time)

I didn't make any major modifications to AMAI. I changed the colorcodes a little, and I reworked some functions in Blizzard.j, but nothing that should affect the AMAI.

Oh and while I'm at it: Is there any way to disable the "give up" trigger of the AMAI? So that they don't give up when their mainbase is destroyed. But I would also like to be able to turn that behaviour on again, because players can vote to disable the functionality I described.
04-18-2007, 11:30 PM#4
Strategy Master
You need to reset the ai's attack captains to fix that issue of ai stopping its attack because basically it wants to kill a target, when u stopped them they get stuck in a loop of waiting for that target to die. When you attack the enemy it causes the town threatened systems to engage and interrupt the loop.
CaptainGoHome() might be useful there or even ClearCaptainTargets(). That should hopefully reset the ai's. Unfortunatly those are ai natives so they might only work in ai scripts so u would need some sort of modification to the core amai script files. I can't remember if editor has a way to call those commands with triggers been ages since i've delved in ai trigger control.

To disable give up:
One way is to set all the profiles surrender values in the developer editions to 0 or if you editing the AMAI scripts directly p_surrender[profile] array needs to be set to 0 for all profiles. Currently there is no single variable that turns off the whole thing at once. I might add a global setting next version to do that.
04-19-2007, 11:58 AM#5
Sagan
Quote:
Originally Posted by Strategy Master
You need to reset the ai's attack captains to fix that issue of ai stopping its attack because basically it wants to kill a target, when u stopped them they get stuck in a loop of waiting for that target to die. When you attack the enemy it causes the town threatened systems to engage and interrupt the loop.
CaptainGoHome() might be useful there or even ClearCaptainTargets(). That should hopefully reset the ai's. Unfortunatly those are ai natives so they might only work in ai scripts so u would need some sort of modification to the core amai script files. I can't remember if editor has a way to call those commands with triggers been ages since i've delved in ai trigger control.

How do I do that? I would just like to add some very simple lines to the common.ai like "TriggerRegisterPlayerAllianceChange -> ClearCaptainTargets" - However there don't seem to be any triggers in the common.ai. So how do I do this? I imagine it can't be too complicated to check for changing alliances...
04-19-2007, 03:21 PM#6
Strategy Master
In the following function 'AMAI_ReformUntilTargetDead' add something like the following in the loop

if GetLastCommand() == 12 and GetLastData() == 5 then
CaptainGoHome()
return
endif

Now all u need to do is call that command number combination with the world editor trigger editor once the alliance change occurs. The command and data number can be anything you want it to be the above is just for example.


Edit - There is also another simpler way which i forgot also. If u give the command of 10 (shouldn't matter what data number u give) with trigger editor then the inbuilt commander system will cancel the attack for you.
04-19-2007, 07:19 PM#7
Sagan
Quote:
Originally Posted by Strategy Master
Edit - There is also another simpler way which i forgot also. If u give the command of 10 (shouldn't matter what data number u give) with trigger editor then the inbuilt commander system will cancel the attack for you.
Thx! It worked.
04-19-2007, 08:26 PM#8
Strategy Master
kool. Thats good to hear.