Lua Objects

My pleasure :) ! @Infixo suggested that I try them, and they worked well for me. If they work for initializing combat, please let me know!
I've not managed to use it to override the AI yet, as it seems to move its units just after their moves are (re)initialized but before the corresponding event is fired...
 
I've also added (in the second post on first page) the code I use in a new action button in Firetuner to get the Events arguments values.
 
Here is the code used to create the dumps in the Firetuner:
Spoiler :
Code:
local player = Players[0]
local unit = nil
local playerUnits = player:GetUnits()
for i, u in playerUnits:Members() do
    if u then
        unit = u
    end
end
local pConfig = PlayerConfigurations[0]
local city = nil
local playerCities = player:GetCities()
for i, c in playerCities:Members() do
    if c then
        city = c
    end
end
local Plot = Map.GetPlot(0,0)
local GetBarbarianManager = nil
local GetFalloutManager = nil
local GetGossipManager = nil
local GetQuestsManager = nil
local GetTradeManager = nil
if Game.GetBarbarianManager then GetBarbarianManager = Game.GetBarbarianManager() end
if Game.GetFalloutManager then GetFalloutManager = Game.GetFalloutManager() end
if Game.GetGossipManager then GetGossipManager = Game.GetGossipManager() end
if Game.GetQuestsManager then GetQuestsManager = Game.GetQuestsManager() end
if Game.GetTradeManager then GetTradeManager = Game.GetTradeManager() end
local seenO = {}
local seenT = {}
listDump = {
    Achievements = Achievements,
    AutoplayManager = AutoplayManager,
    Calendar = Calendar,
    Cities = Cities,
    CityManager = CityManager,
    City = city,
    CombatManager = CombatManager,
    ContextPtr = ContextPtr,
    DealManager = DealManager,
    DiplomacyManager = DiplomacyManager,
    Game = Game,
    GameConfiguration = GameConfiguration,
    GameEffects = GameEffects,
    GetUnitStats = GetUnitStats,
    GameGetBarbarianManager = GetBarbarianManager,
    GameGetFalloutManager = GetFalloutManager,
    GameGetGossipManager = GetGossipManager,
    GameGetQuestsManager = GetQuestsManager,
    GameGetTradeManager = GetTradeManager,
    IconManager = IconManager,
    InstanceManager = InstanceManager,
    Locale = Locale,
    MapConfiguration = MapConfiguration,
    Map = Map,
    NotificationManager = NotificationManager,
    Options = Options,
    PlayerConfigurations = pConfig,
    PlayerManager = PlayerManager,
    PlayerVisibilityManager = PlayerVisibilityManager,
    Players = player,
    Plot = Plot,
    TTManager = TTManager,
    UIManager = UIManager,
    UITutorialManager = UITutorialManager,
    Unit = unit,
    UnitManager = UnitManager,
    Units = Units,
    UserConfiguration = UserConfiguration,
    }

listExceptionStr = {
    "IsNone",
    "ToPlot",
    "ToArea",
    "GetDiplomaticState",
    "HasProductionProgress",
    "ToolTip",
    "HasBeenPlaced",
    "GetAvailableProductionType",
    "GetTurnsLeft",
    "GetName",
    "GetScienceYieldToolTip",
    "GetPlayerName",
    "GetLeaderName",
    "Name",
    "Description",
    "Text",
    "Password",
    "GetNextEscapingSpyID",
    "Advice",
    "IsResourceExtractableAt",
    "Tooltip",
    "GetNextPursuedSpyID",
    "GetTurnFromIndex",
    "GetTurn",
    "GetNthOffMapSpy",
    "GetPlayerFromIndex",
    "FromIndex",
    "GetDiplomaticActionCost",
    "Turn",
    "Level",
    "GetDiplomatic",
    "GetCities",
    "GetStartingPlot",
    "GetActiveQuestReward",
    }
function canTest(functionName)
    local bCanTest = false
    local get = string.find(functionName, "Get")
    --local is = string.find(functionName, "Is")
    --local has = string.find(functionName, "Has")
    if get == 1 or is == 1 or has == 1 then
        bCanTest = true
    end
    for k, str in pairs(listExceptionStr) do
        if string.find(functionName, str) then
            return false
        end
    end
    return bCanTest
