bmaupin / civ5save-editor

Civilization V save editor
https://bmaupin.github.io/civ5save-editor/
MIT License
28 stars 2 forks source link

Error loading file #4

Closed jmngpt closed 6 years ago

jmngpt commented 6 years ago

Received the following error while trying to load a save file:

The following error was encountered when trying to open the save file: failure parsing save at property section19SkipUsername Please try another file or use the link on the left to report a bug.

I'm running Civ5 from Steam with latest updates, this tool worked fine to load and edit a saved game's properties like "Cultural Overview UI" and I played the resulting file without issues, but after saving and exiting the game I now get his error while trying to open that save file.

bmaupin commented 6 years ago

I'd love to take a look at this. Could you send me the 2 save files please (the one from before using the tool and the one after)? You can attach them directly to this issue or use your favourite file sharing service.

Thanks!

jmngpt commented 6 years ago

Here you go, the one that starts with "2" is after editing with the tool and "3" is another version of the same file after playing and saving in Civ5 (opens in Civ5 but not in the web editor). The other file is the original, before using the tool.

PS: thanks a lot for this tool, it's really great and works like a charm :) BTW: my original issue was to keep playing the Scramble for Africa scenario, which is limited to 100 turns and doesn't offer the "just one more turn" option, is that something this tool can do? Already tried to use it to set the limit to 500 turns but it still ends on turn 100.

saves.zip

bmaupin commented 6 years ago

BTW: my original issue was to keep playing the Scramble for Africa scenario, which is limited to 100 turns and doesn't offer the "just one more turn" option, is that something this tool can do? Already tried to use it to set the limit to 500 turns but it still ends on turn 100.

Oh cool, that's not something I thought about when creating the tool. You could try disabling time victory altogether, but my suspicion is that won't work either. Doing a quick search turned up this forum post that seems to indicate the max turns for scenarios is configured within the scenario itself. So I think it's probably ignoring the max turns setting in the save file.

I think the solution is to modify the scenario itself. Based on that post, it looks like the file to change would be SteamApps/common/Sid Meier's Civilization V/steamassets/assets/dlc/expansion2/scenarios/scrambleafricascenario/turnsremaining.lua. And this is the line to change:

local iTurnsRemaining = 100 - Game.GetGameTurn();

I think you could just set 100 to whatever you want. That should fix the victory condition. There seems to be another line that shows how many turns are left in the UI:

local iTurnsRemaining = g_kiGameTurnLength - Game.GetGameTurn();

In that case, set g_kiGameTurnLength to the same value. I haven't tested any of this myself so I'd be curious if it worked.

Even though it won't help you with this particular issue, it looks like you've found a bug in my tool so I'll see if I can get that fixed in the meantime.

PS: thanks a lot for this tool, it's really great and works like a charm :)

You're welcome, glad you like it!

bmaupin commented 6 years ago

Ooh a fun bug :) It looks like the save file was originally created with Civ 5 version 1.0.3.18, then it was later saved in version 1.0.3.279. It breaks because there were some changes to the save file format between those two versions and my code is incorrectly identifying the file as version 1.0.3.18.

jmngpt commented 6 years ago

Disabling the Time victory condition wasn't enough, but your suggestion of editing the turnsremaining.lua file worked perfectly. It doesn't require altering the scenario's victory conditions, it sets the maximum turns to the specified value (300 worked fine) and enables the "one more turn" button. Thanks!

bmaupin commented 6 years ago

That's great, glad that it worked!

If you have no objection I'll add your save file to the app's test suite to help make sure the bug doesn't pop up again after I fix it.

jmngpt commented 6 years ago

Sure, thanks again for the app :)