Adding custom battlefield to campaign
I've decided to make this short tutorial, because I have never found any information on how to do it so I had to figure it out myself and it seems there might still be someone interested.
So, here goes:
You need to find, extract and edit "episodicscripting.lua" (The latest one for NTW is in patch4.pack I believe)
Inside (you can edit it with notepad, btw.) there's function that defines some options for all campaigns in game. It starts with:
local m_starting_configuration =
and it's followed by campaign name, like f.ex:
["tutorial"] =
and then all kinds of components, like
["Features"]
["Building"]
["Unit"]
["Intro_movie"]
Now, there's one section we're interested in, that looks like this:
["Battlefield"] = { },
there is scripting command "add_custom_battlefield" that this function calls for
Command: add_custom_battlefield
Description: Instead of a generated map, use a custom map for this location
Usage: add_custom_battlefield(x, y, radius, path_to_folder, fort/settlement)
What you need to do is add parameters this command expects inside brackets. You need to remember that every set of parameters must be in {} brackets and must be separated by a comma if there will be more than one entry.
usage example (it adds two custom battlefields):
["Battlefield"]= {{-93.30455, -21.82133, 20, "BattleTerrain\\presets\\NTW3_Austria_6\\", true}, {-25.31408,-17.83595, 20, "BattleTerrain\\presets\\ntw3_hist_aspern1809\\", true}},
The X and Y coordinates for certain places, like towns and other slots can be found in regions.esf file
path in regions.esf:
Root/Region_Data/Regions/REGION-NAME-HERE/settlement_and_slots/slot_descriptions
4th line from the top contains x,y coordinates you can use
for "radius" I used 20, because smaller values did not always work, since city model can be quite large and your army might not be able to reach those exact coordinates.
"path" should be self explanatory :)
"fort/settlement" tells the game if this map should be used for fort/settlement battle so it's true/false.
I actually never used it like that, but I suspect that you might have two entries with the same coordinates and one with "true" will be used when attacking a city and the other when fighting open field battle.
Now, this should do it, BUT...
in most cases it will crash the game.
I've discovered that what causes the crashes is "weather.xml" file inside custom battlefield folder.
Probably it's the .environment file that's declared iside that's creating problems, but I haven't played with it- I simply removed weather.xml from the folder and it does the trick.
If you want to use NTW original preset files, then you could extract the preset folder, rename it, delete the file from there and use the battlefield under new name.
It should work now.
The problem is that those battlefields will always look the same, so you might end up fighting summer map in winter. There might be something to be done about that probably,as you can edit some values in textures.xml and definition.xml inside preset.
Fun thing is, you can make changes to episodicscripting.lua during your campaign game, so you can save the game, exit, add new battlefield (modify or delete one) and those changes will be included when you load the game.
Hope this helps. Have fun.
Re: Adding custom battlefield to campaign
Well this is a great addition to the lot of tutorials and a very good discovery, can be very useful. +rep
Re: Adding custom battlefield to campaign
Thx for the tutorial I tested this with My map of the queenston heights In empire and it worked.
I do have a question though Is there a limit for the amount of Custom maps on the campaign?
Re: Adding custom battlefield to campaign
About the winter/summer.
What happens if we add two custom maps for the same location?
- Does it crash?
- Does it uses randomly one of the two?
- Does the last one overwrite the first, and so the latest custom is always used?
In the later case, we could imagine a script with a turn counter, and when we move from summer to winter, then add again the map for same location, but this time winter style, and then the opposite later.
Re: Adding custom battlefield to campaign
Quote:
Originally Posted by
Steph
About the winter/summer.
What happens if we add two custom maps for the same location?
- Does it crash?
- Does it uses randomly one of the two?
- Does the last one overwrite the first, and so the latest custom is always used?
In the later case, we could imagine a script with a turn counter, and when we move from summer to winter, then add again the map for same location, but this time winter style, and then the opposite later.
I tested it, it uses the first map und ignores the other maps. To change the season, you can change the definitions in the textures.xml file, like grass_type='temperate'. I tried to use a if statement in the script, but it seems that you can't use add_custom_battlefield() as a method in the script, so the only way is the one you proposed. As I'm not very familiar with lua, how do you imagine to edit the values in ["Battlefield"] = {}?
Re: Adding custom battlefield to campaign
Custom preset battlefields would be interesting mostly for sieges imho.
I'd prefer a revamped meta terrain generator first honestly.
Nobody went through it so far...
Shouldn't be too hard.
You know, there're still many unexplored things in NTW.
Just to stick to mapping for example, I discovered lately an unfinished (seems to have a few problems with vegetation) option to generate huge 8192 x 8192 campaign battle maps.
That's almost operational scale...
http://imgur.com/DNRucVn
It's enabled if a pending battle participant military force's method (maybe huge_army() or wants_operational_scale(), hard to tell) returns 1 instead of 0 (as by default now).
Or the debug override/saving autogenerator features...
Re: Adding custom battlefield to campaign
Wow, that is incredible discover! Has anybode released any mods with such feature? I believe those neumerous custom maps from NTW3 can fit to any terrain battle in the campaign.
Quote:
Originally Posted by
risorgimento
Just to stick to mapping for example, I discovered lately an unfinished (seems to have a few problems with vegetation) option to generate huge 8192 x 8192 campaign battle maps.
Is it possible to increase it to 4096x4096? Have you ever released this mod? It seems very interesting but pretty difficult for a person without modding experience (as me).