Hi folks and experienced modders
after long "i'm going to do " and "we should do", I am trying my first script to make AI reactive - was a long project, long study of orders (and i grieve having lost Mac naughton posts on Paradox beta team thread, where Mac naughton gave me unvaluable tips i diond't copy and lost , well )
If we ever want a reactive diplomatic AI, and PON or PON 2 or gold if ever ever become the massive success it deserves, we need powers to evaluate situation and react
so here's my first step, or stone - a basic one : Prussia attacks out of the blue a german state - guardian of german princes integrity, Austria must react : a) evaluate forces b) evaluate alliances c) act - help really wanted about evaluation methods and syntax
- please note we want to take alliances (and if possible support) into account
- please note too that we don't want to rush on Prussia out of the blue - that is a crisis - we first give a warning THEN we enter war if it fails - that is the way it worked in 19th century - at Olmutz and in 1875 Prussia backed down. in Crimean war for principalties and at Andrinople in 1877 war, Russia backed down, after Solferino, France backed down, so we play it the historical way, or try
any other advise and script writing tip (about conditions, dateline, effects, like taking army move rather than just war), loke Mac naughton did once is welcome
if Pocus got the posts about modding from Paradox I couldn't save, that is welcome too
// event about Austria warning prussia not to invade saxony - without complying second event issued where - once set correctly, will have to be duplicated for german nations, ottoman, belgium,
//italian nations, balkan - WE SHOULD SET A CONDITION SO ONLY AI managed countries use this set of orders - event has to be followed by a declaration of war if and only if Germany persists
SelectFaction = $AUS
SelectRegion = $Oesterreich
StartEvent = evt_nam_AUS_warning-about-Saxony|999|1|evt_txt_AUS_warning-about-Saxony|Event-
img_AUS_warning-about-Saxony|$Oesterreich|NULL // I'll have to write thewarning text ("the ambassador of Austria in Berlin solemnly warned the king Prussia that, unless Prussian armies back up and peace is restored soon, her actions against an friend of Austrian will have the direst consequences") plus image
Conditions
EvalEvent = evt_nam_AUS_Compromise1867;=;1 // we have to devise some time limit, obviously once saxony is peacefully annexed, there will be no war so no event, we also assume that Hungarian compromise deflects Austrians from Germany as Hungarians could not care less, and have them concentrate on Balkans, against Russians
SelectFaction = $SAX
EvalIsAtwarWith = GER //condition an invasion of Saxony - Austria does not need to be allied to saxony actually - according to calculations, Saxony is not going to declare war on powerful Prussia
SelectFaction = $AUS
EvalIsAtPeaceWith = FRA
EvalIsAtPeaceWith = RUS
EvalIsAtPeaceWith = GBR
EvalIsAtPeaceWith = GER
Probability = 75 [color="#FF0000"]// can we replace by something more correlated to ratio of land forces and alliances, plus the commitment of Austria to Saxony - warning AI Austria is prone to remain very passive in game, which we must take into account[/color]
EvalAreaPowerRatio = LAND|$Continents_Europe|100|>=|50|25 [color="#FF0000"]// can this sort of things work - we must adapt it - question is to compare prussian and Austrian armies in Europe (fleets are here irrelevant), and if possible add their allies - who could suggest a working comparison and set of conditions - presantly I don't have the syntax to precise the powers involved in the ratio[/color]
to Austria +allies to germany and allies - does the following work ? how do we check areapowerratio or checkpowerratio between powers not yet at war
I found this in the german missions and adapted,seem to compute and compare forces but am not able to write correctly the following, comparing forces of powers and alliances in areas is the basic of any strategic actions by AI powers
SelectFaction = $AUS
RegInit = 1
SelectSubUnits = Area $Continents_Europe;FactionTags AUS;Domains $Land
SelectFaction = $PRU
RegInit = 2
SelectSubUnits = Area $Continents_Europe;FactionTags PRU;Domains $Land
RegInit = 3
RegSum = Registry 2 ;Best 1
RegEval = 1;>=;3
RegDeactivate = NULL
SelectSubUnits = Area $Continents_Europe;FactionTags GER;Domains $Land
EvalSubUnitCount = <;200
Actions
SelectFaction = $CMN
GenTextMsg = AUS_warning-about-Saxony-TEXT;1;NULL;NULL;NULL // text and image about warning to write
SelectFaction = $AUS
ChgFacRelationships = GER;-50
AddDiploItem = GER;$diCBTemp;CURRENT [color="#FF0000"]// in next event we should take into account fact that war was provoked or not, alliances and supports, presently I couldn't[/color]
AddDiploItem = SAX;$diDefensiveTreaty // duplication or to test, and if then must I separate lines with a CheckDiploItem command ?
RemDiploItem = GER;$diDefensiveTreaty // just in case there is one - in this case, Prussian "ally" behaviour is just untolerable
ChangeFacMorale = 10
SelectFaction = $SAX
ChangeFacMorale = 20
SelectFaction = $GER
ChangeFacMorale = -10 // take into account psychology, Austrians are indignant, saxon morale is boosted, prussian weary of complications
SelectFaction = $GBR
EvalDiploItem = GER;$diAllianceTreaty;NOT //Germany is the agressor, other nations approve Austria warning to keep balance and peace, but only if they are not German allied
ChgFacRelationships = AUS;10
SelectFaction = $FRA
EvalDiploItem = GER;$diAllianceTreaty;NOT
ChgFacRelationships = AUS;10
SelectFaction = $RUS
EvalDiploItem = GER;$diAllianceTreaty;NOT // is it a way to devise a choice like the options of aigun treaty or crimean crisis war ?
ChgFacRelationships = AUS;10
SelectFaction = $GER
CheckIsPlayer = NOT
SettleWhitePeace = $GER
SettleWhitePeace = $SAX // we consider AI being cautious, had they wanted a war with Austria, they would have attacked Austria alone, if Austria is weaker than Prussia, Austria won't move
[color="#FF0000"] // I am not sure about the syntax here, do i need to settle white peace for his own german AI faction ? do successive checks work ?
[/color]
SelectFaction = $GER
CheckIsPlayer = NULL
SelectFaction = $SAX
diOfferPeaceDefeat [color="#FF0000"]// automatic sending of white peace proposal to prussia, how does one do, what is the syntax - idea is to condition sending by Germany being a player sme other things to consider in syntax, like a symbolic payment ?[/color]
EndEvent