Natural Wonder Check

Horem

Emperor
Joined
Apr 1, 2010
Messages
1,721
Location
Wales, UK
Is it possible to check plots on the map for natural wonders(After AssignStartingPlots.lua has fired and completed) within lua? If so what function/variabl would I need to use? I tried adding a call to an existing bit of code but it just returned a error.
Code:
if pPlot:GetResourceType(-1) == -1 and not pPlot:IsImpassable() [COLOR="red"]and not  pPlot:IsNaturalWonder() [/COLOR]and not pPlot:IsCity() and not pPlot:IsGoody() and pPlotType ~= PlotTypes.PLOT_MOUNTAIN then

The part in red is what I added,I think it failed due to it calling from the resource table (maybe?) and the bit I added refrences the features table. I am just unsure as to what is required or if its even possible :(
 
Code:
function IsNaturalWonder(pPlot)
  return pPlot and pPlot:GetFeatureType() ~= -1 and GameInfo.Features[pPlot:GetFeatureType()].NaturalWonder
end
 
You must have read my mind whoward. I was just checking in here to post a problem with my code and here you are with said answer. Code I was using, which was failing:-
Code:
	if pPlot:GetFeatureType() == 1 and GameInfo.Features(thisFeature.NaturalWonder) then
		return false;
	end
Adapted yours so it fits within a existing function:-
Code:
	-- Now check for Natural Wonder
	print ("Check Natural Wonder");
	if pPlot:GetFeatureType() ~= -1 and GameInfo.Features[pPlot:GetFeatureType()].NaturalWonder then
		return false;
	end
Off to test :)
 
Back
Top Bottom