end
function dumpO(object,i)
    seenO[object]=true
    local s={}
    local n=0
    local meta = getmetatable(object).__index
    if type(meta)=="function" then meta = getmetatable(object).__index() end
    if not meta then return end
    for k, v in pairs(meta) do
        print(i,k)
        if type(v)=="table" and not seenT[v] then
            dumpT(v,i.."\t")
        end
        if type(v)=="function" then
            object.f = object[k]
            local value = nil
            if canTest(tostring(k)) then
                value = object:f()
                --print(i.."\t - ".."return value :", value)
            end
            if getmetatable(v) and getmetatable(v).__index and not seenO[v] then
                dumpO(v,i.."\t")
            end
            if value and getmetatable(value) and getmetatable(value).__index and not seenO[value] then
                dumpO(value,i.."\t")
            end
            if value and type(value)=="table" and not seenT[value] then
                dumpT(value,i.."\t")
            end
        end
    end;
end
function dumpT(table,i)
    seenT[table]=true
    local s={}
    local n=0
    for k in pairs(table) do
        n=n+1 s[n]=k
    end
    for k,v in ipairs(s) do
        print(i,v)
        v=table[v]
        if type(v)=="table" and not seenT[v] then
            dumpT(v,i.."\t")
        end
    end
end
function dumpAll()
    local contextName = "Script"
    if ContextPtr and ContextPtr.GetID then contextName = ContextPtr:GetID() end
    print("-----------------------------------------------------------------------------------------------------")
    print("-----------------------------------------------------------------------------------------------------")
    print("-- STARTING DUMP FROM CONTEXT = ".. Locale.ToUpper(contextName))
    print("-----------------------------------------------------------------------------------------------------")
    print("-----------------------------------------------------------------------------------------------------")
    local a = {}
    for n in pairs(listDump) do table.insert(a, n) end
    table.sort(a)
    for i,k in ipairs(a) do
        local v = listDump[k]
        local i = ""
        if type(v)=="function" then
            local value = v()
            print("return value :" .. value)
            if getmetatable(v) and getmetatable(v).__index then
                dumpO(v,i.."\t")
            end
            if getmetatable(value) and getmetatable(value).__index then
                dumpO(value,i.."\t")
            end
            if type(value)=="table" then
                dumpT(value,i.."\t")
            end
        end
        if getmetatable(v) and getmetatable(v).__index then
            print("--- object:", k)
            dumpO(v,i)
            print("--- ")
            print("--------------------------------------")
        end
        if type(v)=="table" then
            print("--- table:", k)
            dumpT(v,i)
            print("--- ")
            print("--------------------------------------")
        end
    end
end
dumpAll()

And the code I use to get the arguments values of all events:
Spoiler :

Code:
local seen = {}
function dump(t,i)
    seen[t]=true
    local s={}
    local n=0
    for k, v in pairs(t) do
        print(i,k, v)
        if type(v)=="table" and not seen[v] then
            dump(v,i.."\t\t")
        end
    end
end

