Scenario creation guide part 10 (The .BSF file)

Post Reply
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2215
Joined: Tue Jul 21, 2015 11:26 pm

Scenario creation guide part 10 (The .BSF file)

Post by Paul59 » Thu Dec 14, 2017 5:46 pm

Since I have already mentioned the SCENARIO.BSF file in the last instalment about reinforcements, it’s probably best to explain more about this very useful tool.

You don’t need a SCENARIO.BSF file for your scenario to work, but if you do use one it allows you to do a lot of cool things.

First, let’s just recap on how you put the SCENARIO.BSF file into your scenario, this is taken straight from part 9 of my Scenario creation guides:

Go to the main Field of Glory 2 installation folder. It should be C/Program Files (x86)/Slitherine/Field of Glory II. In there you will find a file called SCENARIOTEMPLATE.BSF.


This is a generic template script that can be used in any user made scenarios. Copy the SCENARIOTEMPLATE.BSF and paste it into your scenario folder. For my scenario, that I am using as an example, it is My Documents/My Games/FieldOfGlory2/CAMPAIGNS/ KYNOSKEPHALAI_197BC/ SCENARIOS


Now, rename the SCENARIOTEMPLATE.BSF file to exactly match your scenario .BAM file. So in this example, I have renamed it to Kynoskephalai.BSF.


Here is a list of some things you can do with the SCENARIO.BSF file:

1) Scripted AI orders: you can write more complicated AI orders than the Editor can do.
2) Reduce visibility, for the whole or part of the scenario.
3) Change the victory conditions.
4) Implement a turn limit.
5) Reinforcements (see Scenario creation guide part 9)
6) Change the numerical strength of the units
7) Change the quality rating of the units.
8 ) Allocate extra points to spend on purchasing units according to difficulty rating.
9) Allow units to leave the battlefield when they reach a map edge.
10) Hide units from view on the first turn
11) Make units static for the whole or part of a scenario.
12) Make units start the scenario Disrupted or Fragmented.
13) Enable messages to appear during the scenario.

I have done all of the above in my scenarios for Field of Glory 2 and Pike and Shot, and I have no doubt that there are a great many other things that are possible. Please bear in mind that I have no training or previous work experience in scripting, so don’t let the apparent complexity put you off. All that I can do, I have either figured out for myself, or RBS has advised me. If there is something you can’t work out, just ask on this forum, I am sure someone will be able to help.

It would take far too long to explain how to do all the things in the list above, but I shall give you a few pointers, and explain some of the simpler stuff, and that should get you started.

It is highly recommended to use a Text Editor, such as Notepad++, to edit the .BSF file. Notepad++ can be downloaded for free.

In it’s basic unaltered form the SCENARIOTEMPLATE.BSF file only has two slight effects on your scenario:

a) It slightly varies the number of men in each unit.

b) It also activates the Reskin function, so that your units will automatically use the available range of textures in the games texture folders. It will override any texture allocations you have made in the editor. If you do not want this to happen, open the .BSF file and search for the two lines that start with ReSkinArmy, and put two back slash characters in front of the lines, so it looks like this:

// ReSkinArmy(0, 0);
// ReSkinArmy(1, 0);

The back slashes tell the game not to read these lines.

If you don’t mind this feature, just leave the ReSkinArmy lines as they are.

The generic SCENARIOTEMPLATE.BSF file contains 9 functions, you can add more if you need to. Here is an example of a function from my Elephant Victory scenario:


It is FUNCTION StartTurnPost(side), which is where you can put any scripted AI orders. This one contains orders for two of the Galatian army’s teams, that are slightly more complex than the orders that are possible using the Editor.

if (side == 1) refers to the AI side, side 1.

if (GetTurn() < 5) means that the following order is in effect before turn 5. Please note that each side has separate turn numbers, so that Side0’s turns are numbered 0,2,4,6,8 and so on. Side1’s turns are numbered 1,3,5,7 and so on.

MoveTeamCoord(1,1,-1,-1,8); is the order that is in effect before turn 5. The first number in the brackets is the side number, the second number is the team number, the third number is the x map coordinate of the objective square, the fourth number is the y map coordinate of the objective square, and the fifth number is the AI team orders (see Scenario guide part 4). Note that when the map coordinates are -1, this means that no objective has been given. So in this case the script means that the AI side’s team 1 has no objective square, and will only react when enemy come close.

else this means that after turn 5 the following order comes into effect.

MoveTeamCoord(1,1,-1,-1,18); this is exactly the same as the pre turn 5 orders, except that now AI order 18 comes into effect. 18 is seek and destroy, but move at the speed of the slowest unit in the team.

So, in all, this script means that the AI’s team 1 will start the scenario stationary, but will react to appropriately to defend itself if enemy comes near. After turn 5, team 1 then goes on to attack the nearest enemy. If we had input non negative map coordinates, the team should head in that direction to reach the objective square.

The second set of scripted instructions gives the same order to team 4.

The second function we will look at is FUNCTION PreBattleSetup().


The two most usual things to do with this function are:

a) Change the Strength Multiplier. This multiplies the strength of all the units in the scenario by the value that you input. It is very useful if you are designing very large or very small battles. With a standard scale of one figure equals 60 men, and a recommended limit of 64 units per side, the game is really only suitable to model battles of about 10,000 to 30,000 men. To model anything bigger or smaller than that you can change the strength multiplier to change the size of the units.
b) Set a scenario deadline. User designed scenarios will just carry on until one side loses, but you can specify a deadline. This is useful in a number of circumstances. I usually use it when one side has a big advantage in numbers, but I want to force them to attack and win within a certain time limit.

These are very straightforward to do. For the Strength Multiplier just change the number in the brackets in this line:

SetUniversalVar("StrengthMultiplier", 100);

100 means 100% of standard strength. So if you change this to 200, all units will be 200% of their normal strength, so a legionary cohort will be 960 men instead of 480 for example.

To get a scenario deadline, remove the back slashes from this line:

// SetUniversalVar("ScenarioDeadline", 32);

and change the number to the turn limit that you want. Remember that each game turn is actually two turns, a side 0 turn and a side 1 turn. So the 32 that is input in this case would actually give a turn limit of 16 game turns. You can change it to whatever you want.

The best thing to do is open up a few scenario .bsf files (either vanilla or user made) and try to work out what the scripts do. You might have played a scenario and noticed an unusual feature, such as the limited visibility at the start of my Castulo scenario. If you take a look at the .bsf file you might find out how it was done.

Good luck!
Field of Glory 2 Scenario Designer - Age of Belisarius, Rise of Persia, and Wolves at the Gate.

TT Mod Creator

Post Reply

Return to “Field of Glory II: Scenario Design”