Jump to content
ncc1701e

AI triggers small tutorial

Recommended Posts

Following a request of @Badger73, here is a small tutorial for introducing the usage of AI triggers. I am using CMSF2. Since I am beginning with IA, experts are welcome to comment to provide better solutions that the one I will present just after.

Here is my small force.

NZ74K.png

They are facing those enemy positions.

2q2g8.png

And thus some few enemy squads. I have removed the RPG-7 on purpose for the tutorial.

OZL2K.png

I would like to teach the AI to do several things.

Phase 1:

  • The on map mortar team will perform area fire on the ditch inside Target 1
  • Meanwhile, the other guys will advance inside their vehicles toward Target 1. But, I would like them to advance reacting to an enemy move.

ZOXRd.png

Phase 2:

  • While the vehicules with the squads, still inside them, are progressing to Target 1. I would like the area fire to switch to Target 2 then Target 3 to avoid friendly fire casualties.
  • Once the vehicles are at waypoint 1. I would like them to pop some smoke
  • And, with the smoke screen in place, I would like the squads to dismount to assault the ditch.

Joxw1.png

So how I can do this using the editor and AI triggers?

To be continued...

Edited by ncc1701e

Share this post


Link to post
Share on other sites

The 2D map view is below.

3J8ZJ.png

First thing to do is to paint terrain objectives that will be used to activate the triggers. You can have up to 15 objectives. Some of them to be used for victory
points, ... some will be used for triggers. I am using Terrain Objectives (Blue) since I am acting on the Blue AI.

nG9xQ.png

Objective number 1

Objective number 1 will be used for activating a first trigger to change the on map mortar fire from Target 1 to Target 2. Remember, I want to avoid friendly casualties. I am declaring Objective number 1 as AI Trigger (friendly) because it is triggered by friendly forces reaching this terrain location. I am calling it "Trigger Blue 1".

9JAvq.png

Objective number 2

Objective number 2 is basically the same but it will be used to change the on map mortar fire from Target 2 to Target 3. Again, I am declaring Objective number 2 as AI Trigger (friendly) because it is triggered by friendly forces reaching this terrain location. I am calling it "Trigger Blue 2".

GQ4dk.png

Objective number 3

I want my 3rd platoon to react to an enemy move. So, to show how it works, I have created Objective number 3. I am declaring Objective number 3 as AI Trigger (enemy) because it is triggered by enemy forces reaching this terrain location. I am calling it "Trigger Red 1".

eP5d0.png

Here is the 3D view in Scenario Author Test mode. The triggers are invisible playing in normal modes.

XOn7X.png

Edited by ncc1701e

Share this post


Link to post
Share on other sites

At this stage, you need to split your forces into several AI groups. This is at your discretion but you can have a maximum of 16 AI groups per side. For this small amount of forces, and for what I want them to do, I have created three AI groups.

AI group number 2

This group will represent the infantry squads that are inside the M1126 Stryker carrier vehicles. This group does not take a lot of action in this scenario. Its main objective is to size the ditch once the M1126 Stryker have created a good smoke screen in front of them. To select the units inside AI group number 2, just select all the infantry squad and press the F2 key. You will see a [A2] tag. This is to say that the units are now in AI group number 2.

nG9AQ.png

AI group number 3

This group will represent the M1126 Stryker carrier vehicles. Their objective is to reach waypoint number 1 (see first post) and generate a smoke screen. We can also imagine they can do an area fire on the ditch to suppress any enemy located there. Select all the M1126 Strykers of 3rd platoon and press the F3 key. You will see a [A3] tag. This is to say that the units are now in AI group number 3.

9JAGq.png

AI group number 4

This group represent the mortar team. Their objective is to perform area fire respectively on Target 1, Target 2 and then Target 3. Select all the units of the Mortar Section and press the F4 key. You will see a [A4] tag. This is to say that the units are now in AI group number 4.

GQ4Zk.png

As you can see, AI groups selection is done based on the mission objectives to be done. You can perfectly assign several units from several formations inside the same AI group. All units are, by default, inside AI group number 1.

Share this post


Link to post
Share on other sites

First of all this is awesome! I'm out of upvotes today (I'm always running out it seems) but I'll be back...

