How do I add terrain yields?

Ixadias

Chieftain
Joined
Jul 25, 2012
Messages
7
I'm new to modding, and despite quite a bit of research, I'm stuck on trying to create a specific new trait. The trait I'm trying to make is basically, desert tiles produce +1 food and +1 production (Kinda similar to Boudicca...). However, I can't find any way to express that with the given tables.

Trait_YieldChanges only seems to modify the player city,
Trait_ExtraYieldThresholds only seems to add to existing yields,
and Trait_YieldChangesStrategicResources only seems to work on strat resources (?).

The base goal of the trait would be like:
"Desert tiles worked by your cities get +1 food, +1 production, and +1 research."

The final goal of the trait would be like:
"Desert tiles worked by your cities get +1 food, +1 production, and +1 research per era." <- basically saying, at the start of the game, they'd be +1 each, next era they would be +2, etc

If anyone could shed some light on how this might be done, I would be very grateful! :D
 
You can do it by giving that civ a unique version of the Palace, which gives them a building in all cities. That building would change the yields from Desert, like Petra does.

Increasing the yields with eras is a more complicated thing, it will probably require some LUA code.

Another thing is that the AI will have no idea about the increased yields, so they won't affect its decisions where to found cities.
 
That sounds like a fine idea. I'll start plugging away at it! Any suggestions for samples on how to make the custom buildings? For now I'll look at Petra. Thanks!!
 
ive actually done this for Naeralith already. here is the code i used:

In Traits.xml:
Code:
		<Row>
			<Type>TRAIT_ANCESTRAL_BLESSINGS</Type>
			<Description>TXT_KEY_TRAIT_ANCESTRAL_BLESSINGS</Description>
			<ShortDescription>TXT_KEY_TRAIT_ANCESTRAL_BLESSINGS_SHORT</ShortDescription>
			<FreeBuilding>BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</FreeBuilding>
		</Row>

in Buildings.xml
Code:
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_TRAIT_BUILDING</Type>
			<DefaultBuilding>BUILDING_NAERALITH_LIVE_OFF_THE_LAND</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_TRAIT_BUILDING</Description>
		</Row>
	</BuildingClasses>
	<Buildings>
		<Row>
			<Type>BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</Type>
			<BuildingClass>BUILDINGCLASS_TRAIT_BUILDING</BuildingClass>
			<Cost>-1</Cost>
			<PrereqTech>TECH_AGRICULTURE</PrereqTech>
			<Help>TXT_KEY_BUILDING_NAERALITH_ANCESTRAL_BLESSINGS_HELP</Help>
			<Description>TXT_KEY_BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</Description>
			<Civilopedia>TXT_KEY_BUILDING_NAERALITH_ANCESTRAL_BLESSINGS_DESC</Civilopedia>
			<Quote>TXT_KEY_BUILDING_NAERALITH_ANCESTRAL_BLESSINGS_QUOTE</Quote>
			<ArtDefineTag>MONUMENT</ArtDefineTag>
			<NukeImmune>true</NukeImmune>
			<GreatPeopleRateModifier>50</GreatPeopleRateModifier>
			<HurryCostModifier>-1</HurryCostModifier>
			<MinAreaSize>-1</MinAreaSize>
			<IconAtlas>NAERALITH_CIV_ATLAS</IconAtlas>
			<NeverCapture>true</NeverCapture>
			<PortraitIndex>12</PortraitIndex>
		</Row>
	</Buildings>
	<Building_TerrainYieldChanges>
		<Row>
			<BuildingType>BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</BuildingType>
			<TerrainType>TERRAIN_DESERT</TerrainType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</BuildingType>
			<TerrainType>TERRAIN_FLOOD_PLAINS</TerrainType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_NAERALITH_ANCESTRAL_BLESSINGS</BuildingType>
			<TerrainType>TERRAIN_OASIS</TerrainType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_TerrainYieldChanges>

and you will obviously need the TXT_KEY refs in the newText.xml file :)

good luck!
 
Thanks for sharing your code. It's an easier method that I described, as it doesn't involve an unique palace. I'll use it in my mod too.
 
Thanks for sharing your code. It's an easier method that I described, as it doesn't involve an unique palace. I'll use it in my mod too.

