Civ4 XML Editor - First Release!

Futzy

Chieftain
Joined
Oct 27, 2005
Messages
17
BUG FIX! Fixed the alternate directory bug!

OK, this began life as a little app I was throwing together to help me create new civilizations for a mod. But as I got rolling, I decided it might actually be good enough to release, so here it is, version 0.1!

What it does so far:
  • Creates new mod folders
  • Updates the ini file in the root of mod folders
  • Allows you to create new civilizations and delete existing ones
  • Allows you to edit all civ properties located in the CIV4CivilizationInfos.xml file
  • Allows you to edit color and text data from the other relevant XML files
  • Enforces good practices by not modifying any of the root files
  • Stores location of Civ 4 files in a config file so you can change it if you didn't install it to the normal folder

Known Shortcomings and Bugs:
  • Does not work on any of the non-English languages in the text files
  • Does not edit one or two sections of the civ XML because I could not find samples of how they needed to be structured
  • Does not allow you to prevent a civ from building certain units

What it WILL do in future versions:
  • Allow you to edit Leaderheads

What it MAY do in future versions:
  • Include a graphic viewer so you can more easily select graphics
  • Include an audio player so you can more easily select audio
  • Allow you to edit other sections of the XML


For the technically inclined, I wrote the app in C# 2.0, since I just got my hands on the final version, and this seemed like a good teaching project.

PLEASE NOTE: Because this is written in a .NET 2.0 language, most of you will need to download and install the .NET 2.0 framework. You can find it here.

Please let me know what you think, I would love for this to continue to grow.

Edited to update feature list with things I forgot the first time around.
 

Attachments

  • Civ4XMLEditorSetup.zip
    411 KB · Views: 11,510
Just so you know that one the colours page you can choose 4 colours but there's only 3 preview boxes, this is pretty confusing.

Apart a few errors where you can just click continue it works really well.
 
Futzy said:
PLEASE NOTE: Because this is written in a .NET 2.0 language, most of you will need to download and install the .NET 2.0 framework.


Ouch. There goes my chance of trying out the editor. .NET 1.1 and 2.0 cannot co-exist on the same machine and I really need 1.1 for a project that doesn't work with 2.0.
 
Vilu said:
Ouch. There goes my chance of trying out the editor. .NET 1.1 and 2.0 cannot co-exist on the same machine and I really need 1.1 for a project that doesn't work with 2.0.

You can run both at the same time. If you are having issues with IIS you can just right-click on the web app and select the 1.1 framework from the selector box (instead of the default 2.0) in the properties dialog.
 
!!!!!!!!!!!!


The editor doesn;t want to work becose I have diffrent path to game. I edited config file with a proper path but editor is still looking for 'C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods
 
Ok well it's loosing some of my information now which is pretty irritating. :p

Things like Civilopedia entries for the new factions, city names (they show up in the list but the name text box remains empty).

Weird thing is the first time ran it, they were held ok. I had to close it and when I came back to it later it no lnger saves this info. I think it HAS saved it in the XML but you can no longer see what you've put in the TEXT boxes in the app. I think. Something like that anyway.

Looking forward to the leaders part. I just tried to do it manually and it didn't work. :(
 
Feet said:
Ok well it's loosing some of my information now which is pretty irritating. :p

Things like Civilopedia entries for the new factions, city names (they show up in the list but the name text box remains empty).

