Desert Farm

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
I've tried to add in an improvement, Desert Farm. Late game, to allow you to build farms on desert. It's strange, it shows up in the civilopedia fine and all, but wol't let me build it, no button even shows up in the worker's actions. At first I thought this might be some SDK coded thing, where you just can't irrigate deserts, but when I tried to add in TERRAIN_GRASS as a valid spot, the button still failed to show up. I used VS2005 to search all instances of FARM in the XML (have all XML files in a VS2005 project, so I can search the whole XML quickly for things), and it only shot back files I had already added in fields for. So I'm at a loss. Here is the XML from the relevant files:

ImprovementsInvos
Spoiler :
Code:
		<ImprovementInfo>
			<Type>IMPROVEMENT_EXTREME_CLIMATE_FARM</Type>
			<Description>TXT_KEY_IMPROVEMENT_EXTREME_CLIMATE_FARM</Description>
			<Civilopedia>TXT_KEY_IMPROVEMENT_EXTREME_CLIMATE_FARM_PEDIA</Civilopedia>
			<ArtDefineTag>ART_DEF_IMPROVEMENT_EXTREME_CLIMATE_FARM</ArtDefineTag>
			<PrereqNatureYields>
				<iYield>1</iYield>
				<iYield>0</iYield>
				<iYield>0</iYield>
			</PrereqNatureYields>
			<IrrigatedYieldChange>
				<iYield>1</iYield>
				<iYield>0</iYield>
				<iYield>1</iYield>
			</IrrigatedYieldChange>
			<bActsAsCity>0</bActsAsCity>
			<bHillsMakesValid>0</bHillsMakesValid>
			<bFreshWaterMakesValid>1</bFreshWaterMakesValid>
			<bRiverSideMakesValid>0</bRiverSideMakesValid>
			<bNoFreshWater>0</bNoFreshWater>
			<bRequiresFlatlands>1</bRequiresFlatlands>
			<bRequiresRiverSide>0</bRequiresRiverSide>
			<bRequiresIrrigation>1</bRequiresIrrigation>
			<bCarriesIrrigation>1</bCarriesIrrigation>
			<bRequiresFeature>0</bRequiresFeature>
			<bWater>0</bWater>
			<bGoody>0</bGoody>
			<bPermanent>0</bPermanent>
			<bUseLSystem>0</bUseLSystem>
			<iAdvancedStartCost>30</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iTilesPerGoody>0</iTilesPerGoody>
			<iGoodyRange>0</iGoodyRange>
			<iFeatureGrowth>0</iFeatureGrowth>
			<iUpgradeTime>0</iUpgradeTime>
			<iAirBombDefense>5</iAirBombDefense>
			<iDefenseModifier>0</iDefenseModifier>
			<iHappiness>0</iHappiness>
			<iPillageGold>5</iPillageGold>
			<bOutsideBorders>0</bOutsideBorders>
			<TerrainMakesValids>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_DESERT</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_TUNDRA</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
			</TerrainMakesValids>
			<FeatureMakesValids/>
			<ImprovementPillage/>
			<ImprovementUpgrade/>
			<TechYieldChanges>
				<TechYieldChange>
					<PrereqTech>TECH_HYDROPONICS</PrereqTech>
					<TechYields>
						<iYield>1</iYield>
						<iYield>0</iYield>
						<iYield>0</iYield>
					</TechYields>
				</TechYieldChange>
			</TechYieldChanges>
			<RouteYieldChanges/>
			<bGraphicalOnly>0</bGraphicalOnly>
		</ImprovementInfo>[/spoiler]

ArtDefinesImprovements:
Spoiler :
Code:
		<ImprovementArtInfo>
			<Type>ART_DEF_IMPROVEMENT_EXTREME_CLIMATE_FARM</Type>
			<bExtraAnimations>1</bExtraAnimations>
			<fScale>1.0</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
			<NIF>Art/Structures/Improvements/Farm/an_eu_farm01.nif</NIF>
			<KFM>Art/Structures/Improvements/Farm/an_eu_farm01.kfm</KFM>
			<Button>,Art/Interface/Buttons/Builds/BuildFarm.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,3,7</Button>
		</ImprovementArtInfo>

