Great Wall - Change Request

Pir Lan Tota

Warlord
Joined
Jan 28, 2008
Messages
276
Location
Manchester
Good morning,

so I changed a few things in Civ4 that I didnt like, but one thing I cant figure out is to do the following. (I play without barbarians, so great wall is largely pointless)

I want to make the great wall more useful, so was wondering if I can give it the trait that each Wall you own produces +2 Commerce

Justification: Great Wall had only few gates and anyone passing through needed to pay toll. Same can be applied on smaller scale to city walls.

Is this possible?
 
It looks to me like a complication when you could just add (with XML only) some Commerce or Trade Route benefits to the Great Wall.

Alternatively, your Great Wall could be a pre-requisite to build some new 'Trade Gates' in your empire. Like this:
Code:
			<PrereqBuildingClasses>
				<PrereqBuildingClass>
					<BuildingClassType>BUILDINGCLASS_GREAT_WALL</BuildingClassType>
					<iNumBuildingNeeded>1</iNumBuildingNeeded>
				</PrereqBuildingClass>
			</PrereqBuildingClasses>

However, this would apply to an intercontinental empire despite your justification of 'Trade Gates' within the Great Wall.

It should also be possible to code it in Python as you want it, but it would be a bit heavy to check every turn if you have a Great Wall, check the commerce output of your walls, etc.
 
You could add an event to the game that has a 100% chance to fire when a civilization builds the Great Wall and grants Walls commerce income. I've not coded any events, but given that some give Walls gold income, and the Horse Whisperer quest gives Stables food, this should be possible.
 
Those are some good ideas, thanks guys.

Yea dont want to slow down game progress to much, so will probably try the event method. Thanks!:)
 
Yes, this might be a good idea. :goodjob:

As suggested, I would start with the EVENT_HORSE_WHISPERING_DONE_3 and change the <BuildingExtraYields> benefit to the <BuildingExtraCommerces> + other adaptations (no need to clear events).

In the TriggerInfos, set the <BuildingsRequired>. The <iPercentGamesActive> should be set at 100 and the <iWeight> should be set at -1 to have it fired automatically.

No need for Python here.
 
This trick was used extensively in my coding experience with Europa Universalis 3. There was no channel to give a player gold for conquering a province, as an example, so events had to be coded. It got quite complicated just to effect simple things.

Here is the event Miracle at the Walls (1st choice, +1 :gold: for Walls) from Civilization 4/Beyond The Sword/Assets/XML/Events/CIV4EventInfos.xml

Spoiler :