function getEventArguments(...)
    local args = {...}
    if args then
        print("---------------------------------------------------------------------------------- Start <")
        print("num arguments = " .. #args)
        print(unpack({...}))     
        for i = 1, #args do
            if type(args[i])== "table" then
                print("--------------- "..tostring(args[i]).." ---------------");
                dump(args[i], "");
                print();
            end
        end
        print("------------------------------------------------------------------------------------ End >");
        print();
    else 
        print("---------------------------------------------------------------------------------- Start <")
        print("No arguments...")
        print("------------------------------------------------------------------------------------ End >");
        print();
    end
end

local eventslist = {
    -- GameCoreEvent
    "AnarchyBegins",
    "AnarchyEnds",
    "BeliefAdded",
    "BuildingAddedToMap",
    "BuildingChanged",
    "BuildingRemovedFromMap",
    "CapitalCityChanged",
    "CityAddedToMap",
    "CityCommandStarted",
    "CityDefenseStatusChanged",
    "CityFocusChanged",
    "CityInitialized",
    "CityLiberated",
    "CityMadePurchase",
    "CityPopulationChanged",
    "CityProductionChanged",
    "CityProductionCompleted",
    "CityProductionUpdated",
    "CityProjectCompleted",
    "CityReligionChanged",
    "CityReligionFollowersChanged",
    "CityRemovedFromMap",
    "CitySiegeStatusChanged",
    "CityTileOwnershipChanged",
    "CityUnitsChanged",
    "CityVisibilityChanged",
    "CityWorkerChanged",
    "CivicBoostTriggered",
    "CivicChanged",
    "CivicCompleted",
    "CivicQueueChanged",
    "CivicsUnlocked",
    "Combat",
    "CultureChanged",
    "CultureYieldChanged",
    "DiplomacyDealEnacted",
    "DiplomacyDealExpired",
    "DiplomacyDeclareWar",
    "DiplomacyIncomingDeal",
    "DiplomacyMakePeace",
    "DiplomacyMeet",
    "DiplomacyMeetMajorMinor",
    "DiplomacyMeetMajors",
    "DiplomacyRefusePeace",
    "DiplomacyRelationshipChanged",
    "DiplomacySessionClosed",
    "DiplomacyStatement",
    "DistrictAddedToMap",
    "DistrictBuildProgressChanged",
    "DistrictCombatChanged",
    "DistrictDamageChanged",
    "DistrictPillaged",
    "DistrictRemovedFromMap",
    "DistrictUnitsChanged",
    "DistrictVisibilityChanged",
    "EndTurnBlockingChanged",
    "EndTurnDirty",
    "FaithChanged",
    "FeatureAddedToMap",
    "FeatureChanged",
    "FeatureRemovedFromMap",
    "GoodyHutReward",
    "GovernmentChanged",
    "GovernmentPolicyChanged",
    "GovernmentPolicyObsoleted",
    "GreatPeoplePointsChanged",
    "GreatPeopleTimelineChanged",
    "GreatWorkCreated",
    "GreatWorkMoved",
    "ImprovementActivated",
    "ImprovementAddedToMap",
    "ImprovementChanged",
    "ImprovementOwnershipChanged",
    "ImprovementRemovedFromMap",
    "ImprovementVisibilityChanged",
    "InfluenceChanged",
    "InfluenceGiven",
    "LevyCounterChanged",
    "LocalPlayerChanged",
    "LocalPlayerTurnBegin",
    "LocalPlayerTurnEnd",
    "MapYieldsChanged",
    "NationalParkAdded",
    "NaturalWonderRevealed",
    "NotificationAdded",
    "NotificationDismissed",
    "NotificationRefreshRequested",
    "ObjectPairing",
    "OnAiAdvisorUpdated",
    "PantheonFounded",
    "PhaseBegin",
    "PhaseEnd",
    "PlayerBordersChanged",
    "PlayerDefeat",
    "PlayerDestroyed",
    "PlayerEraChanged",
    "PlayerOperationComplete",
    "PlayerTurnActivated",
    "PlayerTurnDeactivated",
    --"PlayerVictory",
    "PlotMarkerChanged",
    "PlotVisibilityChanged",
    "PlotYieldChanged",
    "QuestChanged",
    "ReligionFounded",
    "RemotePlayerTurnBegin",
    "RemotePlayerTurnEnd",
    "ResearchChanged",
    "ResearchCompleted",
    "ResearchQueueChanged",
    "ResearchYieldChanged",
    "ResourceAddedToMap",
    "ResourceChanged",
    "ResourceRemovedFromMap",
    "ResourceVisibilityChanged",
    "RouteAddedToMap",
    "RouteChanged",
    "RouteRemovedFromMap",
    "SpyAdded",
    "SpyMissionUpdated",
    "SpyRemoved",
    "SpyUpdated",
    "StatusMessage",
    "TeamVictory",
    "TechBoostTriggered",
    "TerrainTypeChanged",
    "TradeRouteActivityChanged",
    "TradeRouteAddedToMap",
    "TradeRouteCapacityChanged",
    "TradeRouteRangeChanged",
    "TradeRouteRemovedFromMap",
    "TreasuryChanged",
    "TurnBegin",
    "TurnEnd",
    "UnitActivityChanged",
    "UnitAddedToMap",
    "UnitAirlifted",
    "UnitArtifactChanged",
    "UnitCaptured",
    "UnitChargesChanged",
    "UnitCommandStarted",
    "UnitDamageChanged",
    "UnitEmbarkedStateChanged",
    "UnitEnterFormation",
    "UnitExitFormation",
    "UnitFormArmy",
    "UnitFormCorps",
    "UnitFortificationChanged",
    "UnitGreatPersonActivated",
    "UnitGreatPersonChanged",
    "UnitGreatPersonCreated",
    "UnitKilledInCombat",
    "UnitMoveComplete",
    "UnitMoved",
    "UnitMovementPointsChanged",
    "UnitMovementPointsCleared",
    "UnitMovementPointsRestored",
    "UnitOperationAdded",
    "UnitOperationDeactivated",
    "UnitOperationSegmentComplete",
    "UnitOperationStarted",
    "UnitOperationsCleared",
    "UnitPromoted",
    "UnitPromotionAvailable",
    "UnitRemovedFromMap",
    "UnitTeleported",
    "UnitUpgraded",
    "UnitVisibilityChanged",
    "WMDCountChanged",
    "WMDDetonated",
    "WMDFalloutChanged",
    "WMDFalloutVisibilityChanged",
    "WonderCompleted",
    "WorldTextMessage",
    -- LocalMachineEvent
    "ARXOrientationChanged",
    "ARXTap",
    "AchievementProgress",
    "AchievementUnlocked",
    "Begin2KLoginProcess",
    "BeginGameView",
    "BeginMy2KLinkAccountProcess",
    "BeginWonderReveal",
    "Camera_Updated",
    "CloudGameInfoUpdated",
    "CloudGameJoinResponse",
    "CloudGameListUpdated",
    "EndGameView",
    "EndWonderReveal",
    "ExitToMainMenu",
    "FiraxisLiveActivate",
    "FrontEndPopup",
    "GameConfigChanged",
    "HideLeaderScreen",
    "InputActionTriggered",
    "InputGestureRecorded",
    "LeaderAnimationChanged",
    "LeaderAnimationComplete",
    "LeaderScreenFinishedLoading",
    "LeaveGameComplete",
    "ModStatusUpdated",
    "MultiplayerChat",
    "MultiplayerGameAbandoned",
    "MultiplayerGameLastPlayer",
    "MultiplayerGameListClear",
    "MultiplayerGameListComplete",
    "MultiplayerGameListUpdated",
    "MultiplayerHostMigrated",
    "MultiplayerJoinGameComplete",
    "MultiplayerJoinRoomAttempt",
    "MultiplayerJoinRoomComplete",
    "MultiplayerJoinRoomFailed",
    "MultiplayerPingTimesChanged",
    "MultiplayerPlayerConnected",
    "MultiplayerPostPlayerDisconnected",
    "MultiplayerPrePlayerDisconnected",
    "MultiplayerSnapshotProcessed",
    "My2KActivate",
    "My2KLinkAccountResult",
    "OptionChangeRequiresAppRestart",
    "OptionChangeRequiresGameRestart",
    "OptionChangeRequiresResolutionAck",
    "OptionChanged",
    "OptionsReset",
    "OptionsReverted",
    "OptionsSaved",
    "PlayerInfoChanged",
    "ShowLeaderScreen",
    "SteamFriendsPresenceUpdated",
    "SteamFriendsStatusUpdated",
    "SteamServersConnected",
    "SteamServersDisconnected",
    "TurnTimerUpdated",
    "UpdateGraphicsOptions",
    "UserAcceptsEULA",
    "UserAcceptsOutdatedDriver",
    "UserAcceptsUnknownDevice",
    "UserConfirmedClose",
    "UserRequestClose",
    "WorldRenderViewChanged",
    -- SequenceEvent
    "AppInitComplete",
    "GameViewStateDone",
    "LoadGameViewStateDone",
    "LoadScreenClose",
    "LoadScreenContentReady",
    "MainMenuStateDone",
    -- SerialEvent
    "AfterGameplayContentChange",
    "AfterGameplayContentConfigure",
    "AllCitiesDeselected",
    "AllDistrictsDeselected",
    "AllUnitsDeselected",
    "AutomationTestComplete",
    "BeforeGameplayContentChange",
    "BeforeGameplayContentConfigure",
    "BeforeMultiplayerInviteProcessing",
    "CitySelectionChanged",
    "CombatVisBegin",
    "CombatVisEnd",
    "CycleUnitSelectionRequest",
    "DemoExit",
    "DemoTurnLimitReached",
    "DistrictSelectionChanged",
    "FinishedGameplayContentChange",
    "FinishedGameplayContentConfigure",
    "GameConfigurationParameterChanged",
    "GameConfigurationRebuilt",
    "GameConfigurationResolved",
    "GameCoreEventPlaybackComplete",
    "GameCoreEventPublishComplete",
    "InterfaceModeChanged",
    "LensFocusHex",
    "LensLayerOff",
    "LensLayerOn",
    "LensUnFocusHex",
    "LoadCanceled",
    "LoadComplete",
    "MapMaxMajorPlayersChanged",
    "MultiplayerGameInvite",
    "MultiplayerGameLaunched",
    "PreTurnBegin",
    "RequestLoad",
    "RequestSave",
    "SaveCanceled",
    "SaveComplete",
    "SubscriptionDownloadStatus",
    "UnitSelectionChanged",
    "UnitSimPositionChanged",
    "UserOptionChanged",
    "VisualStateRestored",
    -- UIEvent
    "DragCamera",
    "SystemUpdateUI",
    -- New
}

local gameEventsList = {
    "CityBuilt",
    "CityConquered",
    "OnCityPopulationChanged",
    "OnFaithEarned",
    "OnGameTurnStarted",
    "OnGreatPersonActivated",
    "OnNewMajorityReligion",
    "OnPillage",
    "OnUnitRetreated",
    "PlayerTurnStartComplete",
    "PlayerTurnStarted",
}

local maxCall = 5

local numCall = {}
local eventsFunctions = {}

for i, eventName in ipairs(eventslist) do 
    print("Adding Listen to Events." .. eventName)
    numCall[eventName] = 0
    eventsFunctions[eventName] = function (...) if numCall[eventName] < maxCall then print("-- Events."..eventName);    getEventArguments(...);    numCall[eventName] = numCall[eventName] + 1; else Events[eventName].Remove( eventsFunctions[eventName] ) end;    end;
    Events[eventName].RemoveAll() -- remove previous listener when running the code again...
    Events[eventName].Add( eventsFunctions[eventName] )
end

for i, eventName in ipairs(gameEventsList) do
    print("Adding Listen to GameEvents." .. eventName)
    numCall[eventName] = 0
    eventsFunctions[eventName] = function (...) if numCall[eventName] < maxCall then print("-- GameEvents."..eventName);    getEventArguments(...);    numCall[eventName] = numCall[eventName] + 1; else GameEvents[eventName].Remove( eventsFunctions[eventName] ) end;    end;
    GameEvents[eventName].RemoveAll()
    GameEvents[eventName].Add( eventsFunctions[eventName] )
end


Dumps from script and UI contexts attached (as of Spring patch)
 
I'm just starting my Civ modding adventure and would like to understand how to set up and use the FireTuner in Civ VI. Could someone direct me to something akin to a User Manual?
 
There's no such thing. Welcome, mushroom.

P.S. If you have a question it's best to post a new question, not a reply.

P.P.S. Before anyone points out that I do the same thing, I know that. It's a bad habit I'm trying to break.
 
I am figuring out modding for myself, and made notes of most of the events, because I want to make a new autoplay mod where more detailed info will be available throughout the "set". I thought I could share it, I am not sure how many are already known, and I have not made any effort to make "proper" typenames, but I think it should be sufficiently understandable, and may save someone the effort to find out themselves.
 

Attachments

There's no such thing. Welcome, mushroom.

P.S. If you have a question it's best to post a new question, not a reply.

P.P.S. Before anyone points out that I do the same thing, I know that. It's a bad habit I'm trying to break.
Thanks for the welcome and the tip.
In the dark. Well fertilized.
A journey. Not a destination.
 
CityBuilt
CityConquered
OnCityPopulationChanged
OnFaithEarned
OnGameTurnStarted
OnGreatPersonActivated
OnNewMajorityReligion
OnPillage
OnUnitRetreated
PlayerTurnStartComplete
PlayerTurnStarted

@Gleb Bazov How did you encounter those Events? In my game they do not exist (except CityPopulationChanged).
 
function CityCommandStarted( iPlayerID, iCityID, iIntegerA, iIntegerB, Hash, iIntegerC )
integer A & integer B are district owner and district ID
Hash is command - value from CityCommandTypes enumeration
integer C - additional Data, command specific

function DistrictAddedToMap( iPlayerID, iDistrictID, iCityID, iDistrictX, iDistrictY, iDistrictType, HashA, HashB, iPercentComplete, iAppealRating, iIntegerB )
HashA - can be decoded via Types, it is ERA_xxx
HashB - it is hash from Civilization table
integerB - it is supposed to indicate Previous Attempts but I've never managed to get here something else than 0
 
@Gleb Bazov How did you encounter those Events? In my game they do not exist (except CityPopulationChanged).
Those are Game Events, like : GameEvents.CityBuilt

CityPopulationChanged exist as an event and game event, someone from Firaxis team may have required one for a DLC scenario (they seem to add those as GameEvents), and it was added by a programmer, not knowing it was already available in Events (or maybe it fires at a different time)
 
(or maybe it fires at a different time)
At least one of the contexts is on-the-map animation time, right?

Is there a list of contexts, what they're for, and timing issues that arise from them? I ask because a) I want to know and b) In my mod I run most of my code in InGame context and only switch to the default context that AddGameplayScripts uses to create a unit, and I wonder if there are any consequences of using InGame or whether I should switch to the default for most of the code and only use InGame sparingly.
 
Those are Game Events, like : GameEvents.CityBuilt

CityPopulationChanged exist as an event and game event, someone from Firaxis team may have required one for a DLC scenario (they seem to add those as GameEvents), and it was added by a programmer, not knowing it was already available in Events (or maybe it fires at a different time)
I looked through GameEvents some time ago and they were all the same as Events. I assumed that they exist for some kind of backward compatbility. So, all standard game events are available via Events and all user-defined events via LuaEvents. Although GameEvents can be different than Events, what a surprise... Well, you can learn something new here everyday :)
 
