• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

[Help Request] Lua Error.

Horem

Emperor
Joined
Apr 1, 2010
Messages
1,721
Location
Wales, UK
I removed the default Gamepseeds form the Configuration database and added 3 of my own. They make the InGameTopOptionsMenu.lua file produce an error:-

Code:
Runtime Error: E:\SteamLibrary\steamapps\common\Sid Meier's Civilization VI\Base\Assets\UI\Menus\InGameTopOptionsMenu.lua:281: attempt to index a nil value
stack traceback:
   E:\SteamLibrary\steamapps\common\Sid Meier's Civilization VI\Base\Assets\UI\Menus\InGameTopOptionsMenu.lua:281: in function 'RefreshIconData'
   E:\SteamLibrary\steamapps\common\Sid Meier's Civilization VI\Base\Assets\UI\Menus\InGameTopOptionsMenu.lua:226: in function 'SetupButtons'
   E:\SteamLibrary\steamapps\common\Sid Meier's Civilization VI\Base\Assets\UI\Menus\InGameTopOptionsMenu.lua:383: in function 'OnShow'
Lua callstack:

The offending Code:
Code:
   local gameSpeedType = GameInfo.GameSpeeds[GameConfiguration.GetGameSpeedType()].GameSpeedType; -- This is the line the stack traceback links too
   Controls.GameSpeed:SetIcon(ICON_PREFIX..gameSpeedType);
   local speedTooltip = Locale.Lookup("LOC_AD_SETUP_GAME_SPEED")..":[NEWLINE]"..Locale.Lookup(GameInfo.GameSpeeds[GameConfiguration.GetGameSpeedType()].Name);
   Controls.GameSpeed:SetToolTipString(speedTooltip);

If I comment out the lines the error is fixed, now to me this is not really the way to fix a bug :), although it is at the moment serving as a temp fix. I am unsure as to why this would generate an error, my Lua is very sketchy at best. Any help much appreciated!
 
I will point out I didnt make or change the code, its the Vanilla file (I commented out the Code that displayes errors, the 4 lines above)
Code:
-- ===========================================================================
--   InGameTopOptionsMenu
-- ===========================================================================

include( "Civ6Common" );
include( "SupportFunctions" ); --DarkenLightenColor
include( "InputSupport" );
include( "InstanceManager" );
include( "PopupDialogSupport" );
include( "LocalPlayerActionSupport" );


-- ===========================================================================
--   GLOBALS
-- ===========================================================================
g_ModListingsManager = InstanceManager:new("ModInstance", "ModTitle", Controls.ModListingsStack);

-- ===========================================================================
--   MEMBERS
-- ===========================================================================
local m_kPopupDialog   : table;           -- Custom due to Utmost popup status
local ms_ExitToMain       : boolean = true;
local m_isSimpleMenu   : boolean = false;
local m_isLoadingDone   : boolean = false;

-- ===========================================================================
--   COSTANTS
-- ===========================================================================
local ICON_PREFIX:string = "ICON_";

-- ===========================================================================
--   FUNCTIONS
-- ===========================================================================

-- ===========================================================================
function OnReallyRetire()
    UI.RequestAction(ActionTypes.ACTION_RETIRE);
   CloseImmediately();
   UI.PlaySound("Notification_Misc_Negative");
end

function OnRetireGame()
   -- If we're in an extended game AND we're the winner.  Just re-open the end-game menu.
   -- Otherwise, prompt for retirement.
   local me = Game.GetLocalPlayer();
   if(Game.GetWinningPlayer() == me) then
       LuaEvents.ShowEndGame(me);  
   else
       if (not m_kPopupDialog:IsOpen()) then
           m_kPopupDialog:AddText(     Locale.Lookup("LOC_GAME_MENU_RETIRE_WARNING"));
           m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_NO_BUTTON_CAPTION"), nil );
           m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_YES_BUTTON_CAPTION"), OnReallyRetire, nil, nil, "PopupButtonInstanceAlt" );
           m_kPopupDialog:Open();
       end
   end
