[C3C] Adrain's Save Game Editor

Adrain

Warlord
Joined
May 3, 2004
Messages
117
Location
UK
The first step is to unpack the following files from the attached ZIP into the Saves folder you're using for your game :
CivIII.Xlsm
SavExpnd.Exe
UnCompress.Cmd

CivIII.Xlsm is a file that has executable code in it so you will have to make sure the code is allowed to run otherwise it won't work. It's a signed file so if you want you can trust the issuer of the certificate (Me) and then all files signed with that same certificate will be allowed to run on your system. To trust code in this go to Code Signing & Certificates and scroll down to Trusting a Signature: and follow the instructions for using Office 2007 or later.

Another important thing to manage properly in order to allow the code to work in Excel is to go to (within Excel) :
File | Options | Trust Centre | Trust Centre Settings | Macro Settings and set Disable all macros except digitally signed macros as well as Trust access to the VBA project object model.

When you first open the spreadsheet file it's a good idea to check and set the basic variables it will rely on. To start then, click on the Add-Ins ribbon then the smiley face button (CivIII: Civilization III Menu). This may prompt you first off to get the latest save file. Ignore this for now if it comes up by selecting no.

When the main menu shows up click on Show at the bottom to show the hidden sheet called Data which has most of the configuration parameters. It's important to set the Base correctly, and this will depend on where you installed the game to. Other settings here are Tiles/Row which is dependent on the size of the map you're using. The NationCode may not even be necessary but it should reflect the value you're playing from the RACE table. The last configuration parameter is the hex address in the SAV file where the first TILE entry is found. It's set in cell J3 of the CivIII worksheet.

