World in Conflict Tool for ArmA2 Wiki
Advertisement

Moving your spawned units[]

All class templates execute some FSM and they are at your disposal at any time.

They are all in WICT\AI folder inside mod and their name differs according to the side that’s executing it.

  • Regular infantry will use infantry_.fsm (infantryW or infantryE, just write appropriate letter on dash _). They will form a battlefront and check if there is enemy base known. After capturing the base they will patrol nearby or guard it.
  • All other types of infantry use infantry2_.fsm. They won’t form the battlefront immediately, but they will rather seek and destroy first. This gives them advantage since they are not “forced” to go to the front line, so they have time to prepare, spot the enemy from safe distance and act. They won’t guard the base, just patrol nearby.
  • Troop transport uses transport_.fsm and they will first try to capture neutral sector if one exists. If there is no known neutral sector they will attack enemy’s base. After capturing they can sweep the area (patrol and check buildings) or they will guard the area.
  • Vehicles use vehicles_.fsm and air uses air_.fsm.

Note: they all execute for one member i.e. _Unit1 doFSM ["WICT\AI\infantry2W.fsm", [0,0,0], _Unit1]; --- it is easiest (and most logical) to execute on leader (although script finds the group at the beginning).

Defend and patrol[]

Binesi’s improved BIS_fnc_taskPatrol[]

My version creates a continually randomized roughly circular patrol path around a given point (as opposed to the BIS function which is purely random and chaotic). Generally it will move clockwise with a random chance to skip ahead and intersect across to another waypoint. It will also occasionally search out the area inside of this circle. It is very low CPU usage and doesn't use any continually running scripts after it starts but instead relies on code attached to waypoints.

It won't compete with UPS or a more advanced patrol script, but it can accomplish similar goals while using a small fraction of the resources. It will probably work best with infantry in relatively open areas or aircraft as it doesn't use a lot of intelligence for creating the patrol points other than making sure they are clear of obstacles and level enough for movement.

Call this function:

null = [group this,(getPos this),250] execVM "WICT\AI\BIN_taskPatrol.sqf";

Description:
Creates a continually randomized patrol path which circles and intersects a given position.

Parameter(s):
_this select 0: the group to which to assign the waypoints (Group)
_this select 1: the position on which to base the patrol (Array)
_this select 2: the maximum distance between waypoints (Number)
_this select 3: (optional) debug markers on or off (Number)
_this select 4: (optional) blacklist of areas (Array)

Note: this ----- unit (i.e. _Unit1).

I made some corrections to this script. Wolffy.au introduced an offset to the chosen angle, but that didn’t create counterclockwise direction, it just added an offset (as the name says) to the starting angle. I used “coin” and JTD direction normalization function made by Trexian to create a random choice for clockwise or counterclockwise direction (50-50 chance).

Wolffy.au’s improved Binesi’s BIS_fnc_taskPatrol[]

Wolffy.au also added building positions as possible patrol locations using Random Building Position Script v1.0 by Tophe of Östgöta Ops. This AI script is available by calling:

null = [group this,(getPos this),250] execVM "WICT\AI\BIN_taskSweep.sqf";

using the same parameters as described above.

Binesi’s improved BIS_fnc_taskDefend[]

I made some improvements to BIS_fnc_taskDefend. I know a lot of you are using this function as it's convenient so I thought I would share my optimized version as I've been very happy with its behavior.
Basically more efficient and effective. This version will reliably man all nearby defenses (even buggy spawned BIS compositions) and will additionally send out micro patrols in its vicinity and otherwise act fairly believably without using much CPU.
When enemies are detected the area is searched and cleared before resuming their normal activities.
null = [group this,(getPos this)] execVM "WICT\AI\BIN_taskDefend.sqf";

Parameter(s):
_this select 0: group (Group)
_this select 1: defense position (Array)

I couldn’t preserve mounting part of this script because it comes before setting waypoints and it assumes that group has no waypoints at all. So I made additional script…

Mounting static defenses[]

All units in the game that are not in vehicles will immediately mount any available gunner position in 150m radius.

null = [] execVM "WICT\AI\static.sqf";

This script has influence on all not-named, not-mounted AI only (read next section). It is called every time the base is captured (no matter of side that did it).

Class-like-based behavior[]

zapat:

  1. If I put a unit on the map in the editor without name means that WICT will include it for the AI mass-operation if I'm right.
  2. Which class this unit will be in?
  3. How are the actions of that unit decided?
  4. How does it affect numAIg?
  5. How do named units affect numAIg?
  6. Nameless private rifleman does nothing, just stands there for me, and I'm wondering why...

1) yes, you got it right --- no name = participate in massive attack, has name = stands there or follow waypoints from editor
2) class is not important for editor / pre-placed units
3) when massive attack starts there is only one order - attack known enemy base
4) numAIg = number of spawned groups + number of pre-placed groups
5) they are included in the number of pre-placed groups
6) that has nothing to do with name; for pre-placed units you either :

  • create waypoints – scripted mission
  • put some of these in init line of the leader :
null = [group this,(getPos this),250] execVM "WICT\AI\BIN_taskPatrol.sqf";

null = [group this,(getPos this),250] execVM "WICT\AI\BIN_taskSweep.sqf";

null = [group this,(getPos this)] execVM "WICT\AI\BIN_taskDefend.sqf";

zapat : thanks, actually answer #6 answers my #2 and most important question: I need to initialize the pre-placed units for class-like behavior.

There is not much point in initializing the pre-placed units for class-like behavior, since you will be in the base - I guess.

Now if really you want to do so use in init line of the leader :

null = [] spawn {sleep 10; this doFSM ["WICT\AI\infantry2W.fsm", [0,0,0], this];};

and after 10 seconds they will attack -- assuming that WICT started and that there is known base! Just read manual to see which AI you should use.

Excluding units from WICT AI – scripted missions[]

Groups with human player(s) are automatically excluded from global AI, namely global assault and mounting static weapons!

Richey79: I think it's a good thing that WICT takes over all available units once turned on, although in an ideal world, there would be the option to tell it to exclude certain units.

If you don’t want WICT to influence AI behavior of some unit(s) you created in the editor, you just have to give the name to that unit (any string is ok). The script will check the name of the variable which contains a primary editor reference to this object. This is the variable given in the Insert Unit dialog / name field, in the editor. It can be changed using setVehicleVarName.

  • Note 1: the script will actually test if the group contains alive units that are named. I made decision to set it up this way because it opens some new possibilities – when named unit(s) is(are) dead, the group is able to participate in the (next) global assault which can be really convenient. But it also means that you have to name all units in the group if you want to prevent that behavior for the group.

This will allow you to create scripted missions. Units in the vehicles will return the vehicle name, so it is quite enough to name the vehicle that already has a crew at beginning of the mission (not boarded somehow after – in that case, all crew members must have a name before boarding and vehicle must have a name).

However, if the WICT is still running in the background it might attempt to clear the memory (once it reaches WICT_numAIg). Read about Changing performance settings and number of AI groups. You have to expect that dead units / groups and abandoned and damaged vehicles will be deleted.

  • Note 2: Check note 1. This means that when the vehicle is destroyed (units have disembarked and WICT removed damaged vehicle) crew can participate in the next global assault (if they, as individuals, don’t have names).

The ultimate solution is to stop WICT at that time or not to run it before scripted part is finished!

The WICT is compatible with scripted missions and it is designed to fully support them (since v3.0). Nevertheless, it is a tool for creating dynamic environments and free roam gameplay.

Advertisement