PSA re PrereqTech for Buildings and Units in XML

LeeS

Imperator
Joined
Jul 23, 2013
Messages
7,241
Location
Illinois, USA
Note that the game does not equate this:
Code:
<PrereqTech>null</PrereqTech>
or this:
Code:
<PrereqTech>NONE</PrereqTech>
or this:
Code:
<PrereqTech>none</PrereqTech>
in XML files as being equivalent to this
Code:
<PrereqTech>NULL</PrereqTech>
In all cases where a technology prerequisite is not stated as NULL the game attempts to parse the character-string entered as if it were a valid Type name to be found within table Technologies.

You need to state NULL or you need to omit the column altogether
  • this works because in both Buildings and Units the default value for column PrereqTech is NULL.
    • From Table Buildings:
      Code:
      <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
    • From Table Units
      Code:
      <Column name="PrereqTech" type="text" reference="Technologies(Type)" default="NULL"/>
  • Stating any other "value" in XML when there is to be no PrereqTech will cause invalid reference errors in the Database.log at the very least, and might cause some odd behaviors in UI panels.

Also note that column ObsoleteTech in table Units and table Buildings acts in the same way and is defined in the same way. The default value is NULL.
 
So I gotta scream at ModBuddy to make a building unlocked from turn 0?

You are misinterpretting. You simply use as Firaxis intended you to use:
  • omit the column for PrereqTech entirely, or,
  • state NULL as the PrereqTech.
Look closely at the following:
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>BUILDING_LRS_HAPPY0</Type>
			<BuildingClass>BUILDINGCLASS_LRS_HAPPY0</BuildingClass>
			<Cost>40</Cost>
			<GoldMaintenance>1</GoldMaintenance>
			<Help>TXT_KEY_BUILDING_LRS_HAPPY0_HELP</Help>
			<Description>TXT_KEY_BUILDING_LRS_HAPPY0</Description>
			<Strategy>TXT_KEY_BUILDING_LRS_HAPPY0_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<NeverCapture>true</NeverCapture>
			<NukeImmune>true</NukeImmune>
			<MaxStartEra>ERA_ANCIENT</MaxStartEra>
			<Happiness>1</Happiness>
			<IconAtlas>ATLAS_ERA_BUILDINGS</IconAtlas>
			<PortraitIndex>15</PortraitIndex>
		</Row>
	</Buildings>
</GameData>
Nowhere in that code do I use column PrereqTech. This makes the building use the default value of NULL for column PrereqTech, and this makes the building available to construct from the beginning of the game.
 
Top Bottom