1 hour ago, ncc1701e said:

I have created three AI groups.

You get one for free. So, after using three you now have four.

1 hour ago, ncc1701e said:

All units are, by default, inside AI group number 1.

I'm just asking why not use group one? If you are planning something else the I apologize for jumping the gun but from what you have said so far you could leave the infantry as group one. Assign the strikers to group two and the mortar teams to group three. There is nothing to fear from group one. :)

Share this post


Link to post
Share on other sites
On 4/23/2019 at 10:38 PM, IanL said:

I'm just asking why not use group one? If you are planning something else the I apologize for jumping the gun but from what you have said so far you could leave the infantry as group one. Assign the strikers to group two and the mortar teams to group three. There is nothing to fear from group one. :)

Yes you are completely right. Group one can completely be used. This is just that, since group one is the default when adding new units, I have taken the habit to not use it right away. When play testing my scenario, I am adding new units for scenario balance. These units goes in group one. So, to not screw up my existing AI plans, I am not using the default group right away. But, anybody is free to use group one.

Edited by ncc1701e

Share this post


Link to post
Share on other sites
17 hours ago, ncc1701e said:

Yes you are completely right. Group one can completely be used. This is just that, since group one is the default when adding new units, I have taken the habit to not use it right away. When play testing my scenario, I am adding new units for scenario balance. These units goes in group one. So, to not screw up my existing AI plans, I am not using the default group right away. But, anybody is free to use group one.

Cool. Not a bad strategy really. Thanks for the explanation.

Share this post


Link to post
Share on other sites

Before continuing I would like to give some few reminders on the AI. The AI is programmed by painting on the map the orders that must be performed by each AI group created. AI is not complicated. You just need to practice.

You have four options on the 2D map:

Movement zone:

You can paint square in yellow by left clicking on each of them. The map area that you will define is the zone where you want your AI group to arrive at the end of a particular order. The TacAI will determine the way to go there so if you want to influence the desire path for reaching an objective, you will need to create several orders. Do not forget that the zone that you will define must be large enough for your units. If your AI group contains four tanks, a movement zone of one square is may be not a good idea because the four tanks will not enter in one single square. You may define discontinuous squares. Again, practice to master this is the way to go.

Fire zone:

You can ask your units in the AI group to perform an area fire of a given map zone. For that, you need to paint the square of the zone to attack by using Ctrl-left click. This will paint your square in red instead of yellow. Please note that you can perfectly combine a movement zone and a fire zone in one order. This way, you can ask your units to move to a given position to perform an area fire on something, just do not forget the LOS rules apply. There is a second important thing to know. The area fire order has the lowest priority for your AI group so if your units find a good target, they will engage it first.

Facing zone:

Sometimes, a movement will end up with your units not looking toward the enemy. To mitigate this, you can select one particular square that your units will face at the end of their movement. To select this square, do Alt-left click on it. It will be painted in green. Since this is a single square, I recommend not to select the green square too close of your ending movement zone. Remember all your units will face the same square...

Withdraw zone:

You can ask your units to retreat. Your units will deploy smoke screens if possible. And, if there are vehicles in your AI group, those vehicles will reverse showing their big front armor. But, this is useful also in attack to create a smoke screen for your units. For this, you need to select one particular square by Shift-left clicking on it. The square will be pink. And the square must be in the direction your units/vehicles must face while reversing.

 

Once the AI menu selected in the editor, you have access to several buttons in the below screenshot:

Zb8on.png

The yellow colored zone, in the screenshot, gives access to all the possible AI plans within a given scenario. There are up to five AI plans per side plus a special Support Targets plan for artillery and air support strikes at the beginning of the scenario. Basically, one AI plan contains the orders for several AI groups. You can perfectly finish a scenario with one unique AI plan. The other plans are here to surprise your human opponent by new sets of AI orders for your AI groups.

The orange colored zone, just below (yes yes this is orange), allows to increase the percentage of a given AI plan to be selected. If you have one AI plan, the default value of “Used Frequently” is the one to take. According to the manual: "A Plan with “Used Sometimes” is two times more likely to be chosen than “Used Rarely” while “Used Frequently” is four times more likely to be selected".

