Replacing the grand campaign
One of the more annoying issues of the ETW modding mechanism is how the map files are handled. They can not be added to the mod pack but have instead to be put on the disk to work properly. So far, the usual way if you wanted to supply a modified startpos.esf or scripting.lua was to overwrite the vanilla versions - obviously, this is not a completely safe thing to do.
Thanks to an idea by husserlTW I was able to develop a mechanism that allows you to copy the campaign map and then tell the game to use this new map instead of the original. This is definitely preferable to the old method and actually pretty easy to do, so let's get cracking.
Step 1: Copying the files
First, we need to copy the map files to a new location. So go to your data/campaigns directory and copy the main folder. I will be doing this for APE:TI so I chose apeti_main as the name for the copy but you can use anything you like.
Step 2: Editing startpos.esf
Before the game can properly work with the files, we need to tell it that the campaign it's loading when using our newly-copied startpos has another name. So open the file in ESFEditor.
We have to edit two entries, marked red in the image below.
In CAMPAIGN_PREOPEN_MAP_INFO change the first entry from main to apeti_main or whichever name you chose for your campaign. The same has to be done for the first entry in CAMPAIGN_ENV/CAMPAIGN_SETUP, then we're already done here. Save and exit.
Step 3: Teaching the UI
Now, please download the attached custom_campaign.rar archive. It contains a movie type pack that should be compatible to most mods but you can export the files and re-import them to your mod pack if you prefer that. Please put the pack into your data folder now, then open it with PFM.
The ui/frontend ui/grand_campaign_scripts/grand_campaign.luac doesn't and shouldn't be changed by you but it's required for this to work: I modified it so that it loads another, easy-to-edit, file that tell the game which campaign it should load when the player clicks on grand campaign. This is the second file included in custom_campaign.pack, called custom_campaign.lua.
The last step is to export custom_campaign.lua, open it with a text editor and replace "apeti_main" with the name of your map. Be sure to put the name in quotation marks (") because otherwise things will stop working. Now re-import custom_campaign.lua to custom_campaign.pack (right-click, replace) or put it into your own pack and all should be set.
Code:return "apeti_main"
Step 4: Enabling Roads
There are two small things that cause problems with the above: Firstly, it will remove roads and secondly the gold borders around the map transition zones will be gone. The first problem can be fixed, the second not but it's not very tragic. So to get roads back, open models.pack and extract the rigidmodels/campaignroads/main folder. Rename that folder on the disk to whatever the name of your custom campaign is (in my case apeti_main) and re-import it to your mod pack. You should then have roads back.
Step 5: Testing the changes
It can sometimes be hard to test the changes you did. An easy way to do this here is to open scripting.lua in your new map folder with a text editor and add the following to the OnFactionTurnStart function:
effect.adjust_treasury(100000,context)
Start a game and you should have 100k more in the treasury if things work correctly. Otherwise, please try again.
That's it, gents. You should now be set up with your very own modfoldered campaign. One last word of warning: Be sure to delete any files you extract to your data folder from the hard-disk because the game will sometimes take them rather than files in your pack (usually if the files on the disk have a newer timestamp).
References
ESF Editor 1.4.3
PFM 1.12
Startpos.esf analysis and modifications (not necessary but useful if you want to do startpos editing)
lrmo's tutorial about mod-foldering the other campaign map files