end


-- ===========================================================================
function OnExitGame()
   Steam.ClearRichPresence();
    Events.UserConfirmedClose();
end

-- ===========================================================================
function OnExitGameAskAreYouSure()
   if (not m_kPopupDialog:IsOpen()) then
       m_kPopupDialog:AddText(     Locale.Lookup("LOC_GAME_MENU_QUIT_WARNING"));
       m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_NO_BUTTON_CAPTION"), nil );
       m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_YES_BUTTON_CAPTION"), OnExitGame, nil, nil, "PopupButtonInstanceAlt" );
       m_kPopupDialog:Open();
   end
end

-- ===========================================================================
function OnMainMenu()
   ms_ExitToMain = true;
   if (not m_kPopupDialog:IsOpen()) then
       m_kPopupDialog:AddText(     Locale.Lookup("LOC_GAME_MENU_EXIT_WARNING"));
       m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_NO_BUTTON_CAPTION"), OnNo );
       m_kPopupDialog:AddButton( Locale.Lookup("LOC_COMMON_DIALOG_YES_BUTTON_CAPTION"), OnYes, nil, nil, "PopupButtonInstanceAlt" );
       m_kPopupDialog:Open();
   end
end

-- ===========================================================================
function OnQuickSaveGame()
   if (CanLocalPlayerSaveGame()) then
       local gameFile = {};
       gameFile.Name = "quicksave";
       gameFile.Location = SaveLocations.LOCAL_STORAGE;
       gameFile.Type= Network.GetGameConfigurationSaveType();
       gameFile.IsAutosave = false;
       gameFile.IsQuicksave = true;

       Network.SaveGame(gameFile);  
       UI.PlaySound("Confirm_Bed_Positive");
   end
end

-- ===========================================================================
function OnOptions()
   UIManager:QueuePopup(Controls.Options, PopupPriority.Current);  
end

-- ===========================================================================
function OnLoadGame()
   if (CanLocalPlayerLoadGame()) then
       LuaEvents.InGameTopOptionsMenu_SetLoadGameServerType(ServerType.SERVER_TYPE_NONE);
       UIManager:QueuePopup(Controls.LoadGameMenu, PopupPriority.Current);  
   end
end

-- ===========================================================================
function OnSaveGame()
   if (CanLocalPlayerSaveGame()) then
       UIManager:QueuePopup(Controls.SaveGameMenu, PopupPriority.Current);  
   end
end

-- ===========================================================================
function CloseImmediately()
   LuaEvents.InGameTopOptionsMenu_Close();
   UIManager:DequeuePopup( ContextPtr );
   UI.SetSoundStateValue("Game_Views", "Normal_View");
end

-- ===========================================================================
function Close()
   if(Controls.AlphaIn:IsStopped()) then
       -- Animation is good for a nice clean animation out..
       Controls.AlphaIn:Reverse();
       Controls.SlideIn:Reverse();
       Controls.PauseWindowClose:SetToBeginning();
       Controls.PauseWindowClose:Play();
   else
       -- Animation is not in an expected state, just reset all...
       Controls.AlphaIn:SetToBeginning();
       Controls.SlideIn:SetToBeginning();
       Controls.PauseWindowClose:SetToBeginning();      
       ShutdownAfterClose();
       ContextPtr:SetHide(true);
       UI.DataError("Forced closed() of the in game top options menu.  (Okay if someone was spamming ESC.)");
   end
   local playerChangeSlide =  ContextPtr:LookUpControl( "/InGame/PlayerChange/PopupSlideIn" );
   if (playerChangeSlide:GetOffsetY() ~= 0) then
       LuaEvents.InGameTopOptionsMenu_Close();      
   end  
   Input.PopContext();
end