When that's all done you can run it for real. Click on the menu button as before. Whenever you click on that button it will first check for any files in the folder you've specified as your Saves folder which have an extension of .SAV and are also newer than the file specified in Data\SaveFileName. This is so that you have the opportunity of working on your latest SAV file if you've played since last you worked on it. This SaveFileName file is produced by uncompressing the latest SAV file onto it using SAVExpnd.Exe. It's done for you automatically (Because I'm really very lazy).

Once you've hit any key to close that window you'll see the menu. Most of the options are self explanatory but be aware the scripting system is barely in its infancy and, as yet, does nothing more than opening and closing a specified SAV file.
 

Attachments

  • AdrainSGE.Zip
    316.9 KB · Views: 408
Some notes on how to use this tool

Going through the menus - Main :

Propagate Menu
Covered in full in the next post.
This menu includes options for populating information from the SAV file into the various worksheets of the spreadsheet. Each worksheet is named to match the class of data loaded into it.

Nationalise All Settlers / Workers
Workers from other civs can be owned by you, the player, when they are captured, donated as part of a deal or built in a city containing foreign citizens. Settlers are similar except when captured they are automatically converted to a pair of workers.

These can be a problem for two reasons :
  1. Foreign workers take twice the turns to complete any task.
  2. Foreign settlers and workers, when used to build into a city, are created as citizens of their own nation and will never be nationalised into the local population over time, as captured ones can be when they've lived under your rule longer than they've lived under any other.

Move City(s)
Citizens of cities that work squares cannot be moved properly so before moving any city turn all the citizens into specialists before saving. Once the SAV file has been updated successfully and reloaded they can be re-assigned to the city radius.

NB. Sometimes the city square itself (which cannot be unworked) changes terrain type and produces different amounts of Production and/or Commerce (I believe Food is always 2 regardless). This should be updated manually in the SAV file to produce correct results. The game will always show the correct amount for the tile but this will not be reflected in the amount available to use without external help (See CITY type E-lngTotProd & lngTotComm as well as CITY type F-lngProdUsed & lngCommerce from ).
Tip:
If the tile you move a CITY to has a mine on it then this will be maintained and increase production but if it has irrigation this will have no effect at all :-(

Moving the city is one thing, but if the city is at or near your cultural border then this may also need to be updated to reflect the move. Columns XMov & YMov should be fairly self-explanatory but the next one, Update Influence, is more complex. It is strongly recommended to do the basic move in one pass; reload the CITY data from the Propagation menu; adjust the Update Influence in a second pass where XMov & YMov are both set to zero (Update Influence values for CITYs that have no XMov or YMov set are ignored).

The format of the Update Influence data to use is that there are potentially multiple blocks of three numbers each. Each such block being separated from the previous one by a semi-colon (;). Within the block each value is separated from the others by a comma (,). The three values are XOffset, YOffset & Civilisation (LEAD). Offsets are from the CITY address and whichever Civilisation is used will then own that TILE. A Civilisation value of 0 sets it back to un-owned.

Add Food (+ or -)
For each CITY where you've specified food to add (CITY worksheet) this will be added - up to, but not exceeding, the maximum amount that the CITY can store, depending on its size, as listed :
  1. For a Metropolis (Population > Twelve) - 59.
  2. For a City (Population between Seven & Twelve) - 39.
  3. For a Town (Population less than Seven) - 19.
Also, results less than zero will be left at zero.

Add Beakers (+ or -)
For each LEADer/Civilisation where you've specified beakers to add (LEAD worksheet) this will be added to the accumulated total so far.
Results less than zero will be left at zero.

Upgrade Goods
In the MapGoods worksheet there are columns to specify changes to TILEs. GOODs can be set and reset and so can improvements. Changes to GOODs are specified within curly brackets {} and improvements can be set using parentheses () and reset using angle brackets <>. GOODs use values whereas improvements are bit flags within a single value in the Field.

Promote Units (Veteran)
Promote Units (Elite)

These promote any UNITs you have at a lower level up to the selected level.

Show Whole Map
Shows whole map.

Unshow Whole Map
May not work :-(

Clear Pollution
Clears pollution.

Execute Script
Executes script - at least as far as opening and closing a SAV file's concerned. Otherwise Nada :-(

NB. Everything to do with TILEs has to conform to the rule that the X-address + Y-address must sum to an even number. Put another way - If the X-address is even then so must the Y-address be; if the X-address is odd then so must the Y-address be.
 
Last edited:
Notes on how to use the Propagate menu

City data
Loads data for all CITYs on the map. If any updates are set then they will be cleared by this process.

Map Goods data
Loads data for all TILEs with GOODs (See GOOD worksheet for reference for GOODs). If any updates are set then they will not be cleared by this process.

This is to allow repeated setting of the same changes to specific tiles on the map. EG. I use it to add a goody hut on a TILE that I can convert to some barbarians to allow my UNITs to progress up to Elite (eventually).

Tip:
To cause a goody hut to spout barbarian UNITs run a Worker through the TILE. Requires railway from start TILE to end one.

Unit data
Loads data for all UNITs in the game. This includes where they are; how they're linked to other UNITs such as container units (Some ships and Armies); whether or not they're based within CITYs; etc.

Prototype data
Loads all the UNIT type (PRTO) data.

Building data
Loads info about all the posible BLDG (Not UNITs.) items that can be built in CITYs.

Good data
Loads data about the various GOODs available. These come in three varieties - Strategic, Bonus & Luxury.

Technology data
Loads up all the TECH data, including what depends on what and how much it costs to discover.

Leader data
Loads data up about the various players and which nationalities (RACE) they represent. If any updates are set then they will be cleared by this process.

Race data
Loads data on all the available nationalities (RACE).
 
Last edited:
As I'm working on improvements to this Save Game Editor (SGE) there were two items that occurred to me to mention :
  1. The newer version, when uploaded, will have filtering disabled due to locking down the worksheets. Filtering and sorting can be immensely helpful though when trying to look through the data - particularly when the volumes of data get high.

    To accomplish this with locked-down data you can generally copy the data across to a new worksheet or workbook and do the filtering and sorting there. To get the best use of the original data it's best to select all the columns across the top and then, after selecting a single column in a new worksheet, paste the data in. This ensures you keep the original formatting and column widths, but this worksheet won't be locked so you'll have access to the standard sorting and filtering to fiddle around to your heart's content.
  2. One feature that is somewhat less than obvious, principally because I designed it for myself and, hey, I knew what I was doing, is the ability to find TILEs near to CITYs. Assuming all the CITYs are correctly loaded into your copy of the spreadsheet then if you double-click on the names of one of the CITYs on the CITY worksheet then the CivIII worksheet is updated with data from that CITY and Cells J8 & J9 will reflect the TILE address of that CITY. These co-ordinates can be overwritten but there are separate Cells to show OFFSETs (which are also set - to 0 - when double-clicking on a CITY).

    I10 & I11 are OFFSETs relative to J8 & J9. If you enter values in here then the position in the file is calculated for you and shown in Cell J14 (in Hex or I14 in Decimal).

    There is a another feature that I use less but may be helpful to some. If you have a TILE in the file you're looking at and you want to see where it is on your map then enter it into J16 and you'll see the X & Y co-ordinates shown in Cells J19 & J20. Again, look in column I for the Decimal equivalents.
 
After many happy hours of updating this tool to work more fully (and reliably) and to give more, better and clearer information, I've updated the OP (First post of the thread) with the new file.

Any feedback is always appreciated.
 
Again, a new release. Some items tidied up and/or perfected, but mainly to handle the known issue with the extra beakers that should be added when in increased scientific output mode (Meet the Modders (Just saying Hi)).

I was unable to find a way to properly duplicate the effect of this so instead I've added the ability to amend the amount stored by whatever value you choose.

Tip:
As the increase should be 25% and I guess most are in four turns per advance for most of the time, doubling the existing amount after the first turn should give a pretty accurate end result. If the number of turns is other than four then you'll have to work out another approach that works for you. At least this gives the ability to adjust. From there the ball's in your own court.

I've updated the early instruction posts to explain how to use the new feature in the tool.
 
Just found this tool after being curious if your profile would point me to your SAV work (it did!). I got the macro enabled after a couple tries, and created a new SAV to load it from. I'd getting the ol' familiar Run-Time Error 53 - File Not Found in the GetLatestSave method, in particular this line:

Code:
    Call Shell(strFolder & "UnCompress.Cmd " & strFolder, vbMaximizedFocus)

strFolder is where I have Civ installed - D:\Civilization III\Conquests\Saves\ to be precise. It has indeed duplicated my most recent (non-auto) save to Ade.sav. I'm wondering if it's expecting UnCompress.Cmd to be in the save folder? It's been a long time since I wrote any appreciable amount of Visual Basic, and that was VB4 and VB6, rather than VBA, so I don't recall the syntax of the Shell command. But something is confusing it.

My "Base" is set to "D:\Civilization III\%F\Saves\%N" - I tried to emulate how you had the %F and %N set. I changed the Tiles/Row to 100, since I just started up a plain-old New Game on Standard size. Otherwise I left the settings as they were.

I also got (after the "Copy over "" to Ade.sav" message) an "Error: 76: Path not found Retry? If you are happy to continue press OK, otherwise press Cancel to abort" message the first time I hit the smiley face. I hit Cancel and it brought up the Civ III Menu, where I was able to press "Show". Not sure if it's relevant but thought I should mention it as it might be why I got the later error. I kind of suspect it's looking for a non-existant C:\Games\CivIII folder, but am not really sure about that.

It sounds interesting though. I suspect I'm one small step from being able to play around with it.

Edit: Almost forgot to mention, I'd recommend adding this to the Utility section of the Downloads Database. It might help some with visibility, and the Downloads Database is often the first port of call when someone is looking for a download (admittedly not to the same degree with utilities as, say, units, but it's still nice to have it available there).
 
Hi Quintillus.

If you're looking at this I may get to upload my latest version. There isn't too much new but a few tweaks for more convenient usage - at least for me ;-)

For now it looks like you've found the code in the VBIDE (Visual Basic {for Applications} Integrated Development Environment - Poor man's Visual Studio) and also managed to ensure the Digital Signatuure is trusted so as to ensure the file always opens with macros enabled. Bear in mind the code is open and available, but any changes saved will lose the signature. Making it Trusted - or in a Trusted Location - will also work for that so for some that's the easier approach.
I'm wondering if it's expecting UnCompress.Cmd to be in the save folder?
Indeed it does. See the first instruction on my OP of this thread :
The first step is to unpack the following files from the attached ZIP into the Saves folder you're using for your game :
CivIII.Xlsm
SavExpnd.Exe
UnCompress.Cmd
It does indeed depend on the files being found in that folder. I wanted, as far as possible, for this to be wholly self-contained within the CivIII folder structure.
My "Base" is set to "D:\Civilization III\%F\Saves\%N" - I tried to emulate how you had the %F and %N set.
Nice job. That's exactly how to use it. The red triangles in the corner of the cells indicate there's a comment available if you hover the mouse over the cell.
I changed the Tiles/Row to 100, since I just started up a plain-old New Game on Standard size.
That's a surprise. I thought my map size (&H65 Tiles/Row) was the largest available. I'm not positive but I suspect 100 is too much for the number of TILEs in a single row. Frankly, it's been so long since I changed map size I can't even remember how I determined the size. Let's see ...

