Page 1 of 1

AI Agents (Question for Pocus)

Posted: Mon Aug 17, 2015 10:39 pm
by Keeler
Pocus,

I posted this over in the Help Improve AACWII sub-forum, but I'm not sure if you saw it. I suspect you're busy getting caught up after holidays as well.

I am interested in trying to develop some agents. I looked at AGEWiki and understand the basic principles, but I can't find any information on how to set up the file structure. I don't own EAW yet, so I am wondering if there is better documentation available in order to get started. The documentation I have found so far is too fragmentary for me to make sense of how to set them up.

Posted: Tue Aug 18, 2015 1:43 pm
by lodilefty
Go to this thread:
http://www.ageod-forum.com/showthread.php?5358-Official-Files-for-modding

Download the CW2 database, and unzip to a location of your choice [doesn't have to be game folder]
Look under folder "DB Excel/Various DB" for the file:
CW2_DB_AIA_v1.0c.xls

The columns are annotated as to function with "popup notes"

Good hunting!

Posted: Tue Aug 18, 2015 5:29 pm
by Keeler
lodilefty wrote:Go to this thread:
http://www.ageod-forum.com/showthread.php?5358-Official-Files-for-modding

Download the CW2 database, and unzip to a location of your choice [doesn't have to be game folder]
Look under folder "DB Excel/Various DB" for the file:
CW2_DB_AIA_v1.0c.xls

The columns are annotated as to function with "popup notes"

Good hunting!


Thanks for the help, but I have already looked at that document and it seems to be only a list of possible agents along with their various parameters. I am looking for information on how to actually attach the agents to leaders.

What I want to do as self-tutorial is create an AI agent that instructs Confederate AI to more vigorously defend Northern Virginia. That would be an aiaDefendArea, and would need to be attached a leader (or a stack?, there's seems to be some interchange in terms from what I have come across). But the AIA doesn't have any columns to attach region or unit names, so there must be another location where one actually writes out the agents.

Posted: Tue Aug 18, 2015 6:35 pm
by lodilefty
http://www.ageod.net/agewiki/AI_Agents#Adding_Agent

http://www.ageod.net/agewiki/AI.AddLeaderAgent

You need to create an event, or add a line to an existing event.....

Note that the leader must defined by his Model Alias, not the Unit Alias.

Posted: Tue Aug 18, 2015 6:46 pm
by lodilefty
An example, from WIA mod I'm testing:


StartEvent = evt_nam_Allen310|1|2|evt_txt_Allen310|Event-img2_CanadianExped.bmp|$Crown Point|$snd_Arrival


Conditions
FixedDate = 1775/10/01


Actions


SelectFaction = USA
SelectRegion = $Crown Point
CreateGroup
Posture = $Defensive
SetKind = $Land
Entranch = 0
InCS = 0
FixType = 0
SetName = Allen's Expedition
Apply
CreateUnit
SetType = $uni_USA_Allen
SetName = Ethan Allen
Apply
CreateUnit
SetType = $uni_USA_Ran2
NumCreate = 2
FlavorName = 'Col. John Stark'
SetName = Stark's
Apply
AI.AddLeaderAgent = $aiaForceAttack;$ldr_USA_Montgomery;Regions $Richelieu


EndEvent


Montgomery will gather enough forces to meet the AIA requirement, then move to $Richelieu region to attack.

Mote that you may need to also use AI.SetAggro and AI.SetLocalInterest to also get the desired results.....

Posted: Tue Aug 18, 2015 8:42 pm
by Keeler
lodilefty wrote:An example, from WIA mod I'm testing:


That is what I am looking for. So an agent is a special type of event. If I understand correctly, were you to simply add an agent in the example the script would read:

StartEvent = evt_nam_XXXX

Conditions
FixedDate = 1775/10/01


Actions


SelectFaction = USA
Apply
AI.AddLeaderAgent = $aiaForceAttack;$ldr_USA_Montgomery;Regions $Richelieu


EndEvent

Posted: Sun Aug 23, 2015 2:04 am
by Keeler
Here is what I think I have created by making changes to CW2_inc_1861_CSA_AI_v1d: an agent that tells Joseph E Johnston to defend Northern Virginia, specifically Culpeper, Stafford, Fauquier, Albermarle, and Spotsylvania from June 1861 to March 1862, but only if the AI holds Richmond, hasn't captured Washington, and has a 3-1 power ratio within 3 regions of Richmond.

[ATTACH]34425[/ATTACH]

One question I came up with as I tried putting this together is how to script agents to account for leader deaths or wounding. For example, what if Johnson is wounded or killed in October 1861? There's no way to transfer an agent, and it seems like there would be problems if you an identical agent on multiple leaders.