Terraforming

Skeeve

Chieftain
Joined
Mar 12, 2004
Messages
30
Just wondering if anyone knows how I might change the worker unit to be able to alter terrain. (Possibly after achieving a new future tech called Terraforming)

Something like this:
Tundra --> Plains
Plains --> Grassland
Perhaps even to level Mountains to Hills or something.

I'm pretty sure this will involve more than just editing the XML files.
 
First add the following to the "CIV4BuildInfos.xml"

Code:
		<BuildInfo>
			<Type>BUILD_TERRAFORM</Type>
			<Description>TXT_KEY_BUILD_TERRAFORM</Description>
			<Help/>
			<PrereqTech>NONE</PrereqTech>
			<iTime>1000</iTime>
			<bKill>0</bKill>
			<ImprovementType>IMPROVEMENT_TERRAFORM</ImprovementType>
			[B]<TerrainType>NONE</TerrainType>   This line is wrong remove it!!!!![/B]
			<RouteType>NONE</RouteType>
			<EntityEvent>ENTEVENT_IRRIGATE</EntityEvent>
			<FeatureStructs/>
			<HotKey>0</HotKey>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<Button>,Art/Interface/Buttons/Builds/grassland,Art/Interface/Buttons/baseterrain_terrainfeatures_atlas.dds,3,1</Button>
		</BuildInfo>

Then this to "CIV4ImprovementInfos.xml"

Code:
		<ImprovementInfo>
			<Type>IMPROVEMENT_TERRAFORM</Type>
			<Description>TXT_KEY_IMPROVEMENT_TERRAFORM</Description>
			<Civilopedia>TXT_KEY_IMPROVEMENT_TERRAFORM_PEDIA</Civilopedia>
			<ArtDefineTag>ART_DEF_TERRAIN_GRASS</ArtDefineTag>
			<YieldChanges/>
			<bHillsMakesValid>0</bHillsMakesValid>
			<bFreshWaterMakesValid>0</bFreshWaterMakesValid>
			<bRiverSideMakesValid>0</bRiverSideMakesValid>
			<bNoFreshWater>0</bNoFreshWater>
			<bRequiresFlatlands>1</bRequiresFlatlands>
			<bRequiresRiverSide>0</bRequiresRiverSide>
			<bRequiresIrrigation>1</bRequiresIrrigation>
			<bCarriesIrrigation>0</bCarriesIrrigation>
			<bRequiresFeature>0</bRequiresFeature>
			<bWater>0</bWater>
			<bGoody>0</bGoody>
			<bPermanent>0</bPermanent>
			<bUseLSystem>1</bUseLSystem>
			<iTilesPerGoody>0</iTilesPerGoody>
			<iGoodyRange>0</iGoodyRange>
			<iUpgradeTime>0</iUpgradeTime>
			<iAirBombDefense>0</iAirBombDefense>
			<iDefenseModifier>0</iDefenseModifier>
			<iPillageGold>0</iPillageGold>
			<TerrainMakesValids>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_PLAINS</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_TUNDRA</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_SNOW</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
				<TerrainMakesValid>
					<TerrainType>TERRAIN_DESERT</TerrainType>
					<bMakesValid>1</bMakesValid>
				</TerrainMakesValid>
			</TerrainMakesValids>
			<FeatureMakesValids/>
			<ImprovementPillage/>
			<ImprovementUpgrade/>
			<TechYieldChanges/>
			<RouteYieldChanges/>
			<bGraphicalOnly>0</bGraphicalOnly>
		</ImprovementInfo>

and this to the <Builds> Tag in <UnitInfo> of the worker "CIV4UnitInfos.xml"

Code:
<Build>
	<BuildType>BUILD_TERRAFORM</BuildType>
	<bBuild>1</bBuild>
</Build>

and finally open the "CvEventManager.py" and jump to the "def onImprovementBuilt(self, argsList):" part and change this

Code:
def onImprovementBuilt(self, argsList):
		'Improvement Built'
		iImprovement, iX, iY = argsList
		if (not self.__LOG_IMPROVEMENT):
			return
		CvUtil.pyPrint('Improvement %s was built at %d, %d'
			%(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))