The pink colored zone gives access to each AI group to give them some orders. Pay attention to select the correct AI plan (Blue or Red) and then the correct AI group to not mix up everything. With a litte practice, this works like a charm.

The green colored zone allows to select, within one given AI group, several orders. By default, the first order of an AI group is Setup. You can use the button Add to add more. The subsequent order will be named Order 2, ...

The white colored zone permits to select several actions that your units must do (orders, floors to occupy, stances, ...). I invite you to read the manual to understand each possible value.

The red colored zone contains two importants values. Exit between 00:00 and 20:00. What does it mean? The units is the number of minutes and seconds since the beginning of the whole scenario. This concept is key to understand how it works. According to the manual: “Exit Between ... and ...” tells the AI Group at what scenario time to leave their current Map Zone and when to arrive at the next Map Zone.

The first number tells the Group to stay at the current Map Zone until the specified scenario time is reached. With this setting a Group never moves on to the next Order before the specified time is reached.

The second number defines the latest time that an AI Group should arrive at it’s next order, and causes the Group to try very hard to get to the next Order in the plan before the specified scenario time is reached. This does not mean the Group will do it, just that it will try. If it has taken excessive casualties, is immobilized or heavily engaged, it may blow the set time. It will still attempt to execute the next order in the plan, just not within the time that the scenario designer allotted for it."

The blue colored zone is the one interesting in this tutorial because, clicking on it, this allows to select the triggers that we have created.

Now that this brief summary is done, let's go to the orders for each AI group.

Share this post


Link to post
Share on other sites

When it comes to the exit between...and times i think that the manual is not very clear...

I always had the impression that the first number means...

Do not leave before XX min

And the second number means...

Must leave before XX min.

And not neccesarely relate to a target time for the next waypoint...

But the manual do indeed describe it like you mentioned above...but

A few sentences below that statement the manual reads....

"The first number instructs the group to keep executing an order until that time in the scenario, while the second number instructs it to leave a map zone and move on to the next  order in the plan before that time is reached"

Kind of how i remember it to be...have been.

 

 

 

Edited by RepsolCBR

Share this post


Link to post
Share on other sites

I am pretty much 98 % sure that this is the way it has been working...atleast for me...

In my scenarios i have usually set the second number to be the time i want the Ai guys to leave...

And it has worked that way...they will remain att their current waypoint until the time in number two is reached and leave immidiatelly thereafter...

It the goal of the second number would have been to reach the next waypoint at that time they would have left earlier...would they not ?

And not exactelly on the time specified in number 2...

Share this post


Link to post
Share on other sites

I agree 100% with Repsol, at least before BFC added triggers (haven’t messed with making my own scenarios in a long while). We’re the commands changed when they added triggers?

Share this post


Link to post
Share on other sites

I agree with you guys, this is how I see it too. If you look later in the v4.00 manual, you can see the following paragraph linked to triggers (page 109).

Exit between Times

The first thing to understand is how the “Exit Between” times affect tripping. The first time tells the AI to NEVER start the Order until that time even if the Trigger is tripped. The second time tells the AI to NEVER start the Order later than that time even if the Trigger is not tripped. The time period between the first and second settings is when the Order is paused waiting for the Trigger to be tripped.

If you want a Group to always wait for a Trigger to be tripped leave the first timer to 00:00 and set the second timer to something greater than the scenario’s maxi- mum game time. If you want a Group to give up on a Trigger if it isn’t tripped by a particular time (a failsafe) then leave the first timer to 00:00 and set the second timer to the time you have in mind. Sometimes you will want a Group to wait until a specific time even if the Trigger is tripped, in which case you set the first timer to that time. If the Trigger is tripped before then the Group will start executing it’s Order only when the first timer’s time is reached. If it hasn’t been tripped by then the Group will remain idle until either the Trigger is tripped or the second timer’s time is reached (whichever happens first).

And, if a trigger is tripped, the TacAI will perform its next order after the SECOND time inside the Exit Between FIRST and SECOND.

Edited by ncc1701e

Share this post


Link to post
Share on other sites

So that you are not lost with the graphical interface, I will detail exactly what to be done in order to create orders and selecting triggers. Here, I am taking AI group number 1, as an example, but there is absolutely no unit inside. This is just to show you the needed manipulation.

