Looking for a way to add a belief improving Lake tiles

Galgus

Emperor
Joined
Aug 22, 2012
Messages
1,705
Lakes appear to be a fake feature, since simply inputting something like the code below seems to have no affect on them while changing other features.

Code:
<Belief_FeatureYieldChanges>

		<Row>
			<BeliefType>BELIEF_LAKE_LEGEND</BeliefType>
			<FeatureType>FEATURE_LAKE</FeatureType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>2</Yield>
		</Row>
		
		<Row>
			<BeliefType>BELIEF_LAKE_LEGEND</BeliefType>
			<FeatureType>FEATURE_LAKE</FeatureType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>2</Yield>
		</Row>
		

	</Belief_FeatureYieldChanges>

I've tried to modify code from the Workable Mountains mod by replacing "mountain" with "lake", but that seems to simply crash the game on load.

I don't really understand the code behind that mod beyond it creating a tile under mountains.
____________________

If anyone knows a way to let a belief affect lake tiles, I'd welcome the insight.

Is it possible to make a belief add a free building and make that building reliant on the belief?
 
Lake is not a feature (it's a "fake feature", which is used for civilopedia purposes only, and not actually placed on the map). The only way I can think of to make this belief work without DLL changes is to create a dummy building that adds bonus yields from lakes, and use Lua to check all cities every turn, and add or remove the building depending if the religion with that belief is in the city or not.
 
Have you made changes to the Lua script too? The workable mountains mod uses this Lua script in conjunction with the XML.

directions = {DirectionTypes.DIRECTION_NORTHEAST, DirectionTypes.DIRECTION_EAST, DirectionTypes.DIRECTION_SOUTHEAST,
DirectionTypes.DIRECTION_SOUTHWEST, DirectionTypes.DIRECTION_WEST, DirectionTypes.DIRECTION_NORTHWEST}

Events.SequenceGameInitComplete.Add(function()
for i = 0, Map:GetNumPlots() - 1, 1 do
local fPlot = Map.GetPlotByIndex( i );
if fPlot:IsMountain() then
if fPlot:GetFeatureType() == -1 then
fPlot:SetFeatureType(GameInfoTypes.FEATURE_MOUNTAIN_YIELD,-1);
end
end
end
end)

Completely untested theory, but I would guess that changing:

"if fPlot:IsMountain() then" to "if fPlot:IsLake() then"

and

"GameInfoTypes.FEATURE_MOUNTAIN_YIELD" to "GameInfoTypes.FEATURE_LAKE"

then it MIGHT work with your xml code. I'm not sure if it will, but it could be worth a shot? A more experienced modder than myself would have a better idea than I do.
 
Don't use FEATRE_LAKE, it's a fake feature! Create your own feature and use it with a modified version of the Workable Mountains mod (with the change from IsMountain to IsLake as ChimpanG suggested), then it might work.
 
How does one create a new feature?

I'm guessing that not doing that is why the Mountain -> Lake modification ended in a crash.
 
The same way as FEATURE_MOUNTAIN_YIELD is created in Workable Mountains - see the WorkableMountains.xml file.
 
Top Bottom