Two mistakes I can't quite find--please help!

isnorden

Amnesiac Modder
Joined
Jul 6, 2012
Messages
608
Location
Madison, Wisconsin, USA
I was updating the "Urban Renewal and Sacred Cows" mod tonight, when a playtest and some log messages revealed mistakes. Unfortunately, I can't locate the problems exactly (which would help me correct the errors). Could one of you help me, please?

  1. The file trait_tweaks.xml gave me this error message in database.log:

    Code:
    [956.312] Database::XMLSerializer (XML/trait_tweaks.xml): <Update> element requires a child <Set> element.
    Could someone please tell me where the missing <Set> goes?
  2. The new Gopachara improvement should have a Civilopedia entry; unfortunately, the text I wrote is nowhere in sight. Please let me know what's keeping it from appearing, if you can...many thanks!
 
You used <Set> as a child of <Where>, this isn't the right way of doing things - <Set> should be a child of <Update>, alongside <Where>. Also there are no columns named "Name" or "Value" in Traits. So instead of:
Code:
	<Traits>
		
			<Update>
			
				<Where Name="CityUnhappinessModifier">
					<Set Value="75"/>
				</Where>
				
				<Where Name="PopulationUnhappinessModifier">
					<Set Value="75"/>
				</Where>
				
			</Update>	
		
	</Traits>
It should be (you don't need a "Where" if you want to apply it to all traits):
Code:
	<Traits>
		<Update>
			<Set CityUnhappinessModifier="75" PopulationUnhappinessModifier="75"/>
		</Update>	
	</Traits>

Note that it will actually increase both types of unhappiness by 75% - see how it's defined for India in unmodded game - +100% for cities, and -50% for population. So if you want to reduce both by 25% you should set them to -25.

Some other things I noticed:

1. What's the point of increasing the quantity of Cattle? It's a bonus resource, so the quantity doesn't matter (unless you change it to strategic or luxury in your mod).

2. Changing FOOD_CONSUPTION_PER_POPULATION and UNHAPPINESS_PER_POPULATION to fractional values probably won't work, because they should be integer values. You can reduce unhappiness per population by changing PopulationUnhappinessMod in HandicapInfos (or by changing it in all traits, as you try to do in the mod). I can't think of any way to set food consumption per population to 0.5.

I don't know why your text doesn't work, does it give any errors in database.log?

Edit: I have found a possible cause - gopachara.xml doesn't have the closing </GameData> tag. Add it at the end of the file.
 
Thank you for correcting my code, PawelS; I spotted that missing </GameData> a few minutes after posting the original message, but couldn't have found the other mistakss if my life depended on it.

P.S. Just so you know where I got some of that code...

  1. The fractional consumption/unhappiness values were tweaked from BigGlare's "City Bonanza" population mod on Steam Workshop; his mod has worked as intended in my playtests, without giving any error messages for non-integer values. (EDIT: The original values in BigGlare's code were fractions as well; I doubled the consumption rate from the 0.25 he originally chose.)
  2. The doubled cattle amount was indeed meant to raise happiness, as you guessed. I usually play with the "Enhanced Food and Happiness" mod from the CivFanatics Download Center; it changes most edible resources from bonuses to luxuries. Still. not every player chooses the same mods I would; I'll borrow a snippet of code from those resource changes, so the extra cows do what I planned all along.
 
Back
Top Bottom