ACTIVATE_POSITION and CANCEL_POSITION AI issue

Please post here for questions and discussion about modding for Strategic Command.
Post Reply
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

After numerous testing and watching what the AI does I realized some of the distortions had a patern.

This lead me to realize that the CANCEL_POSITION does not fire on the same turn that an AI event fires.

In the sample below the event is suppose to trigger if at least one Axis unit is within 16 hexes of Tobruk

The cancel event is suppose to cancel it if their are at least 10 Allied units within 16 hexes of Tobruk

This event IS working properly

But what happens when it should not fire, it gets Activated and the AI starts to execute the transport and then the following turn it cancels it leaving these troops stuck in the ocean with no destination.

A cancel check should be checked on the same turn an event is triggered to see if it needs to be suppressed or not.

{
#NAME= UK - Transport - Liverpool -> Suez
#POPUP=
#FLAG= 1
#TYPE= 2
#COUNTRY_ID= 112
#TRIGGER= 30
#LEVEL= 0
#GV= 1[1,100]
#LINK= 0[0]
#SIZE= 1,2
#BUILD_LENGTH= 0
#LENGTH= 5
#RANGE= 25
#NAVAL_CRUISE= 0
#GOAL_POSITION= 210,127
#GOAL_POSITION= 95,135
#DATE= 1940/09/08
#STEAL= 0
; UK Safe
#FRIENDLY_POSITION= 141,72
#FRIENDLY_POSITION= 147,77
#FRIENDLY_POSITION= 140,63
#FRIENDLY_POSITION= 138,60
#FRIENDLY_POSITION= 140,57
#FRIENDLY_POSITION= 144,79
;Egypt Safe
#FRIENDLY_POSITION= 210,126
#FRIENDLY_POSITION= 208,126
#FRIENDLY_POSITION= 206,124
#FRIENDLY_POSITION= 216,123
#FRIENDLY_POSITION= 218,123
; - UK - Allies - War - Not Surrendered
#VARIABLE_CONDITION= 112 [2] [100] [0]
; - Italy - Axis - War - Not Surrendered
#VARIABLE_CONDITION= 59 [1] [100] [0]
#TACTICAL_CONDITION= 147,77 [1]
#ACTIVATE_POSITION= 194,122 [0,16] [1,1] [1]
#CANCEL_POSITION= 194,122 [0,16] [10,10] [2]
}
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

I just double checked and unless there is a bug, a plan should not be assigned if the cancel condition has been satisfied.

If you have a test case that is repeatable and showing this clearly I'd be happy to take a look.
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

Hubert Cater wrote: Tue Apr 19, 2022 1:00 pm I just double checked and unless there is a bug, a plan should not be assigned if the cancel condition has been satisfied.

If you have a test case that is repeatable and showing this clearly I'd be happy to take a look.
Yes, use the script I gave you in my initial post.

What happens is the AI puts the troops on the transport, starts to send them out. Then the next turn it cancels the command and sends them back to the UK.

I've seen this many times. It seems to me the event fires the plan and it does not check the cancel until later.
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

I would need a save from before and after so an exact case of what you have on your end could be repeated on my side.

One thing you can do is confirm that it is indeed the suspected cancel condition that is triggering the failure on the following turn by reviewing the planning.log file, e.g. assuming F2 DEBUGLOGS has been enabled from the start.

This log will show you the exact reason why the plan has been cancelled, and again here assuming you haven't already verified this.
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

Hubert Cater wrote: Wed Apr 20, 2022 1:53 am I would need a save from before and after so an exact case of what you have on your end could be repeated on my side.

One thing you can do is confirm that it is indeed the suspected cancel condition that is triggering the failure on the following turn by reviewing the planning.log file, e.g. assuming F2 DEBUGLOGS has been enabled from the start.

This log will show you the exact reason why the plan has been cancelled, and again here assuming you haven't already verified this.
Need a little time to get you this, I started working on adding Africa to the map. Its about 60% done. Once I get that done I need to readjust all the convoy routes and can then run another sim to duplicate this issue.
Editor-WWII_War_in_Europe_PQrRoqcPgC.png
Editor-WWII_War_in_Europe_PQrRoqcPgC.png (22.95 KiB) Viewed 1043 times
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

No problem at all and that map looks great!
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

Hubert Cater wrote: Mon Apr 25, 2022 12:51 pm No problem at all and that map looks great!
I think I figured out what the problem is here.

You may be right and its not the CANCEL_POSITION. What may be happening is the LENGTH is being reached and the transport had not reached its destination yet which I think may be causing it to then just get lost sometimes sit their or go back. I have seen in some games transports with no orders just sitting in a port which is how I came to this conclusion.
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

Ah ok, thanks for the update
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

Hubert Cater wrote: Thu May 19, 2022 3:00 pm Ah ok, thanks for the update
Is this something that you would consider fixing? My thinking is if a transport or amphib is in the middle of a mission and already on its way it should not cancel cause the length ran out. It should keep going until it reaches its destination.
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

Off hand no, I don't think I would change the behaviour as it is a universal setting for all plans where they have a length and gives modders a chance to set a time limit to a plan.

Easiest thing to do here is to simply set a longer length limit to the plan to essentially achieve what you would be after which is to ensure it reaches its destination.
User avatar
Lothos
Posts: 1330
Joined: Tue May 23, 2006 8:22 pm

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Lothos »

Hubert Cater wrote: Fri May 20, 2022 12:35 pm Off hand no, I don't think I would change the behaviour as it is a universal setting for all plans where they have a length and gives modders a chance to set a time limit to a plan.

Easiest thing to do here is to simply set a longer length limit to the plan to essentially achieve what you would be after which is to ensure it reaches its destination.
Just ran into a new issue with both of these commands.

It treats Air Power when counting land units. This causes the AI to potential mis manage a theater because it overloaded the area with air power. So it would have a massive air pressence with little to no land forces.

Is their any chance of adding a new parameter to count just land units only (not air power) in a theater. This way I can then manage how many troops he sends to an area (like North Africa, Norway or Ethiopia etc...)
User avatar
Hubert Cater
Posts: 6094
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: ACTIVATE_POSITION and CANCEL_POSITION AI issue

Post by Hubert Cater »

I see the point and I can add it to the list as well
Post Reply

Return to “Scenario Design and Modding”