how do I add resources

chickenx4

Prince
Joined
Jul 21, 2016
Messages
564
Location
Cobb county,GA
hey I'm need help by adding the coconut in my game but I don't know how to
 
Part 1 - adding the art

In the other thread you posted a link that contained the coconut information you were trying to add. It is not set up to be added "as is" into a mod. You need to take it apart and move the various bits to where they belong. None of this is stated anywhere in that compressed file and some of the info is not exactly correct or perhaps consistent would be a better word.

The folder contains
  • CIV4ArtDefines_Bonus_COCONUT.xml
  • coconut.jpeg
  • coconut.nif
  • coconuts.dds
  • coconut_button.dds
  • coconut_gamefont.dds
  • coco_gamefont.tga
  • treepage.dds

CIV4ArtDefines_Bonus_COCONUT.xml contains the art definition for the coconut. It sort of tells you where the rest of the contents should go. The XML element <BonusArtInfo> should be copied into your mod copy of the CIV4ArtDefines_Bonus.xml file found in the Assets/XML folder.

This line
Code:
<NIF>Art/Terrain/Resources/Coconut/coconut.nif</NIF>
tells you that you need a folder in your mod's Assets folder called Art/Terrain/Resources/Coconut. In that folder you need to put
  • coconut.nif
  • coconuts.dds
  • treepage.dds

The line
Code:
<Button>Art/Interface/Buttons/WorldBuilder/coconut.dds</Button>
is inconsistent you need to copy coconut_button.dds into the folder and rename it.

The line
Code:
<FontButtonIndex>44</FontButtonIndex>
and the file coco_gamefont.tga are about the Game Fonts. It is how the little icon is set up t be shown in places like the resource list in the city screen. This used to be very difficult but Asaf's GameFont Editor makes it simpler
 
Part 2 - getting the resource in game

Normally I would just look at The Resource Mod for this and crib, but I lost my copy when I lost all my hard drives including the back up ones:(, so I will need to look elsewhere.

In part 1 I dealt with the graphic definitions in CIV4ArtDefines_Bonus.xml now we need to add in a definition of the bonus so it will appear and be used in game. This is done via the files in the Assets/XML/Terrain folder.
  • CIV4BonusInfos.XML defines the bonus so it can appear on the map
  • CIV4ImprovementInfos.XML defines how it can be worked

You need to decide when, at what tech the resource becomes available and can be used and what improvement is needed to access coconuts. I have assumed agriculture and farms in the code below.

In CIV4BonusInfos.XML you will need to add something like:-
Code:
	<BonusInfo>
		<Type>BONUS_COCONUT</Type>
		<Description>TXT_KEY_BONUS_COCONUT</Description>
		<Civilopedia>TXT_KEY_BONUS_COCONUT_PEDIA</Civilopedia>
		<BonusClassType>BONUSCLASS_GENERAL</BonusClassType>
		<ArtDefineTag>ART_DEF_BONUS_COCONUT</ArtDefineTag>
		<TechReveal>TECH_AGRICULTURE</TechReveal>
		<TechCityTrade>TECH_AGRICULTURE</TechCityTrade>
		<YieldChanges>
			<iYieldChange>2</iYieldChange>
			<iYieldChange>1</iYieldChange>
		</YieldChanges>
		<iHealth>1</iHealth>
		<iPlacementOrder>5</iPlacementOrder>
		<iConstAppearance>50</iConstAppearance>
		<iMinAreaSize>1</iMinAreaSize>
		<iMinLatitude>0</iMinLatitude>
		<iMaxLatitude>40</iMaxLatitude>
		<Rands>
			<iRandApp1>25</iRandApp1>
			<iRandApp2>25</iRandApp2>
			<iRandApp3/>
			<iRandApp4/>
		</Rands>
		<iPlayer>0</iPlayer>
		<iTilesPer>16</iTilesPer>
		<iUnique>2</iUnique>
		<bArea>0</bArea>
		<bFlatlands>1</bFlatlands>
		<bNormalize>1</bNormalize>
		<TerrainBooleans>
			<TerrainBoolean>
				<TerrainType>TERRAIN_GRASS</TerrainType>
				<bTerrain>1</bTerrain>
			</TerrainBoolean>
			<TerrainBoolean>
				<TerrainType>TERRAIN_PLAINS</TerrainType>
				<bTerrain>1</bTerrain>
			</TerrainBoolean>
		</TerrainBooleans>
		<FeatureBooleans>
			<FeatureBoolean>
				<FeatureType>FEATURE_OASIS</FeatureType>
				<bFeature>1</bFeature>
			</FeatureBoolean>
		</FeatureBooleans>
		<FeatureTerrainBooleans>
			<FeatureTerrainBoolean>
				<TerrainType>TERRAIN_DESERT</TerrainType>
				<bFeatureTerrain>1</bFeatureTerrain>
			</FeatureTerrainBoolean>
		</FeatureTerrainBooleans>
	</BonusInfo>

In CIV4ImprovementInfos.XML you will need to add coconut to the bonuses that make the improvement valid.

A code fragment
Code:
			<BonusTypeStructs>
				<BonusTypeStruct>
					<BonusType>BONUS_COCONUT</BonusType>
					<bBonusMakesValid>1</bBonusMakesValid>
					<bBonusTrade>1</bBonusTrade>
					<YieldChanges>
						<iYieldChange>1</iYieldChange>
					</YieldChanges>
				</BonusTypeStruct>

You will then need to define text entries for TXT_KEY_BONUS_COCONUT and TXT_KEY_BONUS_COCONUT_PEDIA.
 
I did the steps but it was hard and the mod didn't work
 
I did the steps but it was hard and the mod didn't work

"Everything is difficult, until it isn't." - basically starting anything worthwhile is always difficult;).

How far did you get? Did you do all the steps in part 1 and then test that it did not break anything? Or did you try and do it all at once? Step 1 needs to be done first. The rest can be done in different ways that you may find easier.

Are you creating your own mod or building on another? If another, which one? Some mods have different (better?) ways of adding content such as resources.
 
"Everything is difficult, until it isn't." - basically starting anything worthwhile is always difficult;).

How far did you get? Did you do all the steps in part 1 and then test that it did not break anything? Or did you try and do it all at once? Step 1 needs to be done first. The rest can be done in different ways that you may find easier.

Are you creating your own mod or building on another? If another, which one? Some mods have different (better?) ways of adding content such as resources.

I was having trouble adding vault 101 as a building in the game
 
Back
Top Bottom