turingmachine
Emperor
- Joined
- May 4, 2008
- Messages
- 1,438
Okay, I know I can use:
To check all the plots of the city radius and find out if a forest tile is present.
However, for a mod I need to know exactly how many forest tiles are present in the city radius and return that number. Can anybody give me some advice on how to count this?
(Sorry, I know this is probably a more general lua question than a civ specific question. Still learning lua as I go).
Code:
for i = 0, pCity:GetNumCityPlots() - 1, 1 do
local plot = pCity:GetCityIndexPlot( i )
if plot:GetFeatureType() == GameInfoTypes.FEATURE_FOREST then
To check all the plots of the city radius and find out if a forest tile is present.
However, for a mod I need to know exactly how many forest tiles are present in the city radius and return that number. Can anybody give me some advice on how to count this?
(Sorry, I know this is probably a more general lua question than a civ specific question. Still learning lua as I go).