Keeping Culture off Water

gargoyle575

Chieftain
Joined
Jan 20, 2012
Messages
94
All I want to do is remove culture from water tiles and keep it off. Does anybody have any idea on how to do this? I'm just starting Lua and I hardly understand it.
 
I use this in R.E.D. WWII:

Code:
function CheckCultureChange(iHexX, iHexY, iPlayerID, bUnknown)
	if (iPlayerID ~= -1) then
		local x, y = ToGridFromHex( iHexX, iHexY )
		local plot = Map.GetPlot(x,y)
		if ( plot:IsWater() ) then
			plot:SetOwner(-1, -1)
		end		
	end
end
Events.SerialEventHexCultureChanged.Add(CheckCultureChange)

If you're completely new to modding in civ5, you may want to have a look at Kael's guide and Whoward's tutorial for details on how to set up your mod and files property.

If you want to be able to use water resources in your mod, you'll have to code something very specific.
 
OK thanks. I actually tried using the code from RED WWII but it didn't work, I think I forgot the very last line.
 
@Gedemon,

With your code above, won't the city keep trying to expand borders to the same water tile? Or does the city somehow remember that it expanded to this plot and not to expand to it again? If the latter, you still loose out on that particular border expansion, don't you?
 
yes, but I've assumed from the OP question that it was for a scenario map ("remove") where the engine will grab all tiles around a city when loading the map (even if you've not set culture there in WB) or when you capture a city near water.

For a normal mod, if you'd want the city to not spend culture points on water, you may want to raise to something unreasonable the value of PLOT_INFLUENCE_WATER_COST in defines or <InfluenceCost> in Terrains table for TERRAIN_COAST and TERRAIN_OCEAN.
 
Back
Top Bottom