GameEvents could be used for user-defined events, not sure the following still work:

And there is also GameEvents to consider with

GameEvents.YourEvent.Remove()
GameEvents.YourEvent.AccumulateINT()
GameEvents.YourEvent.TestAll()
GameEvents.YourEvent.Count()
GameEvents.YourEvent.Call()
GameEvents.YourEvent.TestAny()
GameEvents.YourEvent.Accumulate()
GameEvents.YourEvent.Add()
GameEvents.YourEvent.RemoveAll()

which works over contexts

for exemple, you add multiple function that return a value to a game event, TestAll() should return true if all of them return something, TestAny() should return true if one of them return something
 
I have to confess, I am really having a hard time figuring this all out. I got somewhat comfortable modding in Civ 5 lua, but this is a different animal.

In any case, I have "stolen" some code from YNAMP files that is supposed to print out the map plots of a civ6 map file to be used in a map script.

I did this in Civ 5 using similar code with "Events.SequenceGameInitComplete.Add(ExportMap)" as the hook.

In all the documentation I have seen, this event is not evident, so I used the following code:
Code:
----------------------------------------------------------------------------------------
-- Export a complete civ6 map to Lua.log
----------------------------------------------------------------------------------------
function ExportMap()
    local iPlotCount = Map.GetPlotCount();
    for iPlotLoop = 0, iPlotCount-1, 1 do
        local bData = false
        local plot = Map.GetPlotByIndex(iPlotLoop)
        local NEOfCliff = 0
        local WOfCliff = 0
        local NWOfCliff = 0
        if plot:IsNEOfCliff() then NEOfCliff = 1 end
        if plot:IsWOfCliff() then WOfCliff = 1 end
        if plot:IsNWOfCliff() then NWOfCliff = 1 end
        local NEOfRiver = 0
        local WOfRiver = 0
        local NWOfRiver = 0
        if plot:IsNEOfRiver() then NEOfRiver = 1 end -- GetRiverSWFlowDirection()
        if plot:IsWOfRiver() then WOfRiver = 1 end -- GetRiverEFlowDirection()
        if plot:IsNWOfRiver() then NWOfRiver = 1 end -- GetRiverSEFlowDirection()
        print("MapToConvert["..plot:GetX().."]["..plot:GetY().."]={"..plot:GetTerrainType()..","..plot:GetFeatureType()..","..plot:GetContinentType()..",{{"..NEOfRiver..","..plot:GetRiverSWFlowDirection().. "},{"..WOfRiver..","..plot:GetRiverEFlowDirection().."},{"..NWOfRiver..","..plot:GetRiverSEFlowDirection().."}},{"..plot:GetResourceType(-1)..","..tostring(1).."},{"..NEOfCliff..","..WOfCliff..","..NWOfCliff.."}}")
    end
