Hi I try to develop a mod containing several scenarios with Roman units fighting Roman units. I'm using the units to represent cohorts like the value of 480 for TotalMen for legionaries units in Squards.csv seems to indicate.
For one of the scenarios I would like the Roman Legionaries of one side to be depleted (due to previous battles) while the same units of the other side are still complete. Do I need to create depleted versions of the Roman Legionaries unit in Squads.csv in addition to the complete unit? Or can this be done by scripting, by type of unit or also by individual units like Roman Legionaries unit 1 down to 50% and Roman Legionaries unit 2 down to 80%?
I have no experience yet with scripting but am willing to try.
Creating depleted units
Re: Creating depleted units
You can do it either way, but if you have no experience of scripting it might be much easier to just create a depleted unit in the Squads.csv file. A few things you need to be aware of though:Pi-R wrote:Hi I try to develop a mod containing several scenarios with Roman units fighting Roman units. I'm using the units to represent cohorts like the value of 480 for TotalMen for legionaries units in Squards.csv seems to indicate.
For one of the scenarios I would like the Roman Legionaries of one side to be depleted (due to previous battles) while the same units of the other side are still complete. Do I need to create depleted versions of the Roman Legionaries unit in Squads.csv in addition to the complete unit? Or can this be done by scripting, by type of unit or also by individual units like Roman Legionaries unit 1 down to 50% and Roman Legionaries unit 2 down to 80%?
I have no experience yet with scripting but am willing to try.
1) Just changing the TotalMen value (Column AD) will not have much affect. The actual fighting power of the unit is determined by the next column, UnitSize (column AE). For Medium and Heavy Foot, UnitSize is always 1.25 times the TotalMen value. So you will need to change both values. So if you are making a 240 man Veteran Legionary unit (full strength UnitSize 600), it's new UnitSize would be 300.
2) If you are making the unit smaller you will also need to change the unit cost value (column L). This is proportional to the size of the original unit. So if you are making a 240 man Veteran Legionary unit (full strength cost 96), it's new cost would be 48.
3) You will need to create new IDS_UNITNAME and IDS_UNITINFO entries for your new units in a Text file in your scenario folder. This will give your new units names and unit descriptions for the in game displays. Just download one of my scenarios, like Apollonia, to see how this is done.
4) Give your new units unique Name (column A) and ID numbers (column B). These only have to be unique within your squads.csv file.
Good luck
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.
Field of Glory II Medieval Scenario Designer.
FOGII TT Mod Creator
Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Field of Glory II Medieval Scenario Designer.
FOGII TT Mod Creator
Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Re: Creating depleted units
Thanks Paul59
I have already some experience with creating new units and giving them new names. Although your info that it is not enough to only change the TotalMen value.
Is the unit cost value also used for the strength? I assumed that would only be needed when creating armies, not in epic scenarios.
Still I'm curious how to do this using scripting. Can one with scripting change the above values per individual unit that has been placed on the map?
I have already some experience with creating new units and giving them new names. Although your info that it is not enough to only change the TotalMen value.
Is the unit cost value also used for the strength? I assumed that would only be needed when creating armies, not in epic scenarios.
Still I'm curious how to do this using scripting. Can one with scripting change the above values per individual unit that has been placed on the map?
Re: Creating depleted units
Unit cost does not affect the strength, but it is relevant to user made Epic scenarios, as it affects the army's rout percentages.Pi-R wrote:Thanks Paul59
I have already some experience with creating new units and giving them new names. Although your info that it is not enough to only change the TotalMen value.
Is the unit cost value also used for the strength? I assumed that would only be needed when creating armies, not in epic scenarios.
Still I'm curious how to do this using scripting. Can one with scripting change the above values per individual unit that has been placed on the map?
I've never reduced unit strength through scripting before, although I think I have seen it done, RBS will be able to tell us if it is possible and how to do it. I have used scripts to reduce quality rating, and that is limited to unit type, not individual units.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.
Field of Glory II Medieval Scenario Designer.
FOGII TT Mod Creator
Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Field of Glory II Medieval Scenario Designer.
FOGII TT Mod Creator
Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Re: Creating depleted units
Hi Paul95 thanks for your response.
So the army rout level is not based on the number of men but on the costs of the unit. Makes sense as an elite (expensive) unit being lost should have more impact than a raw (cheap) unit. Is it only based on the costs or a combination of costs and number of men?
Now I have to decide if in my scenario the impact of loosing a depleted veteran cohort should have less impact then loosing a full veteran cohort. Would a Roman soldier on the battlefield think "Oh no, one of our cohorts is destroyed. Luckily it is not that bad as it was only at 75% of full strength/size when we started this battle"? I believe I'm feeling more to not changing the costs for depleted units. Of course I do not plan to have cohorts depleted to less than 75%.
So the army rout level is not based on the number of men but on the costs of the unit. Makes sense as an elite (expensive) unit being lost should have more impact than a raw (cheap) unit. Is it only based on the costs or a combination of costs and number of men?
Now I have to decide if in my scenario the impact of loosing a depleted veteran cohort should have less impact then loosing a full veteran cohort. Would a Roman soldier on the battlefield think "Oh no, one of our cohorts is destroyed. Luckily it is not that bad as it was only at 75% of full strength/size when we started this battle"? I believe I'm feeling more to not changing the costs for depleted units. Of course I do not plan to have cohorts depleted to less than 75%.
-
rbodleyscott
- Field of Glory 2