-- ===========================================================================
function ShutdownAfterClose()
   UIManager:DequeuePopup( ContextPtr );
   UI.SetSoundStateValue("Game_Views", "Normal_View");
   UI.PlaySound("UI_Pause_Menu_On");
end

-- ===========================================================================
--   UI callback
-- ===========================================================================
function OnReturn()
   if (not ContextPtr:IsHidden() ) then
       Close();
   end
end

-- ===========================================================================
--   LUA Event
-- ===========================================================================
function OnCloseInGameOptionsMenu()
   if (not ContextPtr:IsHidden() ) then
       print("just not closing");
       --Close();
   end
end

-- ===========================================================================
--   LUA Event
--   Reduce the # of options in the menu (for tutorial purposes)
-- ===========================================================================
function OnSimpleInGameMenu( isSimpleMenu )

   if isSimpleMenu == nil then isSimpleMenu = true; end
   m_isSimpleMenu = isSimpleMenu;

   SetupButtons();

end

-- ===========================================================================
function SetupButtons()

   local bIsAutomation = Automation.IsActive();
   local bIsMultiplayer = GameConfiguration.IsAnyMultiplayer();
   local bCanSave = CanLocalPlayerSaveGame();
   local bCanLoad = CanLocalPlayerLoadGame();
   local bIsLocalPlayersTurn = IsLocalPlayerTurnActive();

   Controls.QuickSaveButton:SetDisabled( not bCanSave );
   Controls.SaveGameButton:SetDisabled( not bCanSave );
   Controls.LoadGameButton:SetDisabled( not bCanLoad );
   Controls.RetireButton:SetDisabled( not bIsLocalPlayersTurn );

   -- Hide the restart button until functionality is implemented and stable.
   Controls.RestartGameButton:SetHide(true); -- m_isSimpleMenu or bIsAutomation or bIsMultiplayer);

   Controls.QuickSaveButton:SetHide(m_isSimpleMenu or bIsAutomation);
   Controls.SaveGameButton:SetHide(m_isSimpleMenu or bIsAutomation);          
   Controls.LoadGameButton:SetHide(m_isSimpleMenu or bIsAutomation or bIsMultiplayer);
   Controls.OptionsButton:SetHide(bIsAutomation);  

   -- Eventually remove this check.  Retiring after winning is perfectly fine
   -- so long as we update the tooltip to no longer state the player will be defeated.
   local bAlreadyWon = false;
   local me = Game.GetLocalPlayer();
   if(Game.GetWinningPlayer() == me) then
       bAlreadyWon = true;
   end

   Controls.RetireButton:SetHide(m_isSimpleMenu or bIsAutomation or bIsMultiplayer or bAlreadyWon);

   Controls.ExitGameButton:SetHide(false);  

   RefreshModsInUse();
   RefreshIconData();

   Controls.MainStack:CalculateSize();
   Controls.PauseWindow:ReprocessAnchoring();
end