Wow. This is proving even harder to determine than I'd expected. I expect the reason the value is set in the spreadsheet is because it's not so easy to determine from the file itself. For now I can suggest you use the value I had of 65. It seems to be a hexadecimal value so 101 in decimal. I will also need to investigate why it's an odd value (It seems that's because it's an index which is 0-relative.). Why not 64 (100) as you'd expect? Weird, but I'll get to the bottom of it and get back to you. It will be helpful to anyone wanting to use this if there are clear instructions on finding this value for their own particular usage.
It sounds interesting though. I suspect I'm one small step from being able to play around with it.
I'd love for you to be able to do that. Bear with me. I'll get something back today or tomorrow all going well.
Almost forgot to mention, I'd recommend adding this to the Utility section of the Downloads Database.
I assume I just create a new thread? I'll look at doing that after a bit of work that you've highlighted that needs doing on it.
 
For now I can suggest you use the value I had of 65. It seems to be a hexadecimal value so 101 in decimal. I will also need to investigate why it's an odd value (It seems that's because it's an index which is 0-relative.). Why not 64 (100) as you'd expect?
Don't do that. Stupid idea. It actually is a decimal value so obviously my recollection that I'd chosen the biggest map is way, way off. More later ...
 
Ah. It's starting to make sense again (Phew!).