end

Events.PlayerEraChanged.Add(iPlayer, iEra)
--Events.SequenceGameInitComplete.Add(ExportMap)

However, my log did not print the info... I am not certain what I have done wrong. In the mod info file, I have added the file as a script component...

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="cdf37c94-4b94-4351-8f83-6a1674ba542a">
<Properties>
<Name>Custom Maps</Name>
<Stability>Final</Stability>
<Teaser>Custom Map Operating Mod</Teaser>
<Description>A mod to test and record custom map information</Description>
<Authors>Craig</Authors>
</Properties>

<Settings>
    <Custom id="CM_SETTINGS">
        <Items>
            <File>CM_Config.xml</File>
        </Items>
    </Custom>
    <Map id="CM_MAP">
        <Properties>
            <Group>StandardMaps</Group>
            <Name>Custom Map</Name>
            <Description>Test Map</Description>
        </Properties>
        <!--add the map file in Maps subdirectory-->
        <Items>
            <File>Maps/Northwest_Europe_135x81_Map.Civ6Map</File>
        </Items>
    </Map>
</Settings>

<Components>
    <GameplayScripts>
        <Items>
            <File>Scripts/Custom Map Export.lua</File>
        </Items>
      </GameplayScripts>
    <UpdateDatabase />
</Components>