Code:
		<EventInfo>
			<Type>EVENT_MIRACLE_1</Type>
			<Description>TXT_KEY_EVENT_MIRACLE_1</Description>
			<LocalInfoText/>
			<WorldNewsTexts/>
			<OtherPlayerPopup/>
			<QuestFailText/>
			<bQuest>0</bQuest>
			<bGlobal>0</bGlobal>
			<bTeam>0</bTeam>
			<bPickCity>1</bPickCity>
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
			<bDeclareWar>0</bDeclareWar>
			<iGold>0</iGold>
			<bGoldToPlayer>0</bGoldToPlayer>
			<iRandomGold>0</iRandomGold>
			<iCulture>0</iCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<bGoldenAge>0</bGoldenAge>
			<iFreeUnitSupport>0</iFreeUnitSupport>
			<iInflationMod>0</iInflationMod>
			<iSpaceProductionMod>0</iSpaceProductionMod>
			<Tech>NONE</Tech>
			<TechFlavors/>
			<iTechPercent>0</iTechPercent>
			<iTechCostPercent>0</iTechCostPercent>
			<iTechMinTurnsLeft>0</iTechMinTurnsLeft>
			<PrereqTech>NONE</PrereqTech>
			<UnitClass>NONE</UnitClass>
			<iNumFreeUnits>0</iNumFreeUnits>
			<bDisbandUnit>0</bDisbandUnit>
			<iUnitExperience>0</iUnitExperience>
			<iUnitImmobileTurns>0</iUnitImmobileTurns>
			<UnitPromotion/>
			<UnitName/>
			<UnitCombatPromotions/>
			<UnitClassPromotions/>
			<BuildingClass>NONE</BuildingClass>
			<iBuildingChange>0</iBuildingChange>
			<BuildingExtraYields/>
			<BuildingExtraCommerces>
				<BuildingExtraCommerce>
					<BuildingClass>BUILDINGCLASS_WALLS</BuildingClass>
					<CommerceType>COMMERCE_GOLD</CommerceType>
					<iExtraCommerce>1</iExtraCommerce>
				</BuildingExtraCommerce>
			</BuildingExtraCommerces>
			<BuildingExtraHappies/>
			<BuildingExtraHealths/>
			<iHappy>0</iHappy>
			<iHealth>0</iHealth>
			<iHurryAnger>0</iHurryAnger>
			<iHappyTurns>0</iHappyTurns>
			<iRevoltTurns>0</iRevoltTurns>
			<iMinPillage>0</iMinPillage>
			<iMaxPillage>0</iMaxPillage>
			<iFood>0</iFood>
			<iFoodPercent>0</iFoodPercent>
			<FreeSpecialistCounts/>
			<FeatureType>NONE</FeatureType>
			<iFeatureChange>0</iFeatureChange>
			<ImprovementType>NONE</ImprovementType>
			<iImprovementChange>0</iImprovementChange>
			<BonusType>NONE</BonusType>
			<iBonusChange>0</iBonusChange>
			<RouteType>NONE</RouteType>
			<iRouteChange>0</iRouteChange>
			<BonusRevealed>NONE</BonusRevealed>
			<BonusGift>NONE</BonusGift>
			<PlotExtraYields/>
			<iConvertOwnCities>0</iConvertOwnCities>
			<iConvertOtherCities>0</iConvertOtherCities>
			<iMaxNumReligions>-1</iMaxNumReligions>
			<iOurAttitudeModifier>0</iOurAttitudeModifier>
			<iAttitudeModifier>0</iAttitudeModifier>
			<iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier>
			<iPopulationChange>0</iPopulationChange>
			<AdditionalEvents/>
			<EventTimes/>
			<ClearEvents/>
			<PythonCallback/>
			<PythonExpireCheck/>
			<PythonCanDo/>
			<PythonHelp/>
			<Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button>
			<iAIValue>1000</iAIValue>
		</EventInfo>


Notice how it gives you <BuildingExtraCommerce> in the text key of COMMERCE_GOLD. This isn't what you want, since you don't want ExtraCommerce, because that's only what coin can be converted into. You want extra yields, which would be raw coin.

The section immediately before <BuildingExtraCommerce> is <BuildingExtraYields>. Yields is the term for food, hammers, and commerce. The Warships quest option #2 gives a raw commerce boost to Harbors in the form of:

Code:
			<BuildingExtraYields>
				<BuildingExtraYield>
					<BuildingClass>BUILDINGCLASS_HARBOR</BuildingClass>
					<YieldType>YIELD_COMMERCE</YieldType>
					<iExtraYield>2</iExtraYield>
				</BuildingExtraYield>
			</BuildingExtraYields>

so we need to add the yield of YIELD_COMMERCE to BUILDINGCLASS_WALLS with some kind of event that fires for all BUILDINGCLASS_WALLS.

If you go back to the Miracle at the Wall, you notice two flags called <bQuest> and <bGlobal>. If the flag <bQuest> is boolean 1, then the event pops up as the first part of a quest (You must construct 7 Triremes). If boolean 0, then it's merely a regular event. The flag <bGlobal>, if set to boolean 1, makes the change apply to everything forever and always. Thus, if you select the second option for the Warships quest, all BUILDINGCLASS_HARBOR will have 2 YIELD_COMMERCE whether already built or built in the future.

