[lua] Trying to return the continent name from a plot

__jack__

Warlord
Joined
Dec 29, 2009
Messages
141
Hi guys,

I tried to play aroudn with plot:GetContinentType() hoping to get a continent's name (in order to allocate luxuries from a particular continent).

I failed. Any idea on how to do that ?
 
Nearly all "GetSomething" methods return an integer ID # that associates to the ID # of a row within an XML game-table. So, Plot:GetContinentType() is going to return the integer ID # for the plot's continent which tracks back to table "Continents". To determine the In-Game Text name of the continent thus returned, do so
Code:
local iContinentType = Plot:GetContinentType()
local sContinentName = Locale.Lookup(GameInfo.Continents[iContinentType].Description)
You can then print the resulting Text value into the log, etc.

If you want to look at the actual "ContinentType" designation from table "Continents" such as "CONTINENT_AFRICA" then you can do as:
Code:
local iContinentType = Plot:GetContinentType()
local sContinentType = GameInfo.Continents[iContinentType].ContinentType
You would thus be translating the integer ID # returned from the Plot:GetContinentType() method into the text-string for the appropriate ContinentType as registered within game-table "Continents"

Game-table "Continents" can be found in file Maps.xml in folder
Code:
C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data
 
Top Bottom