This bug was the bane of my life for quite sometime. It is caused by having too many names active when you save the mission. Global variables as Mikero says, also local variables in scripts that are running when the game is saved as well as unit and group names and marker names. Note also it is not just the names in your mission that cause the problem, names in the various addons in your addon folder also seem to contribute, even if you are not using the addon in that mission.
Things I resorted to to remove the problem are:
- Not having unneccessary addons in my addon folder (in fact I only had the official addons + the Editor upgrade)
- Where possible if I have scripts waiting for something to happen instead of having them running all the time just waiting I got them to start when they were needed and then end as soon as possible.
- As Mikero says: use local variable not global ones where possible
- Where global variables are needed use an array of variables (only one name but you can refer to a large number of variables.
- Always setting variables to nil when they are no longer needed (eg thisvariable = nil) It removes the variable name in the same way a local variable name is destroyed when the script it is in exits
The number of scripts is not relevant, just the number of variables and other names active at the time the mission is saved.
Based on the numbers you mention I suspect it might be a problem with addons not your mission - but that is just a guess. I had this problem with quite a large mission where I used only one addon. When I eventually solved the problem players using the old version of ECP still experienced the problem implying that the old ECP addon was contributing to the number of names in the mission.
There is a work around. Now this is from memory so you might need to play with it a bit.
After saving the game go into the save game folder and change the name of the save game file. When you restart the mission start at the beginning. Press Esc to stop the action. Alt Tab out of the mission, go back to your save game folder and change the name of the save game file back to its original name. Alt Tab back into the mission which is currently paused. Press Esc twice (one to restart the acton and the second time to get back to the various options). You should now be able to continue the mission from where you saved it.
Should BIS have fixed this: Indeed, but you won't believe the other bugs they haven't fixed either, like:
- Ladders that can be climbed before a save cannot be climbed after
- BuildingPos values changing after a save
- Tanks with no artillery shells cannot rearm
You just have to live with it. It took me long time to restructure my mission to get rid of the problem but I did eventually.