so it looks like that:

Code:
def onImprovementBuilt(self, argsList):
		'Improvement Built'
		iImprovement, iX, iY = argsList
		pPlot = CyMap().plot(iX,iY)
		if(iImprovement == gc.getInfoTypeForString('IMPROVEMENT_TERRAFORM')):
			CyInterface().addMessage(CyGame().getActivePlayer(),True,25,'Terraformed','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/general/happy_person.dds',ColorTypes(8),iX,iY,False,False)
			nase = pPlot.getTerrainType()
			pPlot.setTerrainType(nase-1, 1, 1)
			pPlot.setImprovementType(-1)
                if (not self.__LOG_IMPROVEMENT):
			return
		CvUtil.pyPrint('Improvement %s was built at %d, %d'
			%(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))

now workers will be able to terraform flat lands up to grassland.
the order is snow->tundra->desert->plains->grassland
You should add a <PrereqTech>, or it will always be available.
Also you can tweak things, like not beeing able to terraform snow or something...
And of course there should me the links to the descrition und civilopedia texts...
 
Wow - Thanks for the detailed reply!

It will be easier than I thought to do - although a bit complex for my understanding. But that's what I thought about Civ3 until I got used to it.

Thanks again
 
i just edited my post in the first xml file there is a line that should not be there; i marked it....
 
Just wanted to know if anyone has gotten this mod to work. I am really stuck on how to make the workers change the terrain. Any help??

Chaotic Law

Trying to organize the chaos.
 
responsing to this and the threat above (before this post :-D ), i will try to anser when sober again.
perhaps somebody will dio that before me, if not i'll try.

a short notuice:
1. the xml files define the improvements which are interceptet by the phyton part.
2. the python part defines what to do with that event.
3. ther e is some info of tghe python things used in http://civilization4.net/files/modding/PythonAPI/ lower-left "terrain types" (all that stuff was done by someone who is better than me)
4. forgot
 
I just need to know what I need to do ingame to make the workers change the terrain. I think you might be my only hope. Please read this and respond. Thanks again. Keeping my fingers crossed.

Chatic Law

Trying to organize the chaos.
 
There is no new button that I can see. Has anyone tried this mod and gotten it to work? Anyone?? Anyone check the code to see if its correct?

Chaotic Law

Trying to organize the chaos.
 
Chaotic Law said:
There is no new button that I can see. Has anyone tried this mod and gotten it to work? Anyone?? Anyone check the code to see if its correct?

Chaotic Law

Trying to organize the chaos.

Hi,
I should have tried it by now, but I've been too busy actually playing games instead of modding. I always loved the CIV2 ability for engineers to change the terrain, so I'll give it a shot soon and let you know if I get it to work.

By the way - I don't thing the instructions above tell us how to create a Terraform Button. This might require a little art work in the .dds files and then properly displaying it when the tech becomes available. Just to test it out, however, we can just make a generic button and fine-tune it later.

In the meantime - if anyone else gets Terraforming to work - post it!
 
Skeeve said:
Hi,
I should have tried it by now, but I've been too busy actually playing games instead of modding. I always loved the CIV2 ability for engineers to change the terrain, so I'll give it a shot soon and let you know if I get it to work.

By the way - I don't thing the instructions above tell us how to create a Terraform Button. This might require a little art work in the .dds files and then properly displaying it when the tech becomes available. Just to test it out, however, we can just make a generic button and fine-tune it later.

In the meantime - if anyone else gets Terraforming to work - post it!

I have druid units that upgrade the terrain, elven units that grow forests and a wonder that upgrades all of the terrain in your emprie in my mod. Feel free to check it out.
 
Kael said:
I have druid units that upgrade the terrain, elven units that grow forests and a wonder that upgrades all of the terrain in your emprie in my mod. Feel free to check it out.

I certainly will! Thanks very much.
Intriquing wonder that upgrades terrain... sounds like it could be potentially unbalancing - but wow. :cool:
 
Back
Top Bottom