Panzer Elite Script AI Documentation
16/06/98
Overview

Scripts can be applied to combat groups only. There is no such thing as a script for a single unit. Intra-platoon tactics are AI controlled. The only thing the AI script writer can influence is the general behaviour.


Scriptblocks
A script is attached to a platoon and is divided into script blocks. Each block has a condition describing when it will be executed (event based). Three separate sets of scriptblocks can be defined and switched among.

Parameters
A scriptblock has the following parameters listed:
Name: The name of the scriptblock, limited to 10 letters
Description: Short one-liner as comment for description (like "Attack Village St. Restan")
Behaviourset: The behaviour of the platoon for this scriptblock (when and who to attack etc.)
Remove on exit:      This scriptblock will be deactivated for the rest of the scenario when it is finished or it is interrupted so another event can be executed.
Return to top: The scriptblock is started new from the beginning when it has been left for another event temporarily.
Priority: When events demand two scripts to be started at the same time, the highest priority scriptblock takes precedence.
ScriptSetIndex: A maximum of 3 Sets can be attached to a platoon. This defines the script block as being one of those three. The default is Set 1. The scriptblocks will be sorted into order by Set number. This selection is made for each scriptblock using a box in the CombatScript sub-menu.

Events
The type of event defines the circumstances underwhich the script will be launched. This can be a multitude of things and are listed below. If two events become true the priority setting (see above) is decisive which comes first. If priority is equal the order in the script block defines it (top first).
Events have up to 3 parameters. If not used they are listed as "none" below. The AI scans all script blocks and checks whether their condition is true or not. If yes, the one it finds with highest priority is exectued. If the AI does not find a script with a true event it defaults back to the always scripts. If all always scripts are removed it will continue on the last script which was executed.

Always-none-none
Default script which is executed first. Multiple always scrips can follow each other and will be executed in order top to bottom. Always scripts should have the switches defined (return to top or remove on exit).

OnWithdraw-none-none
This event is true as soon as the platoon attempts to withdraw. This scriptblock, when present, decides two things: Where to withdraw to and (if necessary) to switch the scriptset. The commands of a OnWithdraw block are predefined and are limited to:
     Withdraw-none-Area
     GotoSet-none-Set1
The withdraw AI now chooses one area which is nearest to the platoon but furthest from the enemy and goes there. When arrived the platoon switches scriptsets as defined.

TimerAt-00:00:00-none
The event becomes executed when the timer setting is true. Two timer settings are valid: absolute or relative. To make absolute timers work you need to define the scenario date and time in the settings. Times are defined as follows:
Absolute:     
Relative:
Relative:
15:45:12
+00:10:00     
*00:10:00
quarter to 4 pm
10 minutes after scenario start
10 minutes after scriptstart (NOTE: not applicable here, but used below)

GlobalEvent-Flag1..3-true/false
When userflags are set scripts can react to them. We support 3 flags only (to lessen confusion), and they can be set to true or false with scriptcommands (see below)

MissionGoal-goal-pending/success/failed
Depending on the status of defined mission goals scripts can be launched. Note that when you change the definition or name of goals you need to update the script with the correct name

CGState-CombatGroup-destroyed/withdraw/spotted/identified/scriptname/area
Depending on the state of a platoon (=Combatgroup) scripts can be launched. Parameters are:
CombatGroup:     
Destroyed:
Withdraw:
Spotted:
Identified:
ScriptName:
Area:
The group whose state is checked
when the CG is destroyed the event becomes true
when the CG withdraws
when the CG is being spotted, is true as long as the CG remains seen by enemy units
same as above, only identified (usally range is less)
If the CG executes a specific scriptname
If the CG is in a specific area

Area-area-unitlist
This event is being executed when certain defined units are in the area. The units to be defined can be choosen among the following:
Enemy:
Friendly:
Enemy/Friendly All
Enemy/Friendly Soft
Enemy/Friendly Tank     
Player All
Player Me
Player Other
UserDefined 1..3
Your opponent, depends on side your are playing
Units on your side
Any unit type
Any soft vehicle or unit (infantry, trucks, jeeps etc)
Any armored vehicles (tank, assault gun etc.)
Any player (important for multiplayer scenarios)
You, the player
Any other player but you
A userdefined type, seee definition of user types.

Script Commands
Under the event definition any number of script commands can be defined. They will be executed in order top to bottom as soon as the script is being launched. When the script is interrupted and being returned to afterwards the "Return to Top" flag determines whether the script is being continued or started all over, or even being deleted ("remove on exit" flag).

Move-How-Where
Simple move command. Note however that the behaviourset associated with the scriptblock still can force the unit to engage units it comes across.

How:
Step-by-step:     
Scout:
Normal:
Road:
Tactical movement: half moves ahead, other half spots/covers, then vice versa
Same, only one unit advances (scouts), others follow up when scout stopped
Normal formation movement
Normal movement, sticks to road (column movement)

Where:
Path     
Area
CG
Uses defined path as movement guide (moves from node to node)
Moves into specified area until all units have entered
Moves to specified Combat Group whereever they are

Engage-until-target
Engages specified target until condition is met. Conditions are:

