1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

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

Discussion in 'Mod Creation Help' started by __jack__, Oct 3, 2019.

  1. __jack__

    __jack__ Warlord

    Joined:
    Dec 29, 2009
    Messages:
    132
    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 ?
     
  2. __jack__

    __jack__ Warlord

    Joined:
    Dec 29, 2009
    Messages:
    132
    Nevermind I found a way to easy solve this with GetContinentPlots()
     
  3. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    6,911
    Location:
    Illinois, USA
    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
     

Share This Page