In the first screenshot, you can see that there is nothing in the red colored zone. This is the default Setup. To add one order, you need to click on the Add button. You cannot apply a trigger on a Setup. This means you can't trigger reinforcements by a trigger as I understand:

DmwrE.png

Once the Add button has been performed, go back to the Setup order by clicking on Order 2 and selecting Setup:

qo5P9.png

On the bottom, you can now see and click on Wait For button:

gdjaK.png

A pop up appears allowing you to select the trigger you have created (I will explain the Group 3, Order 4 value later):

ko1G9.png

Select Trigger Blue 1, or another for example, then click on OK:

an5qk.png

You can now play with the + and - buttons to adjust timing of the order.

30q2a.png

Here the values are Exit Between 00:00 and 01:00 and Wait For = Trigger Blue 1. It means that, if units were in AI group number 1, those units will wait during 1 minute the occurrence of Trigger Blue 1, so waiting friendly units passing over the terrain objective defining Trigger Blue 1.

Two cases here:

  1. If friendly units are passing over Trigger Blue 1, between 0 minute (start of the scenario) and 1 minute after the beginning of the scenario, the units of AI group 1 will immediately perform the order defined in Order 2.
  2. If the trigger is not activated 1 minute after the beginning of the scenario, the units of AI group 1 will perform the order defined in Order 2 anyway. If you want absolutely the trigger to be waited before going to Order 2, set the second timer to a value higher than the scenario length.

Share this post


Link to post
Share on other sites

Orders for AI group number 4:

As seen above, this is the mortar section. As I said, I would like to avoid friendly fire so I will change of target with the advance of our friendly troops.

My intent is to leave the Setup with no terrain zone for the unit to deploy. It means that the deployment I gave for those units will be kept untouched by the AI. However, I am ordering an Area fire on Target 1. This is the red squares that you can see in the following screenshot:

ODGqr.png

Here, I am telling the AI to perform an Area fire on Target 1 between 00:00 and 04:00 minutes except if the Trigger Blue 1 is activated. If the Trigger Blue 1 is activated, AI group 4 will trigger the next order after Setup that is Order 2. Anyhow, after 4 minutes, AI group 4 will go to order 2 even if Trigger Blue 1 was not activated.

 

Order 2 is the following:

0oeNw.png

Still no movement as you can see but I am changing the Area fire to Target 2 from 04:00 minutes to 08:00 minutes except if Trigger Blue 2 is activated. I think you understand now that Order 3 will follow either 8 minutes after the beginning of the scenario either when Trigger Blue 2 activates.

 

Last order is Order 3 where I am changing the Area fire to Target 3 for the rest of the scenario.

x32xp.png

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Orders for AI group number 3:

This group contains the M1126 Stryker carrier vehicles. I would like them to advance toward Target 1. Thus, I am using the Setup plus 3 Orders.

Again the Setup is without terrain zone to keep the existing deployment of my troops. The vehicles will wait 3 minutes before moving except if some enemy units are entering in terrain zone defined by Trigger Red 1.

nQE1l.png

Order 2 contains several things:

  • First, advance to their movement zone (squares in yellow).
  • Second, perform an area fire while advancing on Target 1 (squares in red).
  • At last, at the end of the movement, be sure to face those buildings (the square in green gives the direction to face).

92Wxy.png

As you can see, this order 2 does not contain a trigger. So, after 7 minutes, the units will switch to the next one i.e. order 3.

 

Order 3 gives one minute, between 7 and 8 minutes, for the vehicles to reverse. That will generate a smoke screen that will be usually for my infantry attack.

Gxgjd.png

 

Last order, Order 4, consists of:

  • An advance to the yellow squares.
  • An area fire on those buildings in front of us (squares in red).
  • By security, I am still adding a face order (square in green) to be sure of their orientation at the end.

eXLJx.png

What is important to see here is that I am adding the option "Can Trigger" just under Order 4 in the graphical interface. Doing that, I am generating another form of trigger. This is a trigger that will activate once the current Order 4 is finished. Please also note that I have selected "Passengers Dismount" at the bottom of the graphical interface to tell the infantry this is time to go...

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Orders for AI group number 2:

This group represents the infantry squads that are inside the M1126 Stryker carrier vehicles. Basically, they have quite nothing to do. They have to wait for the Stryker carrier vehicles to be in place i.e. to have executed Order 4 of Group 3.

So, the Setup just says to wait from 0 to 20 minutes (I should have put a value higher than the scenario length here) for the Strykers to arrive in position.

x32aR.png

Once the trigger fires, they can execute their next order that is Order 2. And, Order 2, says to the infantry to disembark with once again the parameter "Passengers Dismount" and to do a "Max Assault".

Zb8Q1.png

They will have to:

  • Go to the yellow square doing a "Max Assault".
  • Perform an area fire while advancing on Target 2 (squares in red).
  • At the end of the movement, be sure to still face those buildings (the square in green gives the direction to face).
Edited by ncc1701e

Share this post


Link to post
Share on other sites

Alea jacta est. We need to play test the AI now. We will select the Red side to show what the Blue AI is doing.

YjmKg.png

Be sure to select the "Scenario Author Test" option to see what is going on.

JgXZX.png

To be continued...

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Activation of Trigger Red 1:

Starting the scenario, all units are in position and my setup was not changed by the AI since I have not painted any terrain zone in their respective setups of each AI group.

VKP4m.png

The first mortar team is targeting Target 1 as planned.

anL5g.png

Same for the second mortar team.

30xqW.png

The Stryker carrier vehicles are not moving as planned.

nQmEd.png

Target 1 begins to receive some shells.

92pWR.png

I am moving a small team to activate Trigger Red 1 for Blue AI.

wadoy.png

And immediately the Stryker carrier vehicles begin to move.

de5NO.png

Target 1 is still fired at by the mortar teams as expected.

NxdPY.png

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Activation of Trigger Blue 1:

Friendly units are crossing Trigger Blue 1 so activates it.

NxdPW.png

As such, the mortar teams are changing their target from Target 1 to Target 2.

PQdGb.png

41xW8.png

One last shell however falls on Target 1 giving some good results.

27Y0x.png

Units of group 3 advance and perform area fire on Target 1 when possible i.e. when no other targets are detected.

oKQYL.png

8oW1x.png

ODPGl.png

0oZe3.png

I am launching a small counter attack to divert the units of group 3.

x3D21.png

Edited by ncc1701e

Share this post


Link to post
Share on other sites
26 minutes ago, domfluff said:

Could you share the .btt file for this when you're done? It would be useful to see this being played out live.

Sure, that's the plan.

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Activation of Trigger Blue 2:

My small arms did not do much damage to the Stryker carrier vehicles. But, the Stryker vehicles did take care of the threat. That was the important thing to see and understand here. The area fire order given to group 3 is low priority. The enemy infantry was taken care of first. One of the vehicles of group 3, so a friendly unit, is on Trigger Blue 2 so activates it.

ynplb.png

Followed by a second one that is resuming the area fire.

Yj4oo.png

The third one is coming.

Rj2o8.png

My units are in a bad shape:

  • 3rd group HQ already eliminated
  • 1st team pinned down
  • 2nd team pinned down

7o1kJ.png

WDN2k.png

Lya3Q.png

Since Trigger Blue 2 was activated, the mortar team once again changes of target from Target 2 to Target 3.

qoWnd.png

kopWl.png

To illustrate once again, the lowest priority of the area fire order on Target 1 for any group, here group 3, I am attacking with a team one of its vehicle.

30xNk.png

Bad idea... 🙂

92pal.png

Edited by ncc1701e

Share this post


Link to post
Share on other sites

Activation of the withdraw order:

Looking at the number of minutes since the beginning of the scenario, 7 minutes 05 seconds has passed. This is time for the withdraw order to fire. Smoke screen already appears and vehicles of group 3 are reversing.

Jgk00.png

pYR2Z.png

This activation was done only based on a timer. So this is important to estimate correctly the right time to do the order's activation.

Rj2l8.png

I am taking the opportunity of the smoke to reinforce my positions.

Lya0Q.png

Edited by ncc1701e

Share this post


Link to post
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
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...