function RefreshIconData()

   -- Check for an invalid local player first!
   local eLocalPlayer :number = Game.GetLocalPlayer();
   if (eLocalPlayer < 0) then
       return;
   end

   m_pPlayer= Players[eLocalPlayer];

   m_primaryColor, m_secondaryColor  = UI.GetPlayerColors( m_pPlayer:GetID() );
   local darkerBackColor = DarkenLightenColor(m_primaryColor,(-85),100);
   local brighterBackColor = DarkenLightenColor(m_primaryColor,90,255);

   -- Icon colors
   Controls.CivBacking_Base:SetColor(m_primaryColor);
   Controls.CivBacking_Lighter:SetColor(brighterBackColor);
   Controls.CivBacking_Darker:SetColor(darkerBackColor);
   Controls.CivIcon:SetColor(m_secondaryColor);

   local leader:string = PlayerConfigurations[m_pPlayer:GetID()]:GetLeaderTypeName();
   if GameInfo.CivilizationLeaders[leader] == nil then
       UI.DataError("Banners found a leader \""..leader.."\" which is not/no longer in the game; icon may be whack.");
   else
       if(GameInfo.CivilizationLeaders[leader].LeaderType ~= nil) then
           local leaderIconName = ICON_PREFIX.. GameInfo.CivilizationLeaders[leader].LeaderType;
           -- Set Leader Icon
           Controls.LeaderIcon:SetIcon(leaderIconName);
           local leaderTooltip = GameInfo.Leaders[leader].Name;
           Controls.LeaderIcon:SetToolTipString(Locale.Lookup(leaderTooltip));
       end
       if(GameInfo.CivilizationLeaders[leader].CivilizationType ~= nil) then
           local civTypeName = GameInfo.CivilizationLeaders[leader].CivilizationType
           local civIconName = ICON_PREFIX..civTypeName;
           -- Set Civ Icon
           Controls.CivIcon:SetIcon(civIconName);
           civTooltip = GameInfo.Civilizations[civTypeName].Name;
           Controls.CivIcon:SetToolTipString(Locale.Lookup(civTooltip));
       end
   end

   -- Game difficulty
   local playerConfig:table = PlayerConfigurations[eLocalPlayer];
   local gameDifficultyTypeID = playerConfig:GetHandicapTypeID();
   local gameDifficultyType = GameInfo.Difficulties[gameDifficultyTypeID].DifficultyType;
   Controls.GameDifficulty:SetIcon(ICON_PREFIX..gameDifficultyType);
   local difficultyTooltip = Locale.Lookup("LOC_MULTIPLAYER_DIFFICULTY_HEADER")..":[NEWLINE]"..Locale.Lookup(GameInfo.Difficulties[gameDifficultyTypeID].Name);
   Controls.GameDifficulty:SetToolTipString(difficultyTooltip);

-- I commented this out so it stop producing an error

   --local gameSpeedType = GameInfo.GameSpeeds[GameConfiguration.GetGameSpeedType()].GameSpeedType;
   --Controls.GameSpeed:SetIcon(ICON_PREFIX..gameSpeedType);
   --local speedTooltip = Locale.Lookup("LOC_AD_SETUP_GAME_SPEED")..":[NEWLINE]"..Locale.Lookup(GameInfo.GameSpeeds[GameConfiguration.GetGameSpeedType()].Name);
   --Controls.GameSpeed:SetToolTipString(speedTooltip);
end

-- ===========================================================================
function OnYes( )

       UIManager:SetUICursor( 1 );
   UITutorialManager:EnableOverlay( false );  
   UITutorialManager:HideAll();

   UIManager:Log("Shutting down via user exit on menu.");
   if(ms_ExitToMain) then
       Events.ExitToMainMenu();
   else
       UI.ExitGame();
   end
end

-- ===========================================================================
function OnNo( )
   m_kPopupDialog:Close();
end


-- ===========================================================================
function KeyHandler( key:number )
   if key == Keys.VK_ESCAPE then      
       if not Controls.PopupDialog:IsHidden() then
           m_kPopupDialog:Close();
       else
           if (not ContextPtr:IsHidden() ) then
               Close();
           end
       end
       return true;
   end
   return false;
end

-- ===========================================================================
function OnInput( pInputStruct:table )
   local uiMsg = pInputStruct:GetMessageType();
   if uiMsg == KeyEvents.KeyUp then
       return KeyHandler( pInputStruct:GetKey() );
   end;
   return false;
end

