I have hardly found info in the forums about the art of making playable Historical Battles. I'll try to place here some useful things I have learnt, and I hope people help to increase the info.
4. Scripts
You can add a script to the battle, by adding these lines at the bottom of descr_battle.txt (and placing the script file in the same folder):
Code:
script
descr_script.txt ;write here the name of the script file
Unit Label
They are defined in the prepare_for_battle section of the script, and they are used by the rest of script commands to identify each unit.
Code:
label_unit 1 0 18 UNITLABEL
- First number is the Alliance
- Second is the Army inside this Alliance
- Third is the unit number inside this Army
Docudemon Commands
You can use into the script the commands from the docudemon file: Unofficial scripting documentation
The problem is that once you give a order to a unit, the ai stops managing it. And when the unit finalizes the action, it becomes idle, waiting for another order from the scripts.
If you want to release a unit back to AI or player control, you can use the command:
(Note it also unlabels the specified unit)
Code:
release_unit UNITLABEL
It is hard to control the units (or groups) one by one along the battle, so I have hardly used those "order" commands. I have found much more simple, and usefull, these other commands:
- unit_group_enable_automation GRP_NAME true
When this command is called, the group move quickly his units to fit one formation from formation_ai.txt. Then they keep this possition waiting for more orders. Unlike other "order" commands, with this one the AI is still active, so they still fire proyectiles and use his special habilities like warcry, skirmish...
(it is the same than when the player gives the control of a group to the ai)
- unit_group_enable_automation GRP_NAME false
This command restores the standard AI mode
Between these commands, it is possible to use a couple of commands not included in the CA docudemon, that I have seen in Alexander TW scripts. (So they might work only under Alex engine):
- unit_group_automate_attack GRP_NAME PLAYER_UNIT
Note the difference with the standard command "unit_group_order_attack_group/unit"
- unit_group_automate_defend_position GRP_NAME 194 83 100
This one places the units of the group sourranding this location, with their back pointed to the position: X, Y, Distance.
Example
I place here an script that I have used succesfully to force the AI to play defensive.
I also include a Script that makes a general invulnerable unless he is engaged in melee battle. Useful to protect him from arrows.
Spoiler Alert, click show to read:
Code:
script
prepare_for_battle
ai_active_set off ;dissable ai
label_unit 0 0 0 ELF_0
label_unit 0 0 1 ELF_1
label_unit 0 1 0 NUM_0
label_unit 0 1 1 NUM_1
label_unit 0 1 2 NUM_2
label_unit 1 0 0 SAURON
label_unit 1 0 1 ORC_1
label_unit 1 0 2 ORC_2
label_unit 1 0 3 ORC_3
label_unit 1 0 4 ORC_4
define_unit_group GRP_ELF ELF_0 ELF_1
define_unit_group GRP_NUM NUM_0 NUM_1 NUM_2
define_unit_group GRP_SAURON SAURON
define_unit_group GRP_ORC ORC_1 ORC_2 ORC_3 ORC_4
while ! I_BattleStarted ; Wait for deployment
end_while
ai_active_set on ;re-enable ai
pause_battle ; The battle starts in pause mode
; DEFENSIVE GROUP
if not I_LocalFaction seleucid
unit_group_enable_automation GRP_ELF true ;Sets defensive mode
end_if
monitor_conditions I_IsUnitGroupEngaged GRP_ELF
if not I_LocalFaction seleucid
unit_group_enable_automation GRP_ELF false ;Release standard AI mode if some unit in the group attacked
end_if
terminate_monitor
end_monitor
monitor_conditions I_IsUnitGroupEngaged GRP_NUM
if not I_LocalFaction seleucid
unit_group_enable_automation GRP_ELF false ;Release standard AI mode if the other group in his alliance engaged
end_if
terminate_monitor
end_monitor
; INVULNERABLE GENERAL
if not I_LocalFaction romans_julii
console_command invulnerable_general "Sauron" ;Character Name
end_if
monitor_event BattleEnemyUnitAttacksPlayerUnit not I_LocalFaction romans_julii
if I_IsUnitEngaged SAURON
console_command vulnerable_general "Sauron"
point_at_unit_pos SAURON
end_if
if not I_IsUnitEngaged SAURON
console_command invulnerable_general "Sauron"
remove_battle_map_arrow
end_if
end_monitor
monitor_event BattlePlayerUnitAttacksEnemyUnit not I_LocalFaction romans_julii
if I_IsUnitEngaged SAURON
console_command vulnerable_general "Sauron"
point_at_unit_pos SAURON
end_if
if not I_IsUnitEngaged SAURON
console_command invulnerable_general "Sauron"
remove_battle_map_arrow
end_if
end_monitor
while I_InBattle
end_while
; this final bucle is needed so the "monitors" keep working all along the battle
end_script
5. Linked Historical Battles for Alexander TW
In Alexander TW it is possible to make series of historical battles where you need to win one battle to unlock the next battle. You just need:
- to copy inside the folder of the custom battle the void file named "locked", if you want this battle locked by default
- file unlock.txt with the name of the previous battle needed to unlock this battle
- file order.txt with the order of this battle in the series
6. Things I would like to know
- Which is the effect of supporting_armies? (Num of Supporting Armies in the Editor).
- If there is a way to give to the player the control of another army. For example, like the reinforcements that comes in campaign and they are added to the player units.
- If there is a proper way to force the AI to deploy automatically his units.
Last edited by Bardo; February 17, 2013 at 10:13 AM.
i have made an historical battle,which works fine in single player.
the problem is when i host the battle for multiplayer,i have player slots,but no one can join it.
the problem seems to be the map is missing.how do i get this battle to work online so people can join it?
any help would be nice
I'm sorry, I can't help you, since I'm also having problems to play my historical battles online.
Maybe something related to scripts, or reinforcements, or the lack of map.wfc as you comment.
Hey Bardo, I've taken a look through your (great) tutorial.
My problem with the Historical Battle is that I can make one (within a modfoldered mod) and save it without errors.
But when I try to play the battle I simply get a CTD to desktop.
I've taken a look at my His Battle and the other (vanilla) Historical Battles available and I've noticed I do not have a descr_script.txt, is this something the editor should create, or do you have to manually make this (kind of large über-coding-guru) file? Any Idea's?
The script file is not needed, it is an optional file that you can call at the end of your descr_battle.txt, using this code:
Code:
script
descr_script.txt ;you can use any name you want
In fact, the only file needed for a historical battle to work is the descr_battle.txt. The rest are all optional:
-map.wfc only needed if you modified the terrain with the editor
-description.txt, movies (.mpg) and images (.tga) all optional
-bookmarks.rcb is automatically regenerated when you play the battle.
-order.txt and unlock.txt optional AlexanderTw files
Do you know if someone has make a working historical battle for that mod?
I would suggest to use the battle editor to create the simpler battle that you can: only 2 factions with 2 units, and to test if the battle works this way.
If it crashes, then I guess the problem is not the battle itself, but the folder structure of the mod:
...they load the map info from the files placed at the folder:
\Data\world\maps\base\
In AlexanderTW, for Custom and Historical battles to work propely, the file:
\data\text\Battlefields_regions_and_settlement_names.txt
must fit the descr_regions.txt of the previously mentioned \base folder.
And you need a DS file placed in this folder:
\data\world\maps\campaign\Battlefields\descr_strat.txt
Is your mod for BI? or launched with Alex.exe?
If you know the HBs can work, but the problem is just one of them, please tell me if it is a siege battle, because they are a bit buggy and I have found several possible CTD causes in those battles:
-can_deploy option for a sieging faction sometimes cause CTDs at start
-I think reinforcement factions with siege engines can also CTD
-wrong city coordinates can cause CTDs
...
Else, if you place here the content of the descr_battle.txt you are using, maybe I can help you.
Originally Posted by firstprime
i have made an historical battle,which works fine in single player.
the problem is when i host the battle for multiplayer,i have player slots,but no one can join it.
the problem seems to be the map is missing.how do i get this battle to work online so people can join it?
any help would be nice
I have been able to get my historical battles working on multiplayer. I would suggest:
-to dissable the scripts (last line of descr_battle)
-to check there are more than one faction playable: checking the faction are placed in playable section at start, and removing "fe_non_playable".
-to remove the "can_deploy" option if a siege battle
-to convert the reinforcements into standard armies
Last edited by Bardo; November 25, 2009 at 10:27 PM.
Ok the info you requested, + attached the decr_battle.txt:
-Nope, no one before me has been able(or tried) to make a HB with the mod I talk about ( Ran No Jidai) the mod is for Barbarian Invasion.
-I tested the battle with the minimum number of factions and units, still crashes
-The battle is a skirmish between 2 Generals units at the moment (no siege)
Perhaps you should first try adding the -show_err comand in the location mod:
"c:/Program Files/.../Rome - Total War/rtw-bi.exe" -modetc.) -show_err
Try again to play the historical battle and when it crashes, it should show you an error report. Just attach it here so that we can have a better idea of what the problem may be.
@Bardo:
Hi again! How's everything there? I'm having some trouble with a hb script... the game does not recognise the end_script line... and if i remove it, it never finishes loading. Any idea?
There are none so enslaved as those who falsely believe they are free
Ok the info you requested, + attached the decr_battle.txt:
-Nope, no one before me has been able(or tried) to make a HB with the mod I talk about ( Ran No Jidai) the mod is for Barbarian Invasion.
-I tested the battle with the minimum number of factions and units, still crashes
-The battle is a skirmish between 2 Generals units at the moment (no siege)
Thanks for taking a look!
Your decr_battle.txt seems right. If you made it with battle editor I suppose characters and unit names are also right, I don't think the problem is the battle. But just in case, I would suggest to change the line:
condition destroy_character Motonari, goths
by the standard:
condition destroy_or_rout_enemy
And to remove ", fe_non_playable" from all armies.
I guess your problem could be related to the folder structure of the mod. I have never modded BI, but I have heard similar problems from other modders who tried to use BI mods with AlexTW.exe. I think Makanyane was one of them, I wonder if he solved it: http://forums.totalwar.org/vb/showth...t=84221&page=3
Nice tuturial
I tried to make a battle with script some time ago, but I stoped after format of my computer
I know not too many tricks, but You may find this info usefull enough to add it to the tuturial.
REP++
I think I might have found the problem here Bardo, I read the thread about Alexander.
I found out the names in the Descr_Regions.txt and the Descr_regions_and_settlement_lookup.txt are not the same (the last is still a vanilla txt file) which means I have to change all the names and values (no idea how or what it all means, but I've asked my Mod Team to help out )
Thanks for your help mate, I'll let you know how this works out
Nope that wasn't it, changed all names accordingly And checked, double checked.
Regions file seems to be okay, something else could be triggering the CTD, when trying to start the His battle
EDIT:
Hey, I've narrowed it down to the files.
I created the exact same setup with conditions and everything in another modfoldered mod (simply a modfolder that only had buildings installed the rest was vanilla BI)
This leads me to believe there is something wrong in the files from the "world" folder.
EDIT2:
Stupid... Why do errors always have to be so damn obvious afterward.
I forgot to delete the map.rwm file. I did now and whaddayaknow, the Historical Battle WORKS
Might wanna put it in your tut mate, to avoid other people making this kind of mistake, although I begin to doubt if it was really a HB problem, or a modfoldered one...
Well... anyway I'm glad I can move on
Last edited by Wundai; December 06, 2009 at 09:38 AM.
I guess it was not so simple
Historical battles use the map.rwm from the base folder. You should be able to use any map.rwm from any campaign, and historical battles should not ctd... I think.
I had one similar problem the first time I tried to make a historical battle for our mod, it crashed at start because there were no descr_regions.txt in our base folder, and still the map.rwm was generated.
Maybe the map.rwm in the base folder of your mod was generated with some wrong region file. I don't know, but I'm glad you solved it.
Okay walking in to the next problem.
I am trying to add a custom settlement to a map, the problem is when I save and quit the map (and reload it again) the ground textures/units and everything else is fine.
But all my buildings appear about 1 kilometer below the surface? This is displayed again both IN the editor as in the Battle itself + I have tried removing the map.wfc, which results in removing the entire settlement from the map.
New thing to break our heads over ey? Any idea's mate?
Uf, I never faced any similar problem, I don't know if I can help here.
I admit I always see the cities properly in the battle editor and my problems came only when I saw them in battle.
I know it is possible to adjust the city height in the battle editor, but I guess not a solution if only the buildings are wrongly placed.
You can also adjust the height manually in the line:
(battle_pos coordX height coordZ rotation_angle)
If I keep the info of the city into the descr_battle.txt, I can remove the map.wfc and the city appears properly placed in the battle, exactly equal than in campaign.
Note the city does not appear if you open the HB in the editor, but it does appear if you play the battle. You need to restore the map.wfc if you want to continue editing the battle.
I'm curious to konw how do you know the buildings are placed "Below" the surface, how do you see them?
I say that because when I try to use a custom city plan not listed in the default_settlement_plan list, I can see the ground and walls of the city, but I can't see the buildings, maybe your problem is the same.
I suggest to try first with a city using a default settlement plan.
Well this is how I normally pick my settlement, I assume you mean it like this?
Choose:
-default_set
-Roman
-Roman_city
Then the settlement appears on the map when lit green. (also a burden that you can't Delete the settlement because you delete the terrain with it )
Okay so this is how the buildings appear below the surface:
You know what I'm talking about when I say that in front of every gate in the settlement, there is patch of terrain that is deleted so you can look through it(you see the air and clouds), right? (this is fixed when the battle loads)
Well here is a screenshot where you can look through that patch, and see the buildings 1 km below the surface of the map:
Spoiler Alert, click show to read:
Hey, I'll try altering the city height anyway to see its effect.
EDIT:
Ok I do not have a battle_pos line in my descr_strat and after implementing yours I can't load the battle anymore, just a CTD
Last edited by Wundai; December 13, 2009 at 06:29 AM.
When I remove the map.wfc the settlement also dissapears when I play the battle.
And the editor ctd's when i try to create an ambient settlement.
A question Bardo:
I'm not sure how many settlement battles you have created, but on your experience so far, have you been able to make settlement battles work on any "HEIGTH" in the "Pick Location" screen?
Some heights go up to 2- or 3000 meters, in such terrain its almost impossible to smoothen out the terrain around the settlement, and unfortunatly your method of removing the map.wfc to smooth out the terrain doesn't work for me, it just removes the Entire settlement in the play battle mode
Last edited by Wundai; December 20, 2009 at 08:15 AM.
Sorry the late answer, I didn't notice your previous post.
I have only made 2 historical battles with custom settlements, but I have changed the terrain so many times, that I have ended placing the cities at many different heights. You can see in my signature a screen from one of my HBs placed arroud height 1000. The other is Helm's deep placed in a narrow pass, and little changes to height map did changed a lot the height of the city, but the city is always placed propely and smoothed if I remove the map.wfc
True, the glitch where you see a transparent square has happened to me, but only when I use a transparent texture for the ground of the city. As you say, it appears fixed in battle.
The line "battle_pos" should be placed in the descr_battle.txt, and it is automatically written by the battle editor. I prefer not to change manually those values because then, sometimes the battle editor refuses to load the battle, or it CTDs.
I have used succesfully this line "battle_pos" in descr_strat.txt to customize the location of the city in campaign, but I'm sure it does not affect the historical battles.
When I add a city, this is what I do:
1- Place the city in the green square as you say.
2- Save the Historical battle and exit the battle editor.
3- Delete the map.wfc and launch the historical battle.
I have tested it with AlexanderTw, using both vanilla cities, and custom settlement plans made for our mod.
I have just tested the same with vanilla RomeTw using Siege of Sparta vanilla HB, and the settlement appears properly in battle.
I have a idea why the same could not be working for you:
Once, I created a basic historical battle without adding any settlement in the battle editor. I placed this battle in a tile where do is placed a city in the campaign... and surprise... when I play this battle, there is a roman city present !!! Don't ask me why, but is seems the historical battles do read the campaign descr_strat.txt.
I have seen vanilla RomeTW and AlexanderTW ALWAYS place his historical sieges at tiles where there are cities placed in the campaign map. So I did the same.
I suggest you to test the battle at the same tile where the city is placed in the campaign.
I warn you I needed a month of work until I got working my first historical siege battle. The siege battles are very buggy in RomeTW, there are a lot of random bugs, CTDs for no apparent reason, and the AI behave weird many times. I'll try to help you, but I used a trial and error method more than a scintific one