On the city tab, the names that show up in the list box on the left are the names in the civilization XML file, then when you click on one of the names, you should see the "friendly" name popup in the text box on the right (which is stored in one of the files in the Text directory, I don't remember which one off the top of my head). If it's losing those values, check and see when you save if it's saving both files. If should, but if it only saves the civ XML and not the text XML, that would explain the behavior you describe. If you could check and let me know, that'll help me find and fix the bug.
 
Feet said:
Just so you know that one the colours page you can choose 4 colours but there's only 3 preview boxes, this is pretty confusing.

This is confusing, but it is because it is the way it works in the files. That first drop down defines a set of 3 colors, a primary, a secondary, and a text color. Then the 3 drop downs below that edit the actual colors. So for example (and I'm at work now, so I'm doing this from memory, so the names are probably a little off), let's say the first drop down is PLAYERCOLOR_BLUE, then under that are COLOR_BLUE for Primary, COLOR_WHITE for Secondary, and COLOR_BLUE_TEXT for Text. If you go in and Edit COLOR_BLUE_TEXT, then ALL items in the game that use COLOR_BLUE_TEXT will be changed to the new color you specify. If you instead hit New on Text Color, and create a new custom color called MYMOD_COLOR_BLUE_TEXT, then the default COLOR_BLUE_TEXT will remain unchanged, but the default PLAYERCOLOR_BLUE will now point to your new MYMOD_COLOR_BLUE_TEXT for its text color. So if you don't want to change any of the original colors, you should always start by creating a new color set at the top like MYMOD_PLAYERCOLOR_BLUE, then make new colors down below as necessary. But if you do want to overwrite the default colors, you have that ability.
 
It's updating an XML file called Text_Civilopedia_Civleaders.xml.

Pretty sure this is incorrect and it should be Civ4GameText_Civilopedia_Civleaders.xml

That's the problem. Its reading from the latter and writing to the former. Needs to both be the latter. :) Just a typo I guess.
 
Futzy said:
This is confusing, but it is because it is the way it works in the files. That first drop down defines a set of 3 colors, a primary, a secondary, and a text color. Then the 3 drop downs below that edit the actual colors. So for example (and I'm at work now, so I'm doing this from memory, so the names are probably a little off), let's say the first drop down is PLAYERCOLOR_BLUE, then under that are COLOR_BLUE for Primary, COLOR_WHITE for Secondary, and COLOR_BLUE_TEXT for Text. If you go in and Edit COLOR_BLUE_TEXT, then ALL items in the game that use COLOR_BLUE_TEXT will be changed to the new color you specify. If you instead hit New on Text Color, and create a new custom color called MYMOD_COLOR_BLUE_TEXT, then the default COLOR_BLUE_TEXT will remain unchanged, but the default PLAYERCOLOR_BLUE will now point to your new MYMOD_COLOR_BLUE_TEXT for its text color. So if you don't want to change any of the original colors, you should always start by creating a new color set at the top like MYMOD_PLAYERCOLOR_BLUE, then make new colors down below as necessary. But if you do want to overwrite the default colors, you have that ability.

Ahhh I see. Thanks for clarifying that. :)
 
Orion66 said:
!!!!!!!!!!!!


The editor doesn;t want to work becose I have diffrent path to game. I edited config file with a proper path but editor is still looking for 'C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods

Same here.. you can change the config file but it doesn't do anything :p
I cant use this because I install all my games to a different drive and it won't stop looking on my system drive.
 
silentknight111 said:
Same here.. you can change the config file but it doesn't do anything :p
I cant use this because I install all my games to a different drive and it won't stop looking on my system drive.

oh my, what a pity - i also have games installed on their own harddisk, not default :(
 
Maybe he can do an update that solely fixes that part where you can specify where to locate the game? Everyone here would love you!
 
I tried and even edited the hex code to change to my location on my hard drive with no luck. I can't find it anywhere.
 
OK guys, I found and fixed the bug with the directory. I have updated the file attached to the first message.

If you care, it was a classic 3 in the morning bug, I was reading the value out of the config file, but then overwriting it with your OS's Program Files location... :D
 
WHY DO I KEEP GETTING THIS ERROR

System.NullReferenceException: Object reference not set to an instance of an object.
at Civ4XMLEditor.frmMain.SaveFiles()
at Civ4XMLEditor.frmMain.saveToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Civ4XMLEditor
Assembly Version: 0.1.2145.38171
Win32 Version: 0.1.*
CodeBase: file:///C:/Program%20Files/Civ4%20XML%20Editor/Civ4XMLEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 
Ok there's a new typo in the config file of the new version you put out.

<value>C:\Program Files\Firaxis Games\Sid Meier's Civilization 5</value>

Spot the error. ;)

I think that's just wishful thinking tbh. :p Setting it back to 4 makes the new version work for me again.
 
Just so you know what i mean about the app saving to the incorrect xml names, here are two screenshots.

This one is taken from

C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Assets\XML\Text



This one is taken from my Mod folder, after I have used your app.

C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods\ASOIAF\Assets\XML\Text



It's writing 4 new xml files with the changes I input instead of to the actual files it should be writing too that the mod will use (which have Civ4Game in front of the name).

Your app is reading from the right files (hence why when I reload the app it doesn;t show the chahges I made), abd is writing to the wrong ones.

Hope that helps you and well done on a brilliant mod. This has saved me quite a few hours, despite a few problems.

It's easy to fix manually however, as you just rename the incorrectly named files to the correct name and all works well. :)
Hope this helps you.
 
Top Bottom