Each row is actually offset half a TILE from the ones above and below. Thus, a value of 65, as I have in my game, actually means from zero to 129. Each actual row only uses either all even, or all odd, offsets. Here's an illustration of a small section showing X & Y values as single Hex digits :
Code:
00  20  40  60  80  A0  C0  E0  ...
  11  31  51  71  91  B1  D1  F1...
02  22  42  62  82  A2  C2  E2  ...
  13  33  53  73  93  B3  D3  F3...
Overall the map is 130 TILEs wide, yet each row only has half that many TILEs ;-)

Thus, the value you want in there for a Standard sized map of 100 - would be 50 - the actual number of TILEs in each row as each row only ever has half of the full width number of TILEs. It's funny that once you go to all the trouble to work these things out, then - and only then - you get full recall of everything you did before :-(
 
Ah, I was tired last night and missed that it had to be in the saves folder. I have it there now... it seems like it wants the compression files to be in the Conquests folder, but after I put them there it starts working.

However, when I try the "Show Whole Map" on my SAV, it keeps stopping on this line:

Code:
If .CheckData(lngPos + &H4C, FromSpecial(conTileD)) Then Stop

I'm not really sure why; I found the "Clear All Breakpoints" option but that didn't help. I've attached my SAV here for investigative purposes. Maybe it's because I didn't use a BIQ to generate it but just started a new game?

I did change the tiles per row to 50. Thanks for checking that! I remembered that sometimes that isometric nature of Civ III means half values are used, but was too tired to figure out what it was supposed to be last night and the 65 didn't ring a bell.

I think it's getting close. It was a bit tricky to figure out how to get Excel to run the macro (I don't think I've ever run a macro in Excel before), but I got that working last night by adding the folder to which I'd downloaded the file to the trusted locations, and added my Conquests save folder today.
 

Attachments

  • Test Adrian SAV.zip
    33.8 KB · Views: 117
Hi Quintillus.

I'm preparing a newer version to post, but in the meantime here is a copy of your SAV file with the map showing as well as a copy of my latest version with data from that file loaded in.

I found the fact that neither GOOD nor RACE data was included in your file to be quite curious, but that can be a discussion for another day.

NB. I'd be happy to share direct contact details with you if you were interested in a session where I could take you through code signing and or use of the file in a more interactive way. I'm working through the early hours tonaight anyway so US time won't be a problem. Not necessary but the offer's there should you want to take advantage of it.
 

Attachments

  • Quintillus.Zip
    327.6 KB · Views: 125
Now seems to be the right time for uploading a newer version. I'll update the instructions post when I've had a chance to go through the changes since that was posted. Everything should be pretty self-explanatory mind.

The menu items have shuffled around a little and the CITY sheet has more options. These are the basic changes in brief.
 
Top Bottom