Log in

View Full Version : Historical Battles - modding guide



barocca
06-27-2004, 04:13
This is ancient, compiled in 2002 when all we had was the Demo to work with.

This is on my website, but i have lately received several requests for help with making Historical Battles,
so I think it needs to be here, where it is easy to find.

I am going to have a quick read through and remove references to the Demo (but if i miss any please forgive me)

If anyone has updated information to add to this please do so

NOTE several battles that were in the Demo are NOT in the full release
an odditty that anyone who has the demo installed on their machine can help with by zipping and uploading the Demo's Historical Battles

(post in this thread if and when you do, thanks, B.)
As Such, many references here are to the Jaffa battle,
I do hope you can translate the info across, i dont have the time right now to translate a current battle

==== ====

The Historical Battles Modding Guide
21 August 2002

This Document is a compilation of all the modders notes I have at hand, and the result of numerous trial and error experiments,
written by (in no particular order) DrNo, TosaInu, the Count of Flanders, Choco, Tarrak/Kraxis, ShadesWolf, 96mgb, Swoosh So, Target, Siena72, Emp. Conralius, verysoon, Target, GilJay and all those others I have forgotten, or just as important those whose questions inspired us to try (oh yes, and me - barocca)

If anyone has anything to add please contact me at
The Org's Modding Forum edit 28/6/04: (now called the Dungeon)
- where you will also find all of the wise men I have listed above.
edit 28/6/04: (some have gone, some are still here

the required files can be found in the subdirectories of this folder:
Medieval - Total War\Battle\batinit\Historical Battles\


Battle Description/Definition File (the bdf)

Locations
../Medieval - Total War (Demo Version)\Battle\batinit\Historical Battles
../Medieval - Total War (Demo Version)\Battle\batinit\Tutorial

The Battle Definitions File (ie Jaffa.bdf) lists all the parameters for the battle.
Here is a explanation of all the fields in the bdf that can be edited and what values(keys) work, and some that don't
(Edit the bdf file using notepad)

The first section of the bdf file, descriptions and movies was disabled in the Demo,
as such I have not yet tested where to make the changes to display the data,
if anyone can post an explanation of this section and how to make use of it, i will be most appreciative

StartposName::"early"

Predefined::true
Title::"StamfordBridge_Title"
Author::"Ian Roxburgh"
Rating::"StamfordBridge_Rating"
Description::"StamfordBridge_Description"
Conditions::"StamfordBridge_Conditions"

IntroFMV::""
OutroFMV::""


one line can probably be changed (UNTESTED)
StartposName::"early"
hopefully this allows you to call a different startpos file,
and thus should allow Historical Battles in the Viking Invasion Era

(the rest seems not much changed between the Demo and the Full Release
- NOTE some new ai commands were added to the Viking Expansion Pack - they are explained in the third Post in this thread)

//Map - Terrain - Weather

(sample)
MapName::"Jaffa"
Architecture::AT_ISLAMIC
Terrain::LUSH
BattleType::BATTLE_TYPE_HISTORICAL
Deployement::true
Season::spring
WeatherSequenceId::0

MapName::"Jaffa" - obvious - the map

Architecture::AT_ISLAMIC
//Architecture::AT_WESTERN_EUROPEAN
//Architecture::AT_SOUTHERN_EUROPEAN
These are building types. Choose the style that suits your Mod.

Terrain::LUSH
//Terrain::ARID
//Terrain::ROCK_DESERT
Terrain Type - unsure of effect on weather

BattleType::BATTLE_TYPE_HISTORICAL - set this key to avoid tutorial messages
//BattleType::BATTLE_TYPE_TUTORIAL - leaving this key in this field for a Mod on a Tutorial may have unforseen consequneces.
These consequences include the tutorial instruction boxes appearing, and no battle results display at the conclusion of battle

Deployement::true
not enabled?, could find no function for this field.

The Next 2 fields in combinataion are supposed to determine the weather,

Season::spring - valid choices spring, summer, winter, autumn
//Season::summer
//Season::autumn
//Season::winter

WeatherSequenceId::0
0 - very sunny
1 - sunny
2 - stormy - fog - rain
3 - cloudy - fog - snow - even in Season::summer
numbers above 3 work, but produce same weather as 3,
Try different combinations of season and weather.

//Player Descriptions

The 'player' description line, each army/faction (adf) in the battle will need it's own description line.
(sample)
Player::"Richard Coeur de Lion" 5 5 LOCAL "richard" 0 false 19588 28226 180 CHRISTIAN_CULTURE

Fields and values of the Player line

First number after player name is the faction. i.e. 5 Second number is the alliance it belongs to. again 5.

Faction Table
Number, Name

Early, High and Late
0.REBEL 1.ALMOHAD 2.BYZANTINE 3.DANISH 4.EGYPTIAN
5.ENGLISH 6.FRENCH 7.GERMAN_HRE 8.ITALIAN 9.POLISH
10.RUSSIAN 11.SPANISH 12.TURKISH 13.ARAGONESE 14.BURGUNDIAN
15.GOLDEN_HORDE 16.HUNGARIAN 17.NOVGOROD 18.PAPIST 19.SICILIAN
20.SWISS

Viking
UNTESTED - i do NOT know if you can make historical battles on the Viking Factions
0 FN_00 // Rebels
1 FN_01 // Irish
2 FN_02 // Mercians
3 FN_03 // Northumbrians
4 FN_04 // Picts
5 FN_05 // Saxons
6 FN_06 // Scots
7 FN_07 // Vikings
8 FN_08 // Welsh




LOCAL/ARTIFICIAL is Human or AI,
(I set 2 armies to LOCAL and ended up with waiting for deployment to end. i.e. no other human connected to deploy the other army.)

"Richard" is the army definition file name.
(the Demo will look for Richard.adf)
You can change the names of ALL the adf files to suit yourselves, as long as the bdf has the correct names for them.

Not sure what the 0 is for. I have seen different numbers in different bdf's - best to leave alone,
IFF, however, you do find out what this field does, please let us know.

true/false dictates if you are attacker/defender.

The coordinates (maybe) for initial camera postion (Will have to check that one) seems to be both for when you first enter the map, and camera returns here when you press "Continue"

Next is direction of facing. (in this case 180 degrees)
It would be wise to have opposing armies facing each other

And then culture lastly. Possibly tells the demo which names to use for units without a defined InitialLeaderName(an adf parameter).
CHRISTIAN_CULTURE or MUSLIM_CULTURE or CATHOLIC_CULTURE
There could be many more of these, possibilities could be PAGAN, ORTHODOX, JEWISH, GERMAN, FRENCH etc. etc. - untested

//Triggers (Victory Conditions) (sample)
Trigger::1, BT_GENERAL DIED, factions 5, LABEL "Keep King Richard alive.", INVERT_CHECKBOX

The Combination of Triggers results and groups determine the victory conditions, and to which faction/army they apply

//triggers
Trigger::1 - 2 - etc.
Simply Trigger number, needed for victory/defeat calculation
there are 2 Triggers avaiable to us for Demo
BT_GENERAL DIED - general died
BT_INCAPACITATE - all army routs

factions - faction/s this trigger applies to

LABEL "Insert any appropraite text here"

INVERT_CHECKBOX
This applies to Human Defeat Triggers,
It Means - If this event has NOT occured then Mark the Checkbox as Sucessfully Completed

//Results

Result::1, - Result ids number - simply an index number
alliances 5, - alliance this result applies to
style DEFEAT/VICTORY, - Outcome
battle "Jaffa" - Defeat Message to be displayed - cannot change this message - not required for VICTORY result.
(sample)
Result::2, alliances 5, style VICTORY
self explanatory now

Additional Notes
In a multi army battle to ensure ALL enemy factions(armies) MUST be defeated a trigger like this is required
(sample)
Trigger::2, BT_INCAPACITATE, factions 4,1,12 LABEL "Defeat the Enemy."

Factions 4, 1 and 12 must rout or be eliminated If all enemy factions are not listed simply routing or eliminating ONE faction completely will cause victory

//Groups

This is the list of events generated by triggers,
and which results to display for each trigger,
THE Group:: tag itself seems to have little actual meaning, other than a 'pointer' or marker,
changing the order of the tags OR which Group contains which result seems to make no difference.

Group::1, - First Item in Battle Summary screen (? not always?)
PRIMARY - Demo only allows PRIMARY triggers, meaning absolute conditions.
Has This Been Changed for Full Release??
triggers 1 - Trigger number
result_ids 1 - Which result to use for this trigger

(sample)
Group::1, PRIMARY triggers 1 result_ids 1
Means if Primary Trigger 1 occurs display results 1

And thats all there is for the Battle Definition File.

Examples of Trigger sets

Kill The General

//triggers
Trigger::1, BT_GENERAL DIED, factions 5, LABEL "Keep King Richard alive.", INVERT_CHECKBOX
Trigger::4, BT_GENERAL DIED, factions 4, LABEL "Kill Saladin."

//results
Result::1, alliances 5, style DEFEAT, battle "Jaffa"
Result::2, alliances 5, style VICTORY

//groups
Group::1, PRIMARY triggers 1 result_ids 1
Group::4, PRIMARY triggers 4 result_ids 2

In this trigger set Defeat Occurs if the AI General Survives the battle, even though the AI was routed from the field
(You will have to escape out if Your army routs and your general was not killed - automatic defeat,
If you fail to kill enemy General, and his army routs you will also have to escape out - again automatic defeat, but then the goal was to Kill the general after all)

Kill the General combined with a standard trigger set
//triggers
Trigger::1, BT_GENERAL DIED, factions 5, LABEL "Keep King Richard alive.", INVERT_CHECKBOX
Trigger::2, BT_INCAPACITATE, factions 5, LABEL "Don't Let Your Troops Rout.", INVERT_CHECKBOX
Trigger::3, BT_INCAPACITATE, factions 4, LABEL "Rout or Kill Saladin's Army."
Trigger::4, BT_GENERAL DIED, factions 4, LABEL "Kill Saladin."

//results
Result::1, alliances 5, style DEFEAT, battle "Jaffa"
Result::2, alliances 5, style VICTORY

//groups
Group::1, PRIMARY triggers 1 result_ids 1
Group::2, PRIMARY triggers 2 result_ids 1
Group::3, PRIMARY triggers 3 result_ids 2
Group::4, PRIMARY triggers 4 result_ids 2

In the example above
Trigger 1 OR 2 will result in defeat,
Trigger 3 OR 4 will result in victory,
Triggers 1 and 4 will result in an Instant Result, if the general is killed the game ends

END BDF EXPLANATION
== ==

barocca
06-27-2004, 04:14
Army Description/Definition File (the adf)

The adf contains a list of all the units in a faction/army, Each adf must have a line in the bdf player section in order for the units to be deployed.
Each unit listed in the adf must have a seperate Unit Parameter Set.
Each Unit Parameter Set defines all the information needed by the game to deploy am individual unit.
(unit parameters are located between UnitStart:: and UnitEnd:: )

You can place as many units as you wish in an adf file, the game will read and initially deploy only the first 16 units in the list at their specified locations, the remainder will arrive as reinforcements after units are withdrawn, destroyed or routed completely from the field. You will be given an option to select a rally point for reinforcements.

You can optionally specify units in the adf as reinforcements with a time delay option. See Reinforcements.


Sample adf file


UnitStart::"Unit"
InitialLeaderName::"Richard"
IsGeneral::true
Position:: 19000 29500
Direction::180
GeneralRank::4
LeaderHonour::4
UnitMon::1
TroopType::LateRoyalKnights
TroopNum::20
TroopHonour::4
Columns::5
CurveRadius::1
FormationType::FORMATION_CLOSE
MeleeMode::ENGAGE_AT_WILL
FatigueLevel::FRESH
HoldPosition::true
GeneralIsDaimyo::true
ArmourLevel::1
WeaponLevel::2
Reinforcements::180
UnitEnd::

UnitStart::"" and UnitEnd:: are the begin and end of each unit description
(Edit the adf file using notepad)


UnitStart::"Unit"
- Seriously, unsure of requirements for this field, Unit works for me, I also use this as a 'name' for the unit to help me create my mods, ie spearmen1, spearmen2 etc.


InitialLeaderName::"Richard Coeur de Lion" - optional parameter
Does NOT have to match the name given in the bdf file
I have seen identical Leader names work AND crash game
- recommend different names each unit


IsGeneral::true //IsGeneral::false - optional parameter
Is the General of this army - the game will select the first unit found in the list with this parameter as the general, If no units with this parameter the first unit in list is the General
- if he flees army morale suffers.
However in order to get the Honour/Valour boost All units within an adf need this parameter I recommend setting your General to True and all subsequent units to false.
Omitting this parameter from any unit in the adf will simply mean no units in his army, including his own unit, gain an honour boost from the Generals Rank.


Position:: 19668 29556
Start location on map
Selecting an area beyond the edge of the map will force that unit (or army) to march onto the field before they can be controlled. The further off the map the longer it will take them to march into play.
You can only use positive numbers, meaning you can only place them beyond the edge of the map on two side of the field of the field. You can start an army at locations as low as 100 on the other two sides, but they will appear on the field almost immediately.
Often when you place an AI controlled army on the map as soon as the battle starts they will move somewhere else. If they are supposed to be protecting your flank this can be a problem. You can place them a select distance off the map and force them to arrive a little late, and thus delay them moving to an undesireable location.


Direction::180
direction of facing on map


GeneralRank::6 - optional parameter
Rank - Each 2 ranks generates an additional Honour point to all units IF this unit is the actual general of the army AND the IsGeneral parameter is included int the Unit parameters of all units in the adf.
not sure of upper limit


LeaderHonour::10 - optional parameter
The Generals personal Honour - applies to him only
not sure of upper limit


UnitMon::1 - optional parameter
may not be used by game - other numbers have no effect


TroopType::Archers
unit type, do not use space's,
upper or lower case work for most units,
but the best bet is capitalise individual words
for example : ItalianLightInfantry


TroopNum::180 - optional parameter
- if omitted default is 9 men
how many men in unit


TroopHonour::9 - optional parameter
- if omitted default is 1
with the addition of generals rank bonus some astronomical numbers can be reached
upper effective limit is 16


Columns::60 - optional parameter
- if omitted default is 3 coloumns
how many columns from left to right,
a unit of 60 men in 20 columns will be 3 ranks deep


CurveRadius::1 - optional parameter
do not know - plain and simple.


FormationType::FORMATION_CLOSE - optional parameter
- default is Close
initial unit formation
FORMATION_LOOSE also works
FORMATION_WEDGE does not


MeleeMode::ENGAGE_AT_WILL - optional parameter
- defaults to engage for foot and cavalry or skirmish for missile troops
initial melee mode
SKIRMISH works for missile units
HOLD_FORMATION does not seem to work


FatigueLevel::FRESH - optional parameter
- deafult is Fresh
TIRED produces units who are Quite Tired, and will never recover to any state above that
EXHAUSTED produces Exhausted unit, again no recovery,
other fatigue levels crashed Demo.


HoldPosition::true - optional parameter
do not know - plain and simple.
changing value had no noticeable effect


GeneralIsDaimyo::true - optional parameter
The General of this Unit is the King of this faction,
again the game finds the First such List in the adf and ignores subsequent references


ArmourLevel::4 - optional parameter
- default is none
Additonal Armour Bonus (upper limit not known - possibly 4)
(similar to Armouries from STW)


WeaponLevel::4 - optional parameter
- default is none
Additional Weapon Bonus (upper limit not known - possibly 4)
(similar to SwordSmiths from STW)


Reinforcements:: (by Target) - optional parameter
You can force units to act as a reinforcement and delay the time when they become avaiable.
so, if you want a unit to wait 5 minutes before coming on as a reinforcement,
set this parameter to Reinforcements::300
This can be applied to any unit, so you can set up scenarios where you start the battle with only 4 units and then eventually another 12 turn up.
Unfortunately, this also highlights a bug in the game (which, under normal circumstances you'd never see, so I don't feel really guilty about it) that if your 4 units get crushed before the other 12 turn up, you'll have to twiddle your thumbs until the rest of your army turns up. (Target)


UnitEnd:: - end of this units parameters


The Absolute minimum required for an ADF is

//
// Army description file
//

UnitStart::"Unit"
Position:: 23000 44500
Direction::180
TroopType::Housecarle
UnitEnd::

This will give a unit of 9 Housecarle's of honour 1 in 3 columns,
The unit is a General's unit, although the General has no rank and no honour (possibly his personal honour is One)

END ADF EXPLANATION

barocca
06-27-2004, 04:15
AI TRIGGERS
NEW for the Viking Expansion
this is from a little obscure text file that appeared in the historical battle folder after i installed the ex-pack.

Introduction
============
A new feature for the add on is the ability to control the ai in historical battles. This is done by placing commands (henceforth called actions) in the .adf file for each faction. The overall stance of the ai can be set, as well as more specific instructions being given. In addition the arrival and positioning of reinforcements can be controlled. A trigger system is provided so that new instructions can be given according to how the battle unfolds.

Contolling the Human Player's Forces
====================================
Commands and triggers may also be specified in the .adf file for the player's army. Obviously the commands that relate to the a.i. will have no effect, but it does allow the arrival of reinforcements to be controlled.

UnitTags
========
Triggers and actions refer to specific units by using the unit's unitTag. The unit tag is specified as part of the block of information for the unit. The tag must be a positive number greater than 0.

UnitStart::"Unit"
// Other unit stuff here
// ...
UnitTag::1 // Give this unit the UnitTag 1
UnitEnd::

More than one unit can be given the same UnitTag. Actions will then apply to all units with the UnitTag. Triggers will be true if the specified condition is true for any of the units with the UniTag.

Units that aren't referenced by any action or trigger, don't need to be given a UnitTag.
Triggers and actions only ever apply to units of their own faction, even if they refer to a UnitTag that has been given to another faction's unit.

Triggers
========
Triggers are used to detect events in the game. They are called triggers, because generally they are used to trigger some action. However, they are actually more like conditions that can be true or false at any given time. A trigger may start off false, become true, then become false again. A trigger can change any number of times over the course of a battle. However, any action that is specified to start when a trigger is true, only starts the first time a trigger becomes true.

A trigger is specified outside of all UnitStart..UnitEnd blocks. It has the basic form

DefineAiTrigger::id type parameters..

id is a positive integer above 0. This is used to identify the trigger in actions and other triggers
type is the type of trigger. This is followed by any extra parameters needed by that trigger type. The number of parameters varies according to the trigger type.

The following trigger types are available.

AFTERSTART n
Becomes true n seconds after the start of the battle.

ENEMY_NEAR_UNIT unitTag, d
True if any enemy units are within d metres of any unit with the given unitTag

ENEMY_NEAR_ANY d
True if any enemy is within d metres of any of the faction's units

ENEMY_NEAR_POINT x y d
True if any enemy unit is within d metres of point x,y (in map co-ordinated)

UNIT_ENGAGED unitTag
True if any of the given units is in melee

ANY_UNIT_ENGAGED
True if any of the faction's unit is in melee

UNIT_UNDERFIRE unitTag
True if any of the given units is being shot at

ANY_UNIT_UNDERFIRE
True if any of the faction's units is being shot at

ON_FIELD unitTag
True if any of the given units is on the battlefield. This can be used to detect when a reinforcement arrives, or in combination with a "NOT" trigger to detect when a unit has been destroyed or routed off the field

UNIT_ROUTING unitTag
True if any of the given units are routing

ANY_UNIT_ROUTING
True if any of the faction's units are routing

GENERAL_DEAD faction
True if the general of the given faction is dead. The number of the faction must be given, not the name

BREACH_MADE x y
True if a breach has been made to the castle area that contains the point x y. Also true if a gate to that area has been forced open.

AND trigger1 trigger2
True when both trigger1 trigger2 are true. trigger1 and trigger2 are the numeric ids of the other triggers. The "AND", "OR" and "NOT" triggers can be used to build up complex conditions.
Note that both triggers must be true at the same time for the trigger to be true. If one of the triggers has become true, but has changed back to false at the time the other trigger becomes true, then the "AND" trigger will not become true.

OR trigger1 trigger2
Similar to the "AND" trigger, but true if either of the two triggers is true.

NOT trigger
True if the given trigger is not true. This is used to invert the sense of triggers, for example to create a trigger that is true if a specific unit is not routing.

AFTERTRIGGER trigger n
Becomes true n seconds after the given trigger becomes true. This trigger then stays true until the end of the battle. Use a time value of 1 second to create a trigger that is true if another trigger has ever been true.

Actions
=======
Actions either cause something to happen on the battlefield, or give instructions to the ai which will cause its behaviour to change. Some actions are one time things that happen when a specific trigger becomes true. Others specify an instruction that remains in force for a certain amount of time. The latter type may begin when a trigger first becomes true, or be in force at the start of the battle. Similarly they may last unitl another trigger becomes true, or for the remainder of the battle. Once an action has ceased, it never starts again.

Actions are specified in the follwing way.

AiAction::StartConditon [UntilTrigger t] ActionType parameters.

StartConditon is either
AtStart or
OnTrigger n

UnitilTrigger is optional. If used the action will cease when the given UntilTrigger becomes true.

ActionType is the type of action. It is followed by a number of paramaters that depend on the action type.

The following actions are available.

SETSTATE state
Sets the overall status of the faction's ai. States may be
Off : The ai is deactivated
MeleeOnly : The ai will not move its units unitl enemy come near. The ai will not shift its position, but will
move its units sensibly to defend itself. This is state is useful if you want to set up the ai's
units in a specific way, and don't want it to rearrange them
ExplicitOnly : The ai will only do the actions that are specified in this .adf file
Full : The ai acts normally.


BATTLE_PLAN plan
Forces the ai to use the given battle plan. It then decides the best way to carry out this plan. Available plans are

AttackMainBody : Attack the strongest group of enemy
Attack : Attack any or all groups of enemy
Defend : Take a defensive stance. If possible find a piece of terrain to defend
DefendRiver : Defend any river crossings
Hide : Go and hide in the woods
Scout : Send out units to look for the enemy
Withdraw : Withdraw all units from the battlefield
AttackCastle : Try to storm the castle
DefendCastle : Stay in the castle
Skirmish : Split missile troups into several groups and attempt to surround the enemy
DoNothing : Choose no particular plan. This doesn't mean the ai will do nothing, but it will behave
in a rather aimless manner.

DEFEND_LINE lx ly rx ry
Instructs the ai to defend the line between point lx ly (the left end of the line) and rx,ry (the right end of the line).
If the ai is in the full state, then this instruction will be added to the list of things it wants to do (together with the things it's thought of itself ) and it will split its units between them. In some circumstance this means that no units will be allocated to defend the line if they are needed elsewhere.
If this becomes a problem, put the ai in the "ExplicitOnly" state in which case it will only assign units to actions it has been specfically instructed to do.

ATTACK x y d
Instructs the ai tp attack any group of enemy who are within d metres of point (x y). Again if the ai is in the "full" state, it may decide not to carry out this instruction.

RELEASE_UNIT unitTag
The ai will be prevented from using the given unit( or units) until this action is activated.
The ai is only prevented from using units mentioned in a RELEASE_UNIT action. It is free to use all other units without them having to be specifically released.

DISALLOW_OUTFLANKING
Instructs the ai not to try to outflank the player. This is useful if you want to force the ai to make a head on assault.

BRING_ON unitTag
Bring on the reinforcement unit(s) with the given unitTag. If 16 units are already on the field, the reinforcement will be brought on as soon as possible

SET_RALLY_POINT x y
Set the rally point to point x,y. This determines where reinforcements enter. A line is drawn from the centre of the map through the rally point to the map edge. Reinforcements come on at the point where this line crosses the map edge. However units must come on at point within 90 degrees of their faction's home direction (as seen from the centre of the map). Reinforcing units march to the rally point when they've come on.

Examples
========

Turn off the ai completely until the enemy get within 150 metres of any of its units.

DefineAiTrigger::1 ENEMY_NEAR_ANY 150
AiAction::AtStart UntilTrigger 1 SETSTATE off

Bring on a reinforcement when a specific unit of the player's routs, or has been killed. To prevent the player just routing the unit, specifiy that it must also have been engaged in combat. Also the reinforcement isn't available for the first ten minutes of the battle.

// Give the unit that must rout the UnitTag 1
// Give the unit to come on, the UnitTag 2
DefineAiTrigger::1 UNIT_ROUTING 1
DefineAiTrigger::2 ON_FIELD 1
DefineAiTrigger::3 NOT 2 // True if the unit is not on the field. ie it has been destroyed
DefineAiTrigger::4 OR 1 3 // True if the unit has been destroyed or routed
DefineAiTrigger::5 UNIT_ENGAGED 1
DefineAiTrigger::6 AFTERTRIGGER 5 1 // True if the unit has ever been engaged
DefineAiTrigger::7 AND 4 6 // True if the unit has been engaged, and is now destroyed or routing
DefineAiTrigger::8 AFTERSTART 600 // True 10 minutes after the start of the battle
DefineAiTrigger::99 AND 7 8 // The final fairly complex condition
AiAction::OnTrigger 99 BRING_ON 2 // Bring on the reinforcement on trigger 99

Now a more complex example.Suppose you deploy the bulk of the ai army on a hill, with a small group in ambush on the left flank.

You want to cater for three courses of events.
i) The player attacks the main force on the hill, in which case you'd like the ambushers to come and help
ii) The player moves around the ai left, in which case you want your ambushers to attack, but the main force to stay put
iii) The player moves round the ai right flank, in which case your set up is useless, so you'll just turn the ai on and let it sort it out.