We also need to set <bPickCity> to boolean 0, so that it applies to all cities.

So I would code an event based on Miracle at the Walls. Added or changed content is Green, removed content is Red.
Spoiler :

Code:
		<EventInfo>
			[B][COLOR="Green"]<Type>EVENT_GREAT_WALL</Type>
			<Description>TXT_KEY_EVENT_GREAT_WALL</Description>[/COLOR][/B]
			<LocalInfoText/>
			<WorldNewsTexts/>
			<OtherPlayerPopup/>
			<QuestFailText/>
			<bQuest>0</bQuest>
			[B][COLOR="Green"]<bGlobal>1</bGlobal>[/COLOR][/B]
			<bTeam>0</bTeam>
			[B][COLOR="Green"]<bPickCity>0</bPickCity>[/COLOR][/B]
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
			<bDeclareWar>0</bDeclareWar>
			<iGold>0</iGold>
			<bGoldToPlayer>0</bGoldToPlayer>
			<iRandomGold>0</iRandomGold>
			<iCulture>0</iCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<bGoldenAge>0</bGoldenAge>
			<iFreeUnitSupport>0</iFreeUnitSupport>
			<iInflationMod>0</iInflationMod>
			<iSpaceProductionMod>0</iSpaceProductionMod>
			<Tech>NONE</Tech>
			<TechFlavors/>
			<iTechPercent>0</iTechPercent>
			<iTechCostPercent>0</iTechCostPercent>
			<iTechMinTurnsLeft>0</iTechMinTurnsLeft>
			<PrereqTech>NONE</PrereqTech>
			<UnitClass>NONE</UnitClass>
			<iNumFreeUnits>0</iNumFreeUnits>
			<bDisbandUnit>0</bDisbandUnit>
			<iUnitExperience>0</iUnitExperience>
			<iUnitImmobileTurns>0</iUnitImmobileTurns>
			<UnitPromotion/>
			<UnitName/>
			<UnitCombatPromotions/>
			<UnitClassPromotions/>
			<BuildingClass>NONE</BuildingClass>
			<iBuildingChange>0</iBuildingChange>
			[b][COLOR="Green"]<BuildingExtraYields>
				<BuildingExtraYield>
					<BuildingClass>BUILDINGCLASS_WALLS</BuildingClass>
					<YieldType>YIELD_COMMERCE</YieldType>
					<iExtraYield>2</iExtraYield>
				</BuildingExtraYield>
			</BuildingExtraYields>[/COLOR][/b]
			[b][COLOR="Red"]<BuildingExtraCommerces/>[/COLOR][/b]
			<BuildingExtraHappies/>
			<BuildingExtraHealths/>
			<iHappy>0</iHappy>
			<iHealth>0</iHealth>
			<iHurryAnger>0</iHurryAnger>
			<iHappyTurns>0</iHappyTurns>
			<iRevoltTurns>0</iRevoltTurns>
			<iMinPillage>0</iMinPillage>
			<iMaxPillage>0</iMaxPillage>
			<iFood>0</iFood>
			<iFoodPercent>0</iFoodPercent>
			<FreeSpecialistCounts/>
			<FeatureType>NONE</FeatureType>
			<iFeatureChange>0</iFeatureChange>
			<ImprovementType>NONE</ImprovementType>
			<iImprovementChange>0</iImprovementChange>
			<BonusType>NONE</BonusType>
			<iBonusChange>0</iBonusChange>
			<RouteType>NONE</RouteType>
			<iRouteChange>0</iRouteChange>
			<BonusRevealed>NONE</BonusRevealed>
			<BonusGift>NONE</BonusGift>
			<PlotExtraYields/>
			<iConvertOwnCities>0</iConvertOwnCities>
			<iConvertOtherCities>0</iConvertOtherCities>
			<iMaxNumReligions>-1</iMaxNumReligions>
			<iOurAttitudeModifier>0</iOurAttitudeModifier>
			<iAttitudeModifier>0</iAttitudeModifier>
			<iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier>
			<iPopulationChange>0</iPopulationChange>
			<AdditionalEvents/>
			<EventTimes/>
			<ClearEvents/>
			<PythonCallback/>
			<PythonExpireCheck/>
			<PythonCanDo/>
			<PythonHelp/>
			<Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button>
			<iAIValue>1000</iAIValue>
		</EventInfo>