- Posts: 28385
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Creating depleted units
The short answer is that this can certainly be scripted, in the scenario script, in the CustomiseUnits() function.
There is a file in the main directory of the build called SCENARIOTEMPLATE.BSF.
This can be used as a template for your scenario script, by copying it into your scenario's /SCENARIOS folder and renaming it to match the scenario .BAM file name.
i.e. MyScenario.BSF if your scenario is MyScenario.BAM.
To deplete all of the units on one side, you would just need to change the value of starting_strength.
e.g.
to reduce side 1 units to between 70 and 90% normal strength.// Modify number of figures to take into account current unit strength
If you wanted to deplete only certain units, you would need to write additional code to tell it which ones.
If you want the number of models to match, you would also need to add
CustomiseUnitManCount(id);
as follows
There is a file in the main directory of the build called SCENARIOTEMPLATE.BSF.
This can be used as a template for your scenario script, by copying it into your scenario's /SCENARIOS folder and renaming it to match the scenario .BAM file name.
i.e. MyScenario.BSF if your scenario is MyScenario.BAM.
Code: Select all
FUNCTION CustomiseUnits()
{
int i;
int id;
int starting_strength; // starting strength - percent of full base unit strength
// Reskin armies to randomly use available variant textures. If both sides have the same unit type, the two sides will use different variant textures for that unit if more than 1 texture exists.
// Comment out the two lines below if you don't want variant textures to be automatically applied.
// If you want to reverse which side gets which set of variant textures, change the second parameter to 1. This is useful to make the same army use the same texture set in reversed scenarios.
ReSkinArmy(0, 0);
ReSkinArmy(1, 0);
// Adjust starting unit strengths
for (i = 0; i < GetUnitCount(0); i++)
{
id = GetUnitID(0,i);
if (id != -1)
{
starting_strength = 100;
RandomiseStartingStrength(id, starting_strength);
}
}
for (i = 0; i < GetUnitCount(1); i++)
{
id = GetUnitID(1,i);
if (id != -1)
{
starting_strength = 100;
RandomiseStartingStrength(id, starting_strength);
}
}
}e.g.
Code: Select all
for (i = 0; i < GetUnitCount(1); i++)
{
id = GetUnitID(1,i);
if (id != -1)
{
starting_strength = Rand(70,90);
RandomiseStartingStrength(id, starting_strength);
}
}If you wanted to deplete only certain units, you would need to write additional code to tell it which ones.
If you want the number of models to match, you would also need to add
CustomiseUnitManCount(id);
as follows
Code: Select all
for (i = 0; i < GetUnitCount(1); i++)
{
id = GetUnitID(1,i);
if (id != -1)
{
starting_strength = Rand(70,90);
RandomiseStartingStrength(id, starting_strength);
CustomiseUnitManCount(id);
}
}Richard Bodley Scott


Re: Creating depleted units
Thanks for your help Richard,
It works. I also managed to do it only for the heavy_foot units, i.e. the Roman cohorts in my opponents army. Much better than creating depleted units in Squads.csv.
It works. I also managed to do it only for the heavy_foot units, i.e. the Roman cohorts in my opponents army. Much better than creating depleted units in Squads.csv.