-- ===========================================================================
function RefreshModsInUse()
   local mods = Modding.GetActiveMods();
  
   g_ModListingsManager:ResetInstances();
  
   for i,v in ipairs(mods) do
       local instance = g_ModListingsManager:GetInstance();
      
       instance.ModTitle:LocalizeAndSetText(v.Name);  
   end
  
   Controls.ModListingsStack:CalculateSize();
   Controls.ModListingsStack:ReprocessAnchoring();
   Controls.ModListings:CalculateSize();
   Controls.ModsInUse:SetHide( (#mods == 0) or m_isSimpleMenu );
   Controls.MainStack:CalculateSize();
   Controls.GameDetails:ReprocessAnchoring();
   Controls.CompassDeco:ReprocessAnchoring();
end

-- ===========================================================================
--   Raised (typically) from InGame since when this is hidden it will not
--   receive input from ForgeUI.
-- ===========================================================================
function OnShow()

   -- do not re-push the context if we're already in the GameOptions context
   -- (e.g. returning from a sub-screen)
   if Input.GetActiveContext() ~= InputContext.GameOptions then
       Input.PushActiveContext( InputContext.GameOptions );
   end

    LuaEvents.InGameTopOptionsMenu_Show();
   UI.PlaySound("UI_Pause_Menu_On");
   UI.SetSoundStateValue("Game_Views", "Paused");
  
   Controls.AlphaIn:SetToBeginning();
   Controls.AlphaIn:Play();
   Controls.SlideIn:SetToBeginning();
   Controls.SlideIn:Play();

   -- Reset interface mode... may want to re-evaluate this if there are
   -- common situation(s) where a player is in a difference interface mode
   -- and are bringing up this menu.  
   if WorldBuilder:IsActive() then
       UI.SetInterfaceMode( InterfaceModeTypes.WB_SELECT_PLOT );
   else
       UI.SetInterfaceMode( InterfaceModeTypes.SELECTION );
   end

   SetupButtons();

   -- Do not deselect all as on-rails scenarios (e.g., tutorials) may get out of sync.  

end

-- ===========================================================================
function OnLoadGameViewStateDone()
   m_isLoadingDone = true;
end

-- ===========================================================================
function OnPlayerTurnActivationChanged()
   if (not ContextPtr:IsHidden()) then
       SetupButtons();
   end
end

function OnRequestClose()
   if m_isLoadingDone then
       if (ContextPtr:IsHidden() ) then
           UIManager:QueuePopup( ContextPtr, PopupPriority.Utmost );
       end
       OnExitGameAskAreYouSure();
    else
       Events.UserConfirmedClose();
   end
end

-- ===========================================================================
function Initialize()

   ContextPtr:SetInputHandler( OnInput, true );
   ContextPtr:SetShowHandler( OnShow );

   Controls.ExitGameButton:RegisterCallback( Mouse.eLClick, OnExitGameAskAreYouSure );
   Controls.ExitGameButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.LoadGameButton:RegisterCallback( Mouse.eLClick, OnLoadGame );
   Controls.LoadGameButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.MainMenuButton:RegisterCallback( Mouse.eLClick, OnMainMenu );
   Controls.MainMenuButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.OptionsButton:RegisterCallback( Mouse.eLClick, OnOptions );
   Controls.OptionsButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.QuickSaveButton:RegisterCallback( Mouse.eLClick, OnQuickSaveGame );    
   Controls.QuickSaveButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);                  
   Controls.RetireButton:RegisterCallback( Mouse.eLClick, OnRetireGame );
   Controls.RetireButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.ReturnButton:RegisterCallback( Mouse.eLClick, OnReturn );
   Controls.ReturnButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.SaveGameButton:RegisterCallback( Mouse.eLClick, OnSaveGame );
   Controls.SaveGameButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.RestartGameButton:RegisterCallback( Mouse.eMouseEnter, function() UI.PlaySound("Main_Menu_Mouse_Over"); end);
   Controls.PauseWindowClose:RegisterEndCallback( ShutdownAfterClose );

   LuaEvents.InGame_CloseInGameOptionsMenu.Add( OnCloseInGameOptionsMenu );
   LuaEvents.DiploScene_SceneOpened.Add( OnCloseInGameOptionsMenu );
   LuaEvents.TutorialUIRoot_SimpleInGameMenu.Add( OnSimpleInGameMenu );

   Events.PlayerTurnActivated.Add( OnPlayerTurnActivationChanged );
   Events.PlayerTurnDeactivated.Add( OnPlayerTurnActivationChanged );
    Events.UserRequestClose.Add( OnRequestClose );
   Events.LoadGameViewStateDone.Add( OnLoadGameViewStateDone );

   Controls.VersionLabel:SetText( UI.GetAppVersion() );

   -- Custom popup setup  
   m_kPopupDialog = PopupDialogLogic:new( "InGameTopOptionsMenu", Controls.PopupDialog, Controls.PopupStack );
   m_kPopupDialog:SetInstanceNames( "PopupButtonInstance", "Button", "PopupTextInstance", "Text", "RowInstance", "Row");
   m_kPopupDialog:SetOpenAnimationControls( Controls.PopupAlphaIn, Controls.PopupSlideIn );  
   m_kPopupDialog:SetSize(400,200);
end
Initialize();
 
Ok, had a break so I could run home for bit.
Looks like the code itself is not the problem.
Are you sure your new game speed is defined properly, because it looks like it's trying to index the game speed and not getting a result.

Edit: I have to go back to work in a moment, but if you don't find answer, if you post the rest of your code with the game speed additions I'd be glad to look later.
 
Last edited:
I used SQL, Configuration:-
Code:
DELETE FROM GameSpeeds WHERE Domain='StandardGameSpeeds' AND GameSpeedType= 'GAMESPEED_MARATHON';
DELETE FROM GameSpeeds WHERE Domain='StandardGameSpeeds' AND GameSpeedType= 'GAMESPEED_EPIC';
DELETE FROM GameSpeeds WHERE Domain='StandardGameSpeeds' AND GameSpeedType= 'GAMESPEED_STANDARD';
DELETE FROM GameSpeeds WHERE Domain='StandardGameSpeeds' AND GameSpeedType= 'GAMESPEED_QUICK';
DELETE FROM GameSpeeds WHERE Domain='StandardGameSpeeds' AND GameSpeedType= 'GAMESPEED_ONLINE';

INSERT INTO GameSpeeds   (Domain,               GameSpeedType,           Name,                               Description,                       SortIndex) VALUES
                       ('StandardGameSpeeds',   'GAMESPEED_HOREM_S',   'LOC_GAMEPEED_C_HOREM_S_NAME',       'LOC_GAMEPEED_C_HOREM_S_DESC',       '10'),
                       ('StandardGameSpeeds',   'GAMESPEED_HOREM_RS',   'LOC_GAMEPEED_C_HOREM_RS_NAME',       'LOC_GAMEPEED_C_HOREM_RS_DESC',       '20'),
                       ('StandardGameSpeeds',   'GAMESPEED_HOREM_RRS',   'LOC_GAMEPEED_C_HOREM_RRS_NAME',   'LOC_GAMEPEED_C_HOREM_RRS_DESC',   '30');

They show up as been removed/entered into the database, no Errors produced.
This the code for the Gameplay Database:
Code:
INSERT INTO GameSpeeds (GameSpeedType,           Name,                               Description,                   CostMultiplier, CivicUnlockMaxCost, CivicUnlockPerTurnDrop, CivicUnlockMinCost) VALUES
                       ('GAMESPEED_HOREM_S',   'LOC_GAMEPEED_HOREM_S_NAME',       'LOC_GAMEPEED_HOREM_S_DESC',   '100',           '100',               '10',                   '20'),
                       ('GAMESPEED_HOREM_RS',   'LOC_GAMEPEED_HOREM_RS_NAME',       'LOC_GAMEPEED_HOREM_RS_DESC',   '150',           '150',               '15',                   '30'),
                       ('GAMESPEED_HOREM_RRS',   'LOC_GAMEPEED_HOREM_RRS_NAME',       'LOC_GAMEPEED_HOREM_RRS_DESC',   '200',           '200',               '20',                   '40');

INSERT INTO GameSpeed_Turns (GameSpeedType,           MonthIncrement, TurnsPerIncrement) VALUES
                           ('GAMESPEED_HOREM_S',   '300',           '150'),
                           ('GAMESPEED_HOREM_S',   '80',           '150'),
                           ('GAMESPEED_HOREM_S',   '48',           '200'),
                           ('GAMESPEED_HOREM_S',   '24',           '200'),
                           ('GAMESPEED_HOREM_S',   '6',           '200'),
                           ('GAMESPEED_HOREM_S',   '5',           '200'),
                           ('GAMESPEED_HOREM_S',   '1',           '200'),
                           ('GAMESPEED_HOREM_S',   '1',           '250'),
                           ('GAMESPEED_HOREM_S',   '1',           '500');
INSERT INTO GameSpeed_Turns (GameSpeedType,           MonthIncrement, TurnsPerIncrement) VALUES
                           ('GAMESPEED_HOREM_RS',   '150',           '225'),
                           ('GAMESPEED_HOREM_RS',   '40',           '225'),
                           ('GAMESPEED_HOREM_RS',   '24',           '300'),
                           ('GAMESPEED_HOREM_RS',   '12',           '300'),
                           ('GAMESPEED_HOREM_RS',   '3',           '300'),
                           ('GAMESPEED_HOREM_RS',   '2',           '300'),
                           ('GAMESPEED_HOREM_RS',   '1',           '300'),
                           ('GAMESPEED_HOREM_RS',   '1',           '375'),
                           ('GAMESPEED_HOREM_RS',   '1',           '750');
INSERT INTO GameSpeed_Turns (GameSpeedType,           MonthIncrement, TurnsPerIncrement) VALUES
                           ('GAMESPEED_HOREM_RRS',   '75',           '300'),
                           ('GAMESPEED_HOREM_RRS',   '20',           '300'),
                           ('GAMESPEED_HOREM_RRS',   '12',           '400'),
                           ('GAMESPEED_HOREM_RRS',   '6',           '400'),
                           ('GAMESPEED_HOREM_RRS',   '2',           '400'),
                           ('GAMESPEED_HOREM_RRS',   '1',           '800'),
                           ('GAMESPEED_HOREM_RRS',   '1',           '375'),
                           ('GAMESPEED_HOREM_RRS',   '1',           '950');

It all works as intended, other than making that Lua file produce an error.
You can find the code in my The Sloth, The Tortoise and The Snail mod if you want to boot the game up and see. The offending code is commented out to remove the error and doesnt seem to have an adverse effect in game.
 
did you define the Types for the 'gameplay' side of the database, as is done for the game's base gamespeeds in table Types:
Code:
<Types>
     <Row Type="GAMESPEED_MARATHON" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_EPIC" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_STANDARD" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_QUICK" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_ONLINE" Kind="KIND_GAMESPEED"/>
</Types>
I don't see it anywhere in the posted code.

A Ransack search of your mod does not seem to find table <Types> either in xml or sql files. Civ6 requires primary types to be defined in the <Types> table. Well, that is to say I have not attempted to add anything into the game without defining a Type so I am assuming they are required.
 
Last edited:
did you define the Types for the 'gameplay' side of the database, as is done for the game's base gamespeeds in table Types:
Code:
<Types>
     <Row Type="GAMESPEED_MARATHON" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_EPIC" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_STANDARD" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_QUICK" Kind="KIND_GAMESPEED"/>
     <Row Type="GAMESPEED_ONLINE" Kind="KIND_GAMESPEED"/>
</Types>
I don't see it anywhere in the posted code.

A Ransack search of your mod does not seem to find table <Types> either in xml or sql files. Civ6 requires primary types to be defined in the <Types> table. Well, that is to say I have not attempted to add anything into the game without defining a Type so I am assuming they are required.

Did not know about this :o . Will make edits. Thanx for help guys.
 
Back
Top Bottom