Defend AI assignment and question

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

Defend AI assignment and question

Post by Lothos »

I noticed when using the ~ I can see DEFEND commands (not to be confused with Guard).

What does DEFEND command mean and do?

Is their a way for me to issue such commands to the AI (just like Offensive), if yes how? What file?
User avatar
Hubert Cater
Posts: 5986
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: Defend AI assignment and question

Post by Hubert Cater »

This is just part of the general AI, e.g. if there was no scripting implemented for a campaign/scenario, the AI can handle its own assignments of sending units on the OFFENSIVE under the right conditions, and to know when to switch over to a DEFENSIVE posture, also under the appropriate conditions.

There is no script for assigning DEFENSIVE plans.
User avatar
Lothos
Posts: 1246
Joined: Tue May 23, 2006 8:22 pm

Re: Defend AI assignment and question

Post by Lothos »

Hubert Cater wrote: Tue Apr 19, 2022 12:54 pm This is just part of the general AI, e.g. if there was no scripting implemented for a campaign/scenario, the AI can handle its own assignments of sending units on the OFFENSIVE under the right conditions, and to know when to switch over to a DEFENSIVE posture, also under the appropriate conditions.

There is no script for assigning DEFENSIVE plans.
Ok, was just thinking if I could use the Defend command it may make more sense than using Guard commands to get the AI to form a defensive line to protect an area. What I found was if you make an event that goes into a circle (forever) the AI will form the line but it will never be smart enough to stop the line unless you give it some sort of cancel commands.

What I discovered its best to make a one time event with a Length period to get the AI to form the general line and then let it take over after a few turns and let the guard command expire. My thinking (and maybe I am wrong) if I could tell the AI I want you to prepare a defense of this area it would understand better what I am trying to tell it and instead of forming an immovable line it would form a more flexible line based on the enemy units position.
User avatar
Hubert Cater
Posts: 5986
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: Defend AI assignment and question

Post by Hubert Cater »

It's a tricky one since as mentioned OFFENSIVE/DEFENSIVE plans are automatically handled but overriding to force an OFFENSIVE plan is more forgiving.

All this means is when the AI does not go on the offensive it can be more understood versus when the AI does not go on the defensive, e.g. it is going to be harder to force the AI to go on the defensive unless the conditions are perfect for it.

And if the conditions are perfect for it, it does it on its own so there was never really any need to add it to the scripts.

For example, the AI plans for OFFENSIVE and DEFENSIVE plans are automatically engaged and then cancelled when the ratios are at the right values.

e.g. in the simplest form, more enemy units than friendly units, go on the defensive. More friendly units than enemy units, go on the offensive.

9 times out of 10 you write an OFFENSIVE script for when the AI should be on the OFFENSIVE, e.g. German offensive plans for Barbarossa, and not when Germany is surrounded on 3 sides, you just wouldn't write an offensive script for it then, and if you did, it wouldn't ever initiate.

Using this logic, if you write a DEFENSIVE script for an area that is not currently threatened, it won't ever kick in and again, this was why I never considered adding it in and why I also ended up using GUARD scripts in a similar way to work around that.
Post Reply

Return to “Scenario Design and Modding”