Alternative building unlock

Snappy-T-Joe

Chieftain
Joined
Apr 27, 2021
Messages
1
Hi all, I have a question.

I would like to amend the condition below for making a polder available to be built when adjacent to 2 coastal tiles and one polder improvement.

Currently, the following only makes it so that the polder can be built when adjacent to 3 coastal tiles.

<Improvements>

<Update>

<Where Type="IMPROVEMENT_POLDER" /> <Set Water="true" AllowsWalkWater="true" RequiresXAdjacentLand="3" RequiresFeature="false" />

</Update>

</Improvements>

Could you guys tell me how to make it so that in addition to the 3 coastal adjacency, the 2 coastal and one polder improvement adjacency also unlocks constructing the polder?
 
Either mod the DLL (not recommended) or use the DLL from whoward or Community Patch and use the lua event "PlayerCanBuild" (or PlotCanImprove if the player does not matter, only the plot)

example lua code from my modpack v19 from mod "Improvement Upgrades v1":
Code:
-- only can build improvement when requirements are fullfilled
function OnPlayerCanBuild(iPlayer, iUnit, iX, iY, iBuild)
  if (iBuild == GameInfoTypes.BUILD_SUBURB) then -- suburb  , check all adjacent tiles, if there is a city of the player
    local pPlot = Map.GetPlot(iX, iY)
    for pEdgePlot in PlotRingIterator(pPlot, 1) do -- when radius is 1 it does not matter if we use the ring or the area function
      if (pEdgePlot:IsCity() and pEdgePlot:GetOwner()==iPlayer) then
        return true
      end
    end
   return false -- if no city adjacent, return false
  end
  return true -- if no suburb, return true
end
GameEvents.PlayerCanBuild.Add(OnPlayerCanBuild)

Or see whowards Pontoon Bridge mod:
http://www.picknmixmods.com/mods/CivV/Improvement/Pontoon Bridge.html
 
Last edited:
Top Bottom