Until:
Xxx%
15:34:00
*00:10:00     
+00:10:00
Until xxx% of target destroyed (combat group target only)
Until absolute time reaches 15:34
for limited time: 10 minutes relative of script start
for limited time: 10 minutes since scenariostart

Target:
CG:
Area:
UnitList:     
Combat Group specified
Any target within Area
Userdefined unitlist

Defend-How-Who
Defends or protects target. Defending area includes moving into the area and use strongpoints (if defined).
Defending a combat group means targetting all units targetting to be defended CG. If you want to defend a moving combat group use convoy command with that unit.

How:
Leave Area:
Stay in Area:     
Defending units may leave area to hunt attackers
Defending units will stay in area and won't leave it

Who:
Area:     
CG:
Specified area. Note: Strongpoints in area will be used
Specified CG will be defended

Withdraw-none-area
Withdraw commands, only to be used in "OnWithdraw" scriptblock. It lists alternative areas the AI analyzes and picks on from (see OnWithdraw above)

GotoSet
Activates another set of script commands. That is, the game switches to a different set of combat script commands.

Set-UserFlag1..3-True/False
Sets one of the three global userflags true or false. The global event can then react to it and change scripts or commands.

German/American-Strike1...5-Target
Issues an artillery strike immediately on target, no delay. Any delays should be implemented with the Wait command (see below).

Strike:     
Target:
Number of the artillery strike slot as in "Define Artillery Strike"
Area or CG to be targetted. Note: Targeting a CG means lots ofcasualties

Wait-Time-none
Waits a specific amount of time. Note: Events can still interrupt wait commands.

Time:
15:32:00
+00:10:00     
*00:10:00
Until scenario time reaches timer
10 minutes relative to scenario start
10 minutes relative to script start (should be the most used version)

Unload-none-none
Unloads any cargo the unit has (infantry gets activated and executes the always commands.

Reinforcement-CombatGroup
Causes an up-to-this-point 'non-existant' combat group to enter the scenario.
A combat group invoked by this command will suddenly appear at the location and facing in the direction specified in the scenario.
Up until this instant, the combat group, to all intents and purposes, 'did not exist'. It could not be seen. Artillery cannot hit it. The briefing commands can show the location where it will materialize, but if you go there looking for it before the Reinforcement command is executed, there will be nothing there.
Typically this command is used in the Global Script. An example is shown in the Ginst1.SCN instant-action scenario where one enemy combat group after another is presented to you (Zug Falke).


Behaviour Sets
Behaviour sets are attached to each scriptblock and define the general behaviour of the platoon regarding things like spotting, under fire, out of fuel etc. You attach a behaviour set to a platoon by choosing one of the presets. You can modify any of the settings for each scriptblock for customization.
The settings and their results are:

Threatlevels
ThreatLow
ThreatMedium
ThreatHigh: Range<X, Dice<X, Engage/Smoke/Ignore ELSE Engage/Smoke/Ignore

This setting defines what the platoon will do when it encounters an enemy unit. You can set the reaction depending on threatlevel and range of the unit to yours.
A threat is defined as how well the opposing unit can penetrate, ie. Damage you. A low threat is someone who barely can harm you, medium threats could harm you under circumstances, high threats can harm you by firing at you.
The range setting defines the range under which the following reaction will only be executed (ie. Units of the threat level but longer range gets ignored):
Dice<X          
Engage:
Smoke:
Ignore:
defines a random element
Attacks the unit
Provides a smokescreen to block vision (if available)
Ignores the unit

EngageTactic: Defines the tactic used when engage is executed under above conditions. A dice range is available to provide a random factor.

WithdrawCondition:
Defines when the platoon withdraws (Onwithdraw becomes true). Settings are:
Platoon<5,4...2:        
AmmoLow:
FuelLow:
GunDamaged:
When platoon strength is under value withdraw is initiated
When Main Gun ammo is low
When Fuel is Low
When Main gun is damaged

UnderAttack: Defines what the unit does when it is attacked. Options are Engage, smoke, ignore as above.

Explanation
We thought it necessary to give a platoon a set of orders what happens when the unit gets attcked, damaged, runs out of fuel etc. Instead giving global settings we allow each platoon a different behaviourset for each scriptblock. Why? Well, sometimes you want a platoon to ignore all enemy and reach a specific area before it is drawn into any combat.
If you give most units the engage command in the behavioursets the game will come to a "lock" real fast: As soon as units see each other they stop and shoot at each other. To provide dynamics and fluid battlefields the settings provide the tools to implement that:
Engage can be limited to high threats and different ranges
Engage can be set to step by step which moves closer and closer to the enemy, thus changing the threat level a swell (being close is calculated as a higher threat because you can penetrate the armor better)


User Defined Unitsets
With this option you can choose any unittype you defined in platoons and put them in a list. This list can be used for engage to pick specific units to attack. Example: The player has the mission to destroy any anti aircraft guns in the game. Now are those distirbuted among many platoons. In order to specifiy a target or event you need to put all antiaircraft guns into one userdefined group.


Updated 11/12/00 by TB3