You'll notice I changed the TXT_KEYs to create new ones... this isn't strictly necessary, but you can add some text in the files Civilization 4/Beyond The Sword/Assets/XML/Text/CIV4GameText_Events_BTS.xml, copying the syntax for a similar event and matching the TXT_KEYs used here.

This is all well and good, but now we are missing something to trigger the event. Here's the relevant lines from Miracle at the Walls inside of CIV4EventTriggersInfos.xml:

Spoiler :
Code:
		<EventTriggerInfo>
			<Type>EVENTTRIGGER_MIRACLE</Type>
			<WorldNewsTexts>
				<Text>TXT_KEY_EVENTTRIGGER_MIRACLE</Text>
			</WorldNewsTexts>
			<TriggerTexts>
				<TriggerText>
					<Text>TXT_KEY_EVENT_TRIGGER_MIRACLE_1</Text>
					<Era>NONE</Era>
				</TriggerText>
			</TriggerTexts>
			<bSinglePlayer>0</bSinglePlayer>
			<iPercentGamesActive>90</iPercentGamesActive>
			<iWeight>200</iWeight>
			<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
			<bProbabilityBuildingMultiply>0</bProbabilityBuildingMultiply>
			<Civic>NONE</Civic>
			<iMinTreasury>0</iMinTreasury>
			<iMinPopulation>0</iMinPopulation>
			<iMaxPopulation>0</iMaxPopulation>
			<iMinMapLandmass>0</iMinMapLandmass>
			<iMinOurLandmass>0</iMinOurLandmass>
			<iMaxOurLandmass>-1</iMaxOurLandmass>
			<MinDifficulty>NONE</MinDifficulty>
			<iAngry>0</iAngry>
			<iUnhealthy>0</iUnhealthy>
			<UnitsRequired/>
			<iNumUnits>0</iNumUnits>
			<iNumUnitsGlobal>0</iNumUnitsGlobal>
			<iUnitDamagedWeight>0</iUnitDamagedWeight>
			<iUnitDistanceWeight>0</iUnitDistanceWeight>
			<iUnitExperienceWeight>0</iUnitExperienceWeight>
			<bUnitsOnPlot>0</bUnitsOnPlot>
			<BuildingsRequired>
				<BuildingClass>BUILDINGCLASS_WALLS</BuildingClass>
			</BuildingsRequired>
			<iNumBuildings>1</iNumBuildings>
			<iNumBuildingsGlobal>0</iNumBuildingsGlobal>
			<iNumPlotsRequired>0</iNumPlotsRequired>
			<bOwnPlot>0</bOwnPlot>
			<iPlotType>-1</iPlotType>
			<FeaturesRequired/>
			<TerrainsRequired/>
			<ImprovementsRequired/>
			<BonusesRequired/>
			<RoutesRequired/>
			<ReligionsRequired/>
			<iNumReligions>0</iNumReligions>
			<CorporationsRequired/>
			<iNumCorporations>0</iNumCorporations>
			<bPickReligion>1</bPickReligion>
			<bStateReligion>1</bStateReligion>
			<bHolyCity>0</bHolyCity>
			<bPickCorporation>0</bPickCorporation>
			<bHeadquarters>0</bHeadquarters>
			<Events>
				<Event>EVENT_MIRACLE_1</Event>
				<Event>EVENT_MIRACLE_2</Event>
			</Events>
			<PrereqEvents/>
			<bPrereqEventPlot>0</bPrereqEventPlot>
			<OrPreReqs/>
			<AndPreReqs/>
			<ObsoleteTechs>
				<ObsoleteTech>TECH_RIFLING</ObsoleteTech>
			</ObsoleteTechs>
			<bRecurring>0</bRecurring>
			<bTeam>0</bTeam>
			<bGlobal>0</bGlobal>
			<bPickPlayer>0</bPickPlayer>
			<bOtherPlayerWar>0</bOtherPlayerWar>
			<bOtherPlayerHasReligion>0</bOtherPlayerHasReligion>
			<bOtherPlayerHasOtherReligion>0</bOtherPlayerHasOtherReligion>
			<bOtherPlayerAI>0</bOtherPlayerAI>
			<iOtherPlayerShareBorders>0</iOtherPlayerShareBorders>
			<OtherPlayerHasTech>NONE</OtherPlayerHasTech>
			<bPickCity>1</bPickCity>
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
			<bShowPlot>1</bShowPlot>
			<iCityFoodWeight>0</iCityFoodWeight>
			<PythonCanDo/>
			<PythonCanDoCity/>
			<PythonCanDoUnit/>
			<PythonCallback/>
		</EventTriggerInfo>

