I have to do it through regular maps, but the inability to carry over data is very limiting.
I googled on various sites and found that you used to be able to do print_to directly into a file, but as it turns out, this feature was removed long ago.
I couldn't think of anything better than adding a function to the game code myself.
I hooked where the game calls the regular print to the console and assembled a simple DLL that intercepts them and saves exactly what I need into a file.
To make everything transfer automatically to subsequent missions, I write script functions directly into a LUA file, which can then be loaded in the next map (campaign mission) via a simple doFile().
Example of transferring data from one map to another.
The video shows how the Attack and Defense stats of hero Vittorio are transferred between missions. (thrown together quickly from scrap in 0.00001 nanosec)
Saving to the file occurs when the blue player's hero is killed. (but essentially, this can be written into any trigger, absolutely any)
https://www.youtube.com/watch?v=2icBCpRaBp4
If this idea is developed further, it's theoretically possible to transfer any information to other maps on the fly.
Everything can be downloaded and tried in the attachment. The DLL source is compiled via MINGW GCC, but MS VS might swallow it too.
Pros
1) Obviously, this method allows creating campaigns with more than 5 missions simply by transferring info between maps (or between several campaigns, if needed)
2) You can choose which information to transfer—not like in a regular campaign from the map editor; for example, you can transfer only one specific stat, skill, artifact, or even an army.
3) Transfer info for more than 5 heroes.
4) There are probably others, but I haven't thought of them yet.
Cons
1) Right now it's all hardcoded in the DLL; perhaps someone can suggest a better way to automate and simplify this so that even people unable to compile a DLL can use it.
2) I have to manually write print for almost every stat value, as the text output is what's hooked in the DLL. It doesn't catch something like print("ATAK=",A), only a regular print.
3) ChangeHeroStat specifically adds stats rather than setting values, so currently I have to subtract the original value and then add the new one.
4) There are probably others, but I haven't thought of them yet.
Question:
Does anyone have a method or script on how exactly to set stat values instead of adding them as in ChangeHeroStat?