Still working on perfecting my first scenario: the AI controlled infantry are all in thick woods but they are all visible during deployment. How do I fix that?
Also, during deployment all the human-controlled units can be moved anywhere on the map, there does not seem to be a particular deployment area, and anyway I thought I had setup a fixed deployment. How do I make the units fixed so they can't be moved at all during deployment (they say they are fixed)?
AI controlled units in forest visible during deployment
-
rbodleyscott
- Field of Glory 2

- Posts: 28323
- Joined: Sun Dec 04, 2005 6:25 pm
Re: AI controlled units in forest visible during deployment
Firstly, you will need a scenario script. In the main directory of the main build you will find a file called SCENARIOTEMPLATE.BSF.vakarr wrote:Still working on perfecting my first scenario: the AI controlled infantry are all in thick woods but they are all visible during deployment. How do I fix that?
Copy that to
/Documents/My Games/FieldOfGlory2/CAMPAIGNS/THRACIANEMPIRE/SCENARIOS
and change its name to
Odrysians_vs_Triballi.BSF
Then add the following code at the end of the file
Code: Select all
FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(x,y,x2,y2,0,0);
}
}x is the lowest x value of the map rectangle in which you want to hide the units from view.
y is the lowest y value of the map rectangle in which you want to hide the units from view.
x2 is the highest x value of the map rectangle in which you want to hide the units from view.
y2 is the highest y value of the map rectangle in which you want to hide the units from view.
Fixed does not mean they are fixed in place, but they are fixed units as opposed to units that can be purchased with points.Also, during deployment all the human-controlled units can be moved anywhere on the map, there does not seem to be a particular deployment area, and anyway I thought I had setup a fixed deployment. How do I make the units fixed so they can't be moved at all during deployment (they say they are fixed)?
In the Editor there is a toggle for whether the player gets a Deployment phase or not. It is the right hand button on the second row. To prevent either side getting a deployment phase, I think you need to set it so that there is a circle under both banners.
Richard Bodley Scott


Re: AI controlled units in forest visible during deployment
Hi Richard
I'm trying to use this for a Teutoburger Wald scenario: Romans side 0, I want the ambushing Germans hidden (if appropriate) from the start.
This scripting does what it says on the tin, i.e. the Germans are invisible from the start, BUT it also seems to prevent the Romans moving at all - you can't click on the Roman units, they can't move, and even the small Roman unit description boxes at the bottom don't show up.
If that's the only way to hide the Player 1 units on the first turn then fair enough, it is an ambush, but I had it in mind to let the Romans at least swivel in the direction of potential attackers, even if they couldn't see them. I'm using...
Function PostLOSActions()
{
If (GetTurn()==0)
{
SetAreaLOS(16,16,65,65,0,0);
}
}
Does anything spring instantly to mind? I'm an absolute dunce at scripting.
Cheers
Mark
I'm trying to use this for a Teutoburger Wald scenario: Romans side 0, I want the ambushing Germans hidden (if appropriate) from the start.
This scripting does what it says on the tin, i.e. the Germans are invisible from the start, BUT it also seems to prevent the Romans moving at all - you can't click on the Roman units, they can't move, and even the small Roman unit description boxes at the bottom don't show up.
If that's the only way to hide the Player 1 units on the first turn then fair enough, it is an ambush, but I had it in mind to let the Romans at least swivel in the direction of potential attackers, even if they couldn't see them. I'm using...
Function PostLOSActions()
{
If (GetTurn()==0)
{
SetAreaLOS(16,16,65,65,0,0);
}
}
Does anything spring instantly to mind? I'm an absolute dunce at scripting.
Cheers
Mark
-
rbodleyscott
- Field of Glory 2

- Posts: 28323
- Joined: Sun Dec 04, 2005 6:25 pm
Re: AI controlled units in forest visible during deployment
You have set the entire map out of LOS which prevents movement because you have blindfolded all of your men. You need to put in the coordinates of just the area the enemy to be hidden are are in.
I guess that if the area to be hidden isn't rectangular, you can make the whole map out of LOS then make the part the Romans are in in LOS:
I haven't tried this but it ought to work
I guess that if the area to be hidden isn't rectangular, you can make the whole map out of LOS then make the part the Romans are in in LOS:
Code: Select all
Function PostLOSActions()
{
If (GetTurn()==0)
{
SetAreaLOS(16,16,65,65,0,0); // Whole map
SetAreaLOS(x, y, x2, y2, 0, 1); // Area Romans are in
}
}Richard Bodley Scott


Re: AI controlled units in forest visible during deployment
Thanks Richard, that's given me the length but not the width, as the bishop probably said to the actress, but I see the principle and will tinker around. I can see that it will work if done properly.
Cheers
Mark
Cheers
Mark