As isenchine pointed out, we need to set <iPercentGamesActive> to value 100, and <iWeight> to value -1. Additionally, we need to rewrite this event so that it is global and requires the Great Wall wonder instead of merely Walls. So, again, <bPickCity> should be set to boolean 0, as should <bShowPlot> (moves view to event), because there isn't a city to pick.

The second thing we can do - or not do - is remove the technology of Rifling from the obsolete section. You may want to keep it in.

The <Events> section needs to be modified to reflect the tag of our event, EVENT_GREAT_WALL.

<bPickReligion> and <bStateReligion> need to both be set to boolean 0, as Miracle at the Walls is dependent on your religion, but the Great Wall event should not be.

The last thing we need to do is change the scope of <BuildingsRequired> to the Great Wall. The proper TXT_KEY is BUILDINGCLASS_GREAT_WALL, found in Assets/XML/Buildings/CIV4BuildingClassInfos.xml. Additionally, we need to change the <iNumBuildingsRequired> to value 0, and <iNumBuildingsRequiredGlobal> to value 1. This makes the scope not care where the building is, merely that it is. That section of code should be modified to read:

Code:
			<BuildingsRequired>
				<BuildingClass>BUILDINGCLASS_GREAT_WALL</BuildingClass>
			</BuildingsRequired>
			<iNumBuildings>0</iNumBuildings>
			<iNumBuildingsGlobal>1</iNumBuildingsGlobal>

Thus, the final event should read like this:

Spoiler :
Code:
		<EventTriggerInfo>
			[B][COLOR="Green"]<Type>EVENTTRIGGER_GREAT_WALL</Type>[/COLOR][/B]
			<WorldNewsTexts>
[B][COLOR="Green"]				<Text>TXT_KEY_EVENTTRIGGER_GREAT_WALL</Text>[/COLOR][/B]
			</WorldNewsTexts>
			<TriggerTexts>
				<TriggerText>
[COLOR="Green"][B]					<Text>TXT_KEY_EVENT_TRIGGER_GREAT_WALL</Text>[/B][/COLOR]
					<Era>NONE</Era>
				</TriggerText>
			</TriggerTexts>
			<bSinglePlayer>0</bSinglePlayer>