BuildInfos:
Spoiler :
Code:
		<BuildInfo>
			<Type>BUILD_EXTREME_CLIMATE_FARM</Type>
			<Description>TXT_KEY_BUILD_EXTREME_CLIMATE_FARM</Description>
			<Help/>
			<PrereqTech>TECH_BIOLOGY</PrereqTech>
			<iTime>500</iTime>
			<iCost>0</iCost>
			<bKill>0</bKill>
			<ImprovementType>IMPROVEMENT_EXTREME_CLIMATE_FARM</ImprovementType>
			<RouteType>NONE</RouteType>
			<EntityEvent>ENTITY_EVENT_IRRIGATE</EntityEvent>
			<FeatureStructs>
				<FeatureStruct>
					<FeatureType>FEATURE_JUNGLE</FeatureType>
					<PrereqTech>TECH_IRON_WORKING</PrereqTech>
					<iTime>400</iTime>
					<iProduction>0</iProduction>
					<bRemove>1</bRemove>
				</FeatureStruct>
				<FeatureStruct>
					<FeatureType>FEATURE_FOREST</FeatureType>
					<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
					<iTime>300</iTime>
					<iProduction>30</iProduction>
					<bRemove>1</bRemove>
				</FeatureStruct>
				<FeatureStruct>
					<FeatureType>FEATURE_BATTLE3</FeatureType>
					<PrereqTech>TECH_IRON_WORKING</PrereqTech>
					<iTime>400</iTime>
					<iProduction>0</iProduction>
					<bRemove>1</bRemove>
				</FeatureStruct>
				<FeatureStruct>
					<FeatureType>FEATURE_BATTLE6</FeatureType>
					<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
					<iTime>300</iTime>
					<iProduction>30</iProduction>
					<bRemove>1</bRemove>
				</FeatureStruct>
			</FeatureStructs>
			<HotKey>KB_I</HotKey>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<Button>,Art/Interface/Buttons/Builds/BuildFarm.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,3,7</Button>
		</BuildInfo>
GameTextInfos:
Spoiler :
Code:
	<TEXT>
		<Tag>TXT_KEY_BUILD_EXTREME_CLIMATE_FARM</Tag>
		<English>Build a extreme climate [LINK=IMPROVEMENT_FARM]Farm[\LINK]</English>
		<French>construire une [LINK=IMPROVEMENT_FARM]ferme[\LINK]</French>
		<German>[LINK=IMPROVEMENT_FARM]Bauernhof[\LINK] bauen</German>
		<Italian>Costruire una [LINK=IMPROVEMENT_FARM]fattoria[\LINK]</Italian>
		<Spanish>Construir una [LINK=IMPROVEMENT_FARM]granja[\LINK]</Spanish>
	</TEXT>
There are a couple more Txt files, but they shouldn't be important. I mean, if I screwed them up, I'd just expect one of those TXT_KEY things, but everything shows up fine in the Civilopedia.

Also if I force it through World Builder, the art looks strange, I just see a little hut, like the hut from a rice farm, not the normal art. Which seems wierd to me, since everything in the artdefines is pointing to the normal farm. A forced ECF from WB does add in the +1 food and +1 commerce as expected.
 
OK, so forgot to add in the action to the worker in Unitinfos.xml. Now the button shows up, but only on Plains and Grassland! Which makes no sense, since I didn't make those valid buildable plots. Also it's still unbuildable in the desert. Any ideas?
 
Your problem lies here:
Code:
			<PrereqNatureYields>
				[B]<iYield>1</iYield>[/B]
				<iYield>0</iYield>
				<iYield>0</iYield>
			</PrereqNatureYields>
This requires the plot to have a natural food output of at least 1 before Improvement can be build there.
 
Edit:

Thanks, you ninjad me with the answer. That's awesome it works now.

I don't suppose there is anyway to require it to be irrigated, since Biology takes away that effect? Though why do irrigated farms have +1 food with biology? If I could figure that out, I could just give it +1 commerce w/o irrigation, and +1food +1 commerce with. I mean, I'm sure it's possible to make these require irrigation with the SDK, but I'd rather avoid that if possible lol.
 
Actually all farms have +1 Food with biology regardless if they are irrigated or not. Its is set in the TechYieldChanges tag, the same place you have your hydroponics change. If you want it to be irrigated even though you have researched Biology I think you would have to do some Python for that. Not sure as I'm only experienced with messing with the XML.

-Geoff
 
That is not true. Irrigated farms produce +1 food compared to unirrigated. I'm wondering how I can replicate that though, I'm not seeing it.

Oh, I got it. Works now.
 
Back
Top Bottom