Question on making a mod

Nick Doom

Warlord
Joined
Sep 25, 2010
Messages
114
Hi I am new to Modding I have made changes to game before for personal use but never used anything like the modbuddy to upload my mods

I have made changes to a single XML that if places the new XML in place of the old it works

i used the modersguide.pdf and followed steps for creating a mod and i uploaded it but it does nothing when i then redownload it and install it

I guess I missed the bit where I tell the mod what to replaces but I thought that was covered with




but i geuess i was wrong
 
Okay, let's try a few things.

1> Did you BUILD the mod? (Build Project, under the Build menu)
2> If so, did it build successfully?
3> Did you check the error log file to make sure it didn't actually fail? It'll still say "successful" even if there was a problem, in a lot of cases.
4> Is your CIV5Routes.xml file directly inside the project's directory, or is it in some subfolder (in which case you need to put something like "XML/GameInfo/CIV5Routes.xml")?

and the big one that might just be awkward phrasing on your part...
5> XML files in ModBuddy don't REPLACE the existing file. They update the existing tables in the compiled file. So you need to be using <Row> tags only for new entries, and <Update> tags for everything else (with the whole Set/Where logic).

The XML filename you specified in ModBuddy only tells it the name of your own update file, which can be whatever name you want. If you name it "Bob.xml", the editor won't care, as long as that file's contents contain table names it recognizes. The Firaxis default is to make each type of table its own file (which is why Units and UnitClasses, for instance, are separate files), but you don't have to do this. People adding a new unit might decide to stick all things related to that unit into a single file, so Zombie.xml might contain a <Units> table, a <UnitClasses> table, the Civilopedia entries associated with the unit, and so on.

This'd be easier to debug if you copied the contents of your XML file to this thread, so that we can see if you did something wrong in it.
 
And also, you really shouldn't upload a mod to the database until it works.

Forgot to mention this one. Uploading a non-working mod is a BIG party foul; there'll be a lot of people who think the name sounds like something they'd use, and then it breaks their game (or worse, doesn't work but doesn't tell anyone)? It's a huge waste of time, and deleting mods that didn't do what they advertised is more of a headache than it should be.

Building it in ModBuddy automatically places it on the Installed Mod list on your own machine. Test it there, and THEN, if it works exactly like advertised, upload it. Not before. The mod browser is already getting clogged with a bunch of mods no one would ever want to download, the last thing we need is for more of the mods there to not actually work.

Now, that's the official upload system we're talking about. If you've got a nonfunctional mod that you'd like some help with, attaching it to this board is a good way to get the problems fixed. We're not EXPECTING working mods in this directory. (The file subforums, on the other hand, expect a certain level of completeness.)
 
Thanks for the advice

On 1 though 3 I did build as you said and there was no Errors
On 4 I did not put the full directory of where it needs to be
5 I thought I was just replacing the whole file but does this mean I have to tell it where I made changes

And I marked the mod as privet so it should not show up when people look it was only visible for the time it took me to download it

I have noticed
It did/does not show up in my game when I build it only download it
Also the mod is only 1/2 the size of the XML files

hears a copy of the code from the XML
Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Jon Shafer (Firaxis Games) -->
<GameData>
<!-- Table definition -->
<Table name="Routes">
<Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
<Column name="Type" type="text" notnull="true" unique="true"/>
<Column name="Description" type="text"/>
<Column name="AdvancedStartCost" type="integer" default="0"/>
<Column name="Value" type="integer" default="0"/>
<Column name="Movement" type="integer" default="0"/>
<Column name="FlatMovement" type="integer" default="0"/>
<Column name="GoldMaintenance" type="integer" default="0"/>
<Column name="Industrial" type="boolean" default="false"/>
<Column name="PortraitIndex" type="integer" default="-1"/>
<Column name="IconAtlas" type="text" default="NULL" reference="IconTextureAtlases(Atlas)"/>
<Column name="Civilopedia" type="text"/>
</Table>
<Table name="Route_Yields">
<Column name="RouteType" type="text" reference="Routes(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" notnull="true"/>
</Table>
<Table name="Route_TechMovementChanges">
<Column name="RouteType" type="text" reference="Routes(Type)"/>
<Column name="TechType" type="text" reference="Technologies(Type)"/>
<Column name="MovementChange" type="integer" notnull="true"/>
</Table>
<Table name="Route_ResourceQuantityRequirements">
<Column name="RouteType" type="text" reference="Routes(Type)"/>
<Column name="ResourceType" type="text" reference="Resources(Type)"/>
<Column name="Cost" type="integer" notnull="true"/>
</Table>
<!-- Table data -->
<Routes>
<Row>
<ID>0</ID>
<Type>ROUTE_ROAD</Type>
<Description>TXT_KEY_ROUTE_ROAD</Description>
<Value>2</Value>
<AdvancedStartCost>12</AdvancedStartCost>
<Movement>30</Movement>
<FlatMovement>30</FlatMovement>
<GoldMaintenance>2</GoldMaintenance>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_ROAD_TEXT</Civilopedia>
<PortraitIndex>40</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
</Row>
<Row>
<Type>ROUTE_RAILROAD</Type>
<Description>TXT_KEY_ROUTE_RAILROAD</Description>
<Value>4</Value>
<AdvancedStartCost>18</AdvancedStartCost>
<Movement>20</Movement>
<FlatMovement>6</FlatMovement>
<GoldMaintenance>4</GoldMaintenance>
<Industrial>true</Industrial>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_RAILROAD_TEXT</Civilopedia>
<PortraitIndex>41</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
</Row>
</Routes>
<Route_TechMovementChanges>
<Row>
<RouteType>ROUTE_ROAD</RouteType>
<TechType>TECH_MACHINERY</TechType>
<MovementChange>-10</MovementChange>
</Row>
</Route_TechMovementChanges>
<Route_Yields>
<Row>
<RouteType>ROUTE_ROAD</RouteType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>2</Yield>
</Row>
<Row>
<RouteType>ROUTE_RAILROAD</RouteType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>4</Yield>
</Row>
</Route_Yields>
</GameData>