Its my pleasure :D im just happy to finally being able to give back to the community that has helped me out so much :p


however i noticed that part of my code was wrong. I had classified Oasis and Flood plains as terrain, and they are in the <Building_TerrainYieldChanges> table. however because they are resources they should be in the <Building_FeatureYieldChanges> table :p

also @ Ixadias: if you need me to go over any of that in more detail im more than happy to help :)
 
Hey Changer, thanks a lot!

Um, I think I've got it, but I think I've made a mistake somewhere, as when I enable the mod on my PC or mac I don't see the new civ/leader I created. On mac, I don't even see the mod in my mods list! I'm doing principal dev and testing on my mac though, so it would be most helpful to get it working there first.

Right now I have a .modinfo that looks like:

Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<Mod id="1450dc65-5d97-43ae-b724-335a0d41bca4" version="1">
<Properties>
<Name>Desert Power</Name>
<Stability>Alpha</Stability>
<Description>Adds a new playable faction, the Fremen.</Description>
<Authors>Ix</Authors>
<SpecialThanks>Firaxis</SpecialThanks>
<Homepage>http://www.civfanatics.com</Homepage>
<AffectsSavedGames>1</AffectsSavedGames>
<MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
<SupportsSinglePlayer>1</SupportsSinglePlayer>
<SupportsMultiplayer>1</SupportsMultiplayer>
<SupportsMac>1</SupportsMac>
<ReloadLandmarkSystem>0</ReloadLandmarkSystem>
<ReloadUnitSystem>0</ReloadUnitSystem>
</Properties>
<Dependencies />
<References />
<Blocks />
<Files>
<File>Civ_Fremen_Buildings.xml</File>
<File>Civ_Fremen_Text.xml</File>
<File>Civ_Fremen_Traits.xml</File>
<File>CIV5Leader_MuadDib.xml</File>
<File>Civ_Fremen.xml</File>
</Files>
<EntryPoints>
</EntryPoints>
<Actions>
<OnModActivated>
<UpdateDatabase>Civ_Fremen_Buildings.xml</UpdateDatabase>
<UpdateDatabase>Civ_Fremen.xml</UpdateDatabase>
<UpdateDatabase>Civ_Fremen_Traits.xml</UpdateDatabase>
<UpdateDatabase>CIV5Leader_MuadDib.xml</UpdateDatabase>
<UpdateDatabase>Civ_Fremen_Text.xml</UpdateDatabase>
</OnModActivated>
</Actions>
</Mod>


And then I have each of those five xml files in folders underneath the .modinfo, like so:

DesertPower.modinfo
[XML]
CIV5Leader_MuadDib.xml
[Civilizations]
Civ_Fremen_Traits.xml
Civ_Fremen.xml
Civ_Fremen_Buildings.xml
[NewText]
Civ_Fremen_Text.xml


Sadly, I have no experience with these modinfo files, so I don't know how to lay them out. Other than that, I think I just need to go through each of my xml's and make sure they look correct. I still need to update my method to look like yours though, changer.
 
Alright, I've gotten the mod to show up (it was an issue with mac having a hidden .xml file extension on the end of my .modinfo, even though I have file extensions turned on.). However, the civilization I created isn't appearing the list (just like on pc). I can only assume this means that there was an error in one or more of my .xml files. I don't see anything alarming in the Database.log or xml.log files.

Anyone know where to look to figure out what might be causing the failure?
 
i had the same problem when i started adding civs myself... im just tryng to remember what it was that i did that fixed it... however without really being able to see your code i cant really help. did you follow Kael's guide to adding a civ? also have you remembered to go to the actions tab and go OnModActivated -> UpdateDatabase -> 'name of each of you xml files'? i often forgot to do this when i was starting out and the mod just will not work if you dont do it.

other than that im not sure.
 
Hello Changer,

Alright, I've gotten my civ to appear, and I'm now testing my perk. I've built it as you described, and for ease, I assigned it to the leader Harun Al Rahid (Arabia? I think...). However, I'm not getting the structure added to my city(s) and it's not even in the build options. I've modeled it after the monument, but just added the features I wanted. I've pasted my code below (I've omitted the strings file, but it's reading the strings fine), let me know if you see anything wrong with it. The trait appears correctly in his description, but in game, I see no effect. Desert tiles don't show any increased yields after I've plopped my city down. Thanks again for all the assistance so far!!

