[MOD] Need help: Building_YieldChangesPerPop

Kewlipo

Chieftain
Joined
Jun 27, 2015
Messages
99
I'm making a house-mod for my friends to play with. I want to reduce the science per population in the Public School, from +1 science per 2 population to +1 science per 4 population.

This is what I am currently doing:

<Building_YieldChangesPerPop>
<Update>
<Where Type="BUILDING_PUBLIC_SCHOOL" />
<Set Yield="25" />
</Update>
</Building_YieldChangesPerPop>

When I test the mod, the public school is not changed. The rest of the mod loads correctly, and I cannot find any errors in the logs. Any idea what is up?
 
  1. If you see no errors in the logs then one of the following applies:
    • you've not enabled error logging correctly
    • you aren't looking at or aren't looking closely enough at the contents of logging file Database.log
    • your file and it's code is not actually being loaded.
  2. Table Building_YieldChangesPerPop has no column called Type. This mistake will cause a fatal error when the game reads the file, with the entire contents of the xml file being rejected and ignored by the game.
  3. The proper column-name for table Building_YieldChangesPerPop is BuildingType.
  4. The code you would want would be:
    Code:
    <GameData>
    	<Building_YieldChangesPerPop>
    		<Update>
    			<Where BuildingType="BUILDING_PUBLIC_SCHOOL" />
    			<Set Yield="25" />
    		</Update>
    	</Building_YieldChangesPerPop>
    </GameData>
 
Well the thing is, I already had an XML error that I fixed by identiication through the Database file so I think logging is working alright. Also, I had changed the production cost of The Great Library by using Type instead of BuildingType - and that worked correctly too.

I am out at the moment but when I get back home I will implement your change. I thought that might have been the problem, but became confused because Type worked correctly for The Great Library.

Will report results as soon as possible.
 
  1. "Buildings" is the parent table and uses column "Type".
  2. "Building_YieldChangesPerPop" is a child (or subsidiary) table and therefore uses column "BuildingType"
Definitions of the two tables from the top of the BNW version of the "CIV5Buildings.xml" file:
Spoiler Buildings :
Code:
	<Table name="Buildings">
		<Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
		<Column name="Type" type="text" notnull="true" unique="true"/>
		...etc....
	</Table>
Spoiler Building_YieldChangesPerPop :
Code:
	<Table name="Building_YieldChangesPerPop">
		<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
		<Column name="YieldType" type="text" reference="Yields(Type)"/>
		<Column name="Yield" type="integer"/>
	</Table>
 
That makes sense. I’ll fix it when I get home.

Thank you and cheers :goodjob:
 
Another quick question, do you happen to know how NQ mod stops Great Scientists from continuing to scale their bulb amount for the past 8 turns? In NQ mod, they simply are worth the 8 turns of research on the date they were born and do not increase as the game goes on, forcing you to either make an academy or bulb instantly. I want to do something like this - I've been combing the files in NQ mod but can't find anything that would be making a change like that. (Apologies if I'm asking too much)
 
I've never used nor looked into the code of the NQ mod so I've no idea. It might be a DLL mod, which would mean it might be running a custom-edited version of the game's "source code", wherein many things can be done that "normal" mods cannot.
 
Yeah, I had to install Visual Studio and do a bit of tweaking but I got it to work. Thank you for your help.
 
Back
Top Bottom