[B][COLOR="Green"]			<iPercentGamesActive>100</iPercentGamesActive>
			<iWeight>-1</iWeight>[/COLOR][/B]
			<bProbabilityUnitMultiply>0</bProbabilityUnitMultiply>
			<bProbabilityBuildingMultiply>0</bProbabilityBuildingMultiply>
			<Civic>NONE</Civic>
			<iMinTreasury>0</iMinTreasury>
			<iMinPopulation>0</iMinPopulation>
			<iMaxPopulation>0</iMaxPopulation>
			<iMinMapLandmass>0</iMinMapLandmass>
			<iMinOurLandmass>0</iMinOurLandmass>
			<iMaxOurLandmass>-1</iMaxOurLandmass>
			<MinDifficulty>NONE</MinDifficulty>
			<iAngry>0</iAngry>
			<iUnhealthy>0</iUnhealthy>
			<UnitsRequired/>
			<iNumUnits>0</iNumUnits>
			<iNumUnitsGlobal>0</iNumUnitsGlobal>
			<iUnitDamagedWeight>0</iUnitDamagedWeight>
			<iUnitDistanceWeight>0</iUnitDistanceWeight>
			<iUnitExperienceWeight>0</iUnitExperienceWeight>
			<bUnitsOnPlot>0</bUnitsOnPlot>
[COLOR="Green"][B]			<BuildingsRequired>
				<BuildingClass>BUILDINGCLASS_GREAT_WALL</BuildingClass>
			</BuildingsRequired>
			<iNumBuildings>0</iNumBuildings>
			<iNumBuildingsGlobal>1</iNumBuildingsGlobal>[/B][/COLOR]
			<iNumPlotsRequired>0</iNumPlotsRequired>
			<bOwnPlot>0</bOwnPlot>
			<iPlotType>-1</iPlotType>
			<FeaturesRequired/>
			<TerrainsRequired/>
			<ImprovementsRequired/>
			<BonusesRequired/>
			<RoutesRequired/>
			<ReligionsRequired/>
			<iNumReligions>0</iNumReligions>
			<CorporationsRequired/>
			<iNumCorporations>0</iNumCorporations>
[B][COLOR="Green"]			<bPickReligion>0</bPickReligion>
			<bStateReligion>0</bStateReligion>[/COLOR][/B]
			<bHolyCity>0</bHolyCity>
			<bPickCorporation>0</bPickCorporation>
			<bHeadquarters>0</bHeadquarters>
[B][COLOR="Green"]			<Events>
				<Event>EVENT_GREAT_WALL</Event>
			</Events>[/COLOR][/B]
			<PrereqEvents/>
			<bPrereqEventPlot>0</bPrereqEventPlot>
			<OrPreReqs/>
			<AndPreReqs/>
			<ObsoleteTechs>
				<ObsoleteTech>TECH_RIFLING</ObsoleteTech>
			</ObsoleteTechs>
			<bRecurring>0</bRecurring>
			<bTeam>0</bTeam>
			<bGlobal>0</bGlobal>
			<bPickPlayer>0</bPickPlayer>
			<bOtherPlayerWar>0</bOtherPlayerWar>
			<bOtherPlayerHasReligion>0</bOtherPlayerHasReligion>
			<bOtherPlayerHasOtherReligion>0</bOtherPlayerHasOtherReligion>
			<bOtherPlayerAI>0</bOtherPlayerAI>
			<iOtherPlayerShareBorders>0</iOtherPlayerShareBorders>
			<OtherPlayerHasTech>NONE</OtherPlayerHasTech>
[B][COLOR="Green"]			<bPickCity>0</bPickCity>[/COLOR][/B]
			<bPickOtherPlayerCity>0</bPickOtherPlayerCity>
[B][COLOR="Green"]			<bShowPlot>0</bShowPlot>[/COLOR][/B]
			<iCityFoodWeight>0</iCityFoodWeight>
			<PythonCanDo/>
			<PythonCanDoCity/>
			<PythonCanDoUnit/>
			<PythonCallback/>
		</EventTriggerInfo>

That should be it. The TXT_KEY entries can be made in Assets/XML/Text/CIV4GameText_Events_BTS.xml if you want them to be. Otherwise, you'll get TXT_KEY_EVENT_GREAT_WALL showing.

I've never coded an event for Civilization IV, so I don't know if this will work correctly.
 
Back
Top Bottom