]Lua] Grabbing tiles around an improvement

Genghis.Khan

Person
Joined
Jun 9, 2012
Messages
934
Location
Somewhere
My idea for a New Colonies System: Create an Improvement made by a specific unit that can create an improvement (Colony) - only in different continents. That isn't a major issue. The major issue is to have a Lua function to grab 1st ring tiles around that improvement. This can be done with cities in Lua. So can I use it for improvements too?

-- Please do not post
Player.SetWhateverTilesAroundImprovement should do the trick
but if you don't mind just post the whole code
Code:
Player.SetWhateverTilesAroundImprovement
Some Lua code
end
end
end
, because I have no experience in Lua. Sorry for bothering.

Genghis.Khan
 
Code:
pPlot = how ever your getting the colony plot (centre plot)

-- Iterate through each plot bordering pPlot (1 radius), start at north hex and check each hex clockwise
[B]for plot in PlotRingIterator(pPlot, 1, SECTOR_NORTH, DIRECTION_CLOCKWISE)) do[/B]
        --what ever you want to check or do with the adjacent hex ('plot') to pPlot
[B]end[/B]

That is as simple as it gets if you use whoward's code. Its really convenient.
 
Can't you just use the CultureBombRadius column in the Improvements table in the database, like it's done with the Citadel?
 
Can't you just use the CultureBombRadius column in the Improvements table in the database, like it's done with the Citadel?

Oh so that's what he meant by "grab".
 
No problem. English is the only language I know and I still manage to butcher it at times. :lol:
 
I like this idea, and I have a similar mechanic in my Conquest of the New World Scenario. However, using the plot iterators to transfer tile ownership is more flexible in my opinion. First, it creates the possibility of capturing only unowned tiles. Second, tile capture can change dynamically over the course of a game. For example, the radius of capture may expand after researching a tech or choosing a policy. Third it allows you to exclude specific tiles, like an extremely valuable natural wonder or a useless mountain.
 
Back
Top Bottom