As I said it worked when I moved it to where replaced the original to test it

it should increce cost to maintain roads but off set that by letting them grant a yield of gold, so people instead of just building the shorted rough they would look to build roads though populated areas.

again thanks for the help
 
On 4 I did not put the full directory of where it needs to be

I think we're back to the earlier point of confusion; there's no such thing as "where it NEEDS to be". Files in your mod do not replace the originals. They don't need to have the same name, they don't need to be placed in the same path structure.

The directory I'm referring to is what you have inside your own mod's directory. For instance, following Kael's suggestion, my mods contain a "Lua" directory, an "Art" directory, and an "XML" directory to keep each type of asset separate. So my mod's particular copy of GlobalDefines.xml might be placed in "XML/GlobalDefines.xml". But I could just as easily stick it in "DoNotLookInHere/Porn.xml", and the game would still recognize it as modifying the Routes table, as long as the text inside the file read
<Routes>
(stuff)
</Routes>

5 I thought I was just replacing the whole file but does this mean I have to tell it where I made changes

There are two ways to mod the game.

Method 1, the CORRECT way, is to use the Mod browser. Let's say you tell it to download "Crazy Spatz's Mod". In My Documents/whatever, there'll now be a directory called "Crazy Spatz's Mod", containing the XML files for my mod, usually within an array of subdirectories. Within the game, all you have to do is check the little circle next to Crazy Spatz's Mod at the start of your next game, and it'll modify the core game with whatever changes I made. (Awesome changes, if I do say so myself.)
If you're using a mod with this method, then the files do NOT replace the originals. They only append to them, in which case the format you gave is wrong. For instance, you don't need any of those "ColumnName" definitions at the top. All you'd need for the Routes section is this:
<Routes>
<Update>
<Set GoldMaintenance="4"/>
<Where Type="ROUTE_ROAD"/>
</Update>
</Routes>
That takes the existing ROUTE_ROAD table and just tweaks the one value. All of the other values will be whatever's in the core game's data files.
The Route_Yields, part, on the other hand, you put in just the way you had it, since there were no rows there previously.