// Give the units on the hill aiTag 1
// Give the units in ambush aiTag 2

// Set the ai state to only set objectives specified here
AiAction::AtStart SETSTATE explicitOnly

// Set up three triggers to detect the three conditions.

DefineAiTrigger::1 ENEMY_NEAR_POINT 5000 5000 100 // Enemy coming round left
DefineAiTrigger::2 ENEMY_NEAR_POINT 25000 5000 100 // Enemy coming round right
DefineAiTrigger::3 UNIT_ENGAGED 1 // Group on hill is engaged

// Make trigger 5 true if any of the above are true. Use this to release the ambush units
DefineAiTrigger::4 OR 1 2
DefineAiTrigger::5 OR 3 4

// Now the actions
// Enemy attack the centre
AiAction::OnTrigger 3 DEFEND_LINE 15000 5000 15000 5000 // Defend the hill
AiAction::OnTrigger 3 RELEASE_UNIT 1 // Release the units on the hill

// Enemy attack the left
AiAction::OnTrigger 1 ATTACK 5000 5000 100 // Attack the enemy on the left

// Enemy attack the right
AiAction::OnTrigger 2 SETSTATE full // Turn the ai on
// Since this action if further down, it overides the action specified at
// start to set its state to ExplicitOnly
AiAction::OnTrigger 2 RELEASE_UNIT 1 // Release the units on the hill