Trait file:
Spoiler :

<?xml version="1.0" encoding="utf-8"?>
<GameData>
<Traits>
<Row>
<Type>TRAIT_DESERT_POWER</Type>
<Description>TXT_KEY_TRAIT_DESERT_POWER</Description>
<ShortDescription>TXT_KEY_TRAIT_DESERT_POWER_SHORT</ShortDescription>
<FreeBuilding>BUILDING_SIETCH</FreeBuilding>
</Row>
</Traits>
<Leader_Traits>
<Update>
<Where LeaderType = "LEADER_HARUN_AL_RASHID"/>
<Set TraitType = "TRAIT_DESERT_POWER"/>
</Update>
</Leader_Traits>
</GameData>


Building file:
Spoiler :

<?xml version="1.0" encoding="utf-8"?>
<GameData>
<Buildings>
<Row>
<Type>BUILDING_SIETCH</Type>
<BuildingClass>BUILDINGCLASS_SIETCH</BuildingClass>
<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
<Cost>0</Cost>
<GoldMaintenance>0</GoldMaintenance>
<Help>TXT_KEY_BUILDING_MONUMENT_STRATEGY</Help>
<Description>TXT_KEY_BUILDING_MONUMENT_DESC</Description>
<Civilopedia>TXT_KEY_BUILDING_MONUMENT_PEDIA</Civilopedia>
<Strategy>TXT_KEY_BUILDING_MONUMENT_STRATEGY</Strategy>
<ArtDefineTag>MONUMENT</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<Culture>0</Culture>
<HurryCostModifier>0</HurryCostModifier>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<NeverCapture>true</NeverCapture>
<PortraitIndex>21</PortraitIndex>
</Row>
</Buildings>
<Building_TerrainYieldChanges>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>1</Yield>
</Row>
</Building_TerrainYieldChanges>
</GameData>
 
the problem is that you've told the game to look for a new building class "<BuildingClass>BUILDINGCLASS_SIETCH</BuildingClass>" but you haven't defined it. try adding the code below to the building file and see if it works:


Code:
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_SIETCH</Type>
			<DefaultBuilding>BUILDING_SIETCH</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_SIETCH</Description>
		</Row>
	</BuildingClasses>

also as a side note you have a lot of unused tags (and some are wrong) in there that you could actually delete entirely. ive made changes red and crossed out what can be deleted below:

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
<Buildings>
<Row>
<Type>BUILDING_SIETCH</Type>
<BuildingClass>BUILDINGCLASS_SIETCH</BuildingClass>
<FreeStartEra>ERA_MEDIEVAL</FreeStartEra>
<Cost>[COLOR="Red"]-1[/COLOR]</Cost>
[s]<GoldMaintenance>0</GoldMaintenance>[/s]
<Help>TXT_KEY_BUILDING_MONUMENT_STRATEGY</Help>
<Description>TXT_KEY_BUILDING_MONUMENT_DESC</Description>
<Civilopedia>TXT_KEY_BUILDING_MONUMENT_PEDIA</Civilopedia>
<Strategy>TXT_KEY_BUILDING_MONUMENT_STRATEGY</Strategy>
<ArtDefineTag>MONUMENT</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
[s]<Culture>0</Culture>[/s]
[s]<HurryCostModifier>0</HurryCostModifier>[/s]
<IconAtlas>BW_ATLAS_1</IconAtlas>
<NeverCapture>true</NeverCapture>
<PortraitIndex>21</PortraitIndex>
</Row>
</Buildings>
<Building_TerrainYieldChanges>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<BuildingType>BUILDING_SIETCH</BuildingType>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>1</Yield>
</Row>
</Building_TerrainYieldChanges>
</GameData>
 
Hey changer,

Thanks a ton, adding that building definition did the trick. Now to re-integrate it with my civilization and add buildings that progress off the sietch! Thanks a bunch, you rock!
 
its my pleasure Ix :)

Are you making a dune mod by chance? i love the dune universe :D
 
Well, I was testing modding and creating new civ's, and I'm fan enough of the universe to start there. It was a fun enough, though, that I might make a full blown mod :P

+10 internets to you good sir for being a fan!
 
Back
Top Bottom