Method 2, the (usually) wrong way, is to download the mod files and overwrite the original files in Steam/steamapps/civilization v/whatever by hand. This is BAD, although there are a handful of mods that might absolutely require this. Besides the fact that this now affects every game you play (and probably breaks multiplayer, unless it's purely a UI change), your changes will be overwritten the first time the game installs a patch that affects that file.
With this method, the files DO replace the originals, and so you'd need that complete file.

(Method 3, the "Max Powers" way, is to try editing the game's XML files by hand without using the ModBuddy interface at all. I shouldn't have to explain the problems with this one.
For those who don't know, the name comes from an old Simpsons episode: "There's the right way, the wrong way, and the Max Powers way." "Isn't that just the wrong way?" "Yeah, but FASTER!")

And I marked the mod as privet so it should not show up when people look it was only visible for the time it took me to download it

You shouldn't have needed to download it at all, since it was already on your machine. The Build action, by itself, should have already added the mod to your Installed Mod menu. No need to re-download it, and in fact, if you'd built it correctly it shouldn't have even worked, since it'd redownload it into a directory that already existed.
 
I found out why my build was not showing up in game without up/downing them I’ve put the sdk in wrong it’s my docs bit does not match up with the civ 5 one as it should.

Sorry it took so long but I understand (or I think I do lol) but my mod seems to still seems to do nothing. I’m going to trawl though the Tutorials & Reference see if I can work out why, unless someone wants to have a look at my code and tell us.

Spoiler :
Code:
<GameData>
	<Routes>
		<Update>
			<Set GoldMaintenance="2"/>
			<Where Type="ROUTE_ROAD"/>
		</Update>
		<Update>
			<Set GoldMaintenance="4"/>
			<Where Type="ROUTE_RAILROAD"/>
		</Update>
	</Routes>
	<Route_Yields>
		<Update>
			<Set YieldType="YIELD_GOLD"/>
			<Where RouteType="ROUTE_ROAD"/>
		</Update>
		<Update>
			<Set Yield="2"/>
			<Where RouteType="ROUTE_ROAD"/>
		</Update>
		<Update>
			<Set YieldType="YIELD_GOLD"/>
			<Where RouteType="ROUTE_RAILROAD"/>
		</Update>
		<Update>
			<Set Yield="2"/>
			<Where RouteType="ROUTE_RAILROAD"/>
		</Update>
	</Route_Yields>
</GameData>

I can’t believe how long this is taking me to understand and get working; I thought I had picked a nice simple thing to start with lol
 
You're still making one of the mistakes I mentioned earlier.

If there's not already a Route_Yields entry for roads and/or railroads, and I'm pretty sure there isn't (no files in front of me, though) then you do NOT use the <Update> tags. You do a straight <Row>, just as you had in the original post. <Update> is for when there's already an entry in that particular table and you're trying to edit that entry (but when there is, you MUST use it, it's not optional). <Row> is for when you need to add an entirely new entry to a table.

So in this particular case, the <Routes> table needs Updates, because there are already definitions for roads and railroads in that table, but <Route_Yields> needs Rows, because there's nothing in that table previously.
 
That doesn't actually change the answer. The problem is one of syntax. Let's take one of your parts:
<Update>
<Set Yield="2"/>
<Where RouteType="ROUTE_ROAD"/>
</Update>

This takes any yields tagged with ROUTE_ROAD within that table and changes their number to 2. So in the absence of any other changes, this'd change the food yield for roads from 0 to 2. Now, with the other change (changing YieldType) you'd think it'd work, but I wouldn't be surprised if it doesn't.
Normally, you want to be as specific as possible. Something like <Where RouteType="ROUTE_ROAD" YieldType="YIELD_GOLD"/> to make sure it's not editing multiple lines at once; it treats the two conditions as an AND and only activates the Set command if they're both true. Conversely, putting multiple things into the Set makes them both happen at once, so you could have done a single <Set YieldType="YIELD_GOLD" Yield="2"/> command.

The thing is, there's no problem with having multiple entries in a single table for the same thing. So just because there's already a YIELD_FOOD entry for roads, that doesn't mean you can't add a YIELD_GOLD entry for roads as well. It'll just give both, adding 0 food and 2 gold. So in this case, you're better off using the <Row> logic than the <Update> logic regardless.


Now, back to the original discussion. If there's already that 0-yield food entry in the Route_Yields table then yes, what you wrote there should work in theory. So there are two possibilities, as I see it:
1> There's some Lua component to the logic as well, and changing the XML file doesn't do anything because the Lua files aren't LOOKING for an XML value. A prime example of this is on strategic resources; even though the XML files contain yield parameters, saying how many Irons will be placed in each deposit, changing these values doesn't actually do anything because the PlaceStrategicPlots.lua (or whatever its name is) hard-codes it all internally.
I have no idea which file you'd have to start looking in first. But it's possible that the Route_Yields field just isn't being used, because most of the yield improvements happen in Terrains.xml or Improvements.xml.

2> Your mod isn't actually loading. This happens sometimes, where the mod fails to compile correctly and so isn't actually loaded when you start a game, despite it telling you it's all fine.
The easy way to test this is to add some other obvious change to your mod, something you can check on turn 1. For instance, give the Palace +1 happiness or something. That way, you'll immediately know when you start a new game whether the mod is actually being applied. (Civilopedia entries also work well for this, if you want something that doesn't screw up game balance.) I've had this happen to me, where a mod worked fine on one game and then on the next one suddenly wasn't active, even though I'd changed nothing and had manually turned it on first.
 
I am guessing it must be 2> because it worked when I was doing it the Max Power way and just replaced the XML to test it worked so if my new code should change it to how I wrote it then, there is no reason for it not to work

I have just tried it with added at the end
Spoiler :
Code:
	<Technologies>
		<Update>
			<Set Cost="35000"/>
			<Where Type="TECH_POTTERY"/>
		</Update>
I just noted when pasting it hear i did not end it right but it worked

I have just taken it out and it works so it must have just not built right the 1st time
Thanks for all your help Spatzimaus you’re the type of person that the special thanks bit in the mod browser was made for
 
Top Bottom