AiAction::OnTrigger 5 RELEASE_UNIT 2 // Release the units in ambush whichever of the above happends

END AI TRIGGERS

barocca
06-27-2004, 04:22
NOTE
i think faction Flags need to be included in the Historical Battles folder - as a tga,
ALSO unit shilds may need to be included, - as a bif file,

both of these need investigation,

this post is a "holder" where i will input such data as it becomes available
B.

barocca
06-27-2004, 04:23
HOLDER
this post is a holder for any further data that may be required
B.

ShadesWolf
06-27-2004, 12:54
Good work http://www.totalwar.org/forum/non-cgi/emoticons/gc-2thumbsup.gif

A few points......

There is a command called reinforcements, this allows for any specified unit to appear on the battle field at a given time.

secondly, I have not yet managed to get any other start files to work with the game. The only one that seems to work is the main Crusader file http://www.totalwar.org/forum/non-cgi/emoticons/angry.gif So please keep this in mind if you have any add-on with new units that dont appear in the original file.

The Blind King of Bohemia
06-27-2004, 14:57
Please tell me if you do Shades....I'd love to do a fall of Acre with my new Crusader units.

barocca
06-27-2004, 17:19
reinforcements is listed, near the bottom of the ADF explanation,


I have some historicla battles for Patrician floating around, i'll go look see how King David managed to add his new units,
BRB

B.

barocca
06-27-2004, 17:22
okie - he added his units to the end of the crusader unit file,
which is what you have to do to fix deadpages anyway,
so no major biggie?

it means you cannot include new units from a game mod unless those units have been appended to the crusader unit prod.

B.

barocca
07-04-2004, 11:49
anyone have anything to add?

if not then the weekend of 10 July will see this topic trimmed and sent off to repository,

cheers,
B.