Jump to content

AI Sealion and Norway Scripting Woes


Recommended Posts

OK, I am trying to make an improved AI script for the 1939 campaign but I am hitting an invisible wall somewhere with getting the AI to implement plans. The research, diplomacy, and purchase scripts work fine, but not the plan scripts.

The modifications I have made to the warsaw, benelux, and paris plans all go through fine. But when I attempt to add a Sealion and Norway invasion plan, the AI will not implement the plan for anything. In addition, when I got rid of the amphibuous (spelling wrong, I know) invasion of the Denmark and replaced it with an over land version, the AI ignored me and continued to execute its previous plan (which had been erased)!

Am I missing something here? I must be missing something, but it's hard to tell with the rather bare info given with the scripts. The editor tells me there are no errors in the script, and for testing purposes the trigger was set to 100, with near-perfect conditions for the AI to do the plan. Still nothing.

Here are the Sealion and Norway scripts I made, modeled after some pre-existing scripts.

; Germany prepares to attack Norway:

{

#NAME= Germany Build Up Amphibious - Oslo

#POPUP=

#FLAG= 1

#TYPE= 0

#COUNTRY_ID= 5

#TRIGGER= 100

#LEVEL= 0

#PLAN_ID= 2

#SIZE= 2

#LENGTH= 2

; Oslo

#GOAL_POSITION= 80,8

#DATE= 1940/05/01

#STEAL= 2

; Set friendly positions:

; 1st Line - Copenhagen

; 2nd Line - Hamburg

; 3rd Line - Frankfurt

; 4th Line - Essen

#FRIENDLY_POSITION= 81,12

#FRIENDLY_POSITION= 78,15

#FRIENDLY_POSITION= 77,17

#FRIENDLY_POSITION= 76,16

; Set variable conditions:

; 1st Line - Poland politically aligned with Allies and surrendered

#VARIABLE_CONDITION= 33 [2] [100] [1]

; Set tactical conditions:

; 1st Line - Berlin not tactically threatened

#TACTICAL_CONDITION= 84,16 [1]

; Set dummy activate position (no units at position 0,0)

#ACTIVATE_POSITION= 0,0 [0,0] [0,0] [0]

; Set cancel position:

; 1st Line - Axis unit already in Norway (due to possible Allied DoW)

#CANCEL_POSITION= 80,8 [0,0] [1,1] [1]

}

; Germany prepares to attack England:

{

#NAME= Germany Build Up Amphibious - Sealion

#POPUP=

#FLAG= 1

#TYPE= 0

#COUNTRY_ID= 5

#TRIGGER= 100

#LEVEL= 0

#PLAN_ID= 2

#SIZE= 6

#LENGTH= 4

; London

#GOAL_POSITION= 64,15

#DATE= 1940/08/01

#STEAL= 3

; Set friendly positions:

; 1st Line - Paris

; 2nd Line - Copenhagen

; 3rd Line - Hamburg

; 4th Line - Frankfurt

; 5th Line - Essen

#FRIENDLY_POSITION= 69,18

#FRIENDLY_POSITION= 81,12

#FRIENDLY_POSITION= 78,15

#FRIENDLY_POSITION= 77,17

#FRIENDLY_POSITION= 76,16

; Set variable conditions:

; 1st Line - Poland politically aligned with Allies and surrendered

; 2nd Line - France politically aligned with Allies and surrendered

#VARIABLE_CONDITION= 33 [2] [100] [1]

#VARIABLE_CONDITION= 2 [2] [100] [1]

; Set tactical conditions:

; 1st Line - Berlin not tactically threatened

; 2nd Line - Bordeux not tactically threatened

; 3rd Line - Copenhagen not tactically threatened

#TACTICAL_CONDITION= 84,16 [1]

#TACTICAL_CONDITION= 63,21 [3]

#TACTICAL_CONDITION= 81,12 [3]

; Set dummy activate position (no units at position 0,0)

#ACTIVATE_POSITION= 0,0 [0,0] [0,0] [0]

; Set dummy cancel position (single neutral unit at position 0,0). This is not possible as no

; unit can occupy tile 0,0 so event will not be cancelled due to #CONDITION_POSITION

#CANCEL_POSITION= 0,0 [0,0] [1,1] [0]

}

Link to comment
Share on other sites

Presuming all the co-ordinates are correct the scripts look okay to me, although STEAL=2 (defensive only) might not give the first plan priority? but im a little hazy on the mechanics of that.

this comment:

...when I got rid of the amphibuous (spelling wrong, I know) invasion of the Denmark and replaced it with an over land version, the AI ignored me and continued to execute its previous plan (which had been erased)!
makes me wonder if either you were playing the right campaign or whether you had properly recompiled the scripts into the campaign file in the Editor? Thats about the only reasons I can figure you wouldn't see the changes.

To help you test AI scripts its an idea to put a message in the popup parameter, then you can see when/if the plan is activated by the AI. (remove for playing!)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...