<Files>
    <!--This part is very simple, just make sure the filenames all match up-->
    <File>Maps/Northwest_Europe_135x81_Map.Civ6Map</File>   
    <File>CM_Config.xml</File>
    <File>Scripts/Custom Map Export.lua</File>
</Files>
</Mod>

What am I doing wrong, please? If I can just figure out how event hooks and modinfo files interact to run lua, I can figure the code out from there.

Thanks.
 
Probably one of those below.
Events.AppInitComplete
Events.GameViewStateDone
Events.LoadGameViewStateDone
Events.LoadScreenClose
Events.LoadScreenContentReady
Events.MainMenuStateDone
I usually use LoadScreenClose when not bothering with save files.
But, as I understand, you want to basically print some map info. Entire map data is available when your script is initialized, i.e. you can run your function in your mod's Initialize.
 
Dear all, a question, specifically for Gedemon, whose excellent work I am trying to apply in my own modding. I have tried to use the Serialize.lua / SaveLoad method that Gedemon designed, most with success. However, I can only keep the saved data while the game application is running. In other words, saved tables will persist if I don't quit Civ 6. They load, save and reload properly. However, as soon as I quit the main application (to desktop) the saved table data is gone, without a trace. Is this just an impregnable limitaiton of the Civ 6 lua or am I doing something completely wrong? Is there a way to have the saved data persist after the game application is closed?

Kind thanks for any advice! I've been breaking my head over this for days.

Gleb
 
HOORAY! I got it working! Much thanks, Gedemon! Bravo :)

It was my own error in the end and I tracked it down.

Cheers!
 
Sorry if this has been answered before, but has this been updated since the Spring Patch? If not, we are probably about to have another patch very soon that might be worth waiting for.
 
Back
Top Bottom