Excess era score

Feofilakt

Chieftain
Joined
Oct 22, 2019
Messages
36
Hello! Is there a way to save excess era score for next age? I guess, it is hardcoded?
 
If I'm following you correctly, you want any Era score in excess of the amount needed for a Golden Age to be applied towards the next Golden Age. If so, take a look at file EraProgressPanel.lua, in DLC/Expansion1/UI/Additions (or DLC/Expansion2/UI/Additions) in the game's installation folder. At the beginning of function GetData(), there's this:
Code:
    local pGameEras:table = Game.GetEras();
    local currentEraIndex:number = pGameEras:GetCurrentEra();
    local currentEraDef:table = GameInfo.Eras[currentEraIndex];
    local currentTurn:number = Game.GetCurrentGameTurn();

    m_EraData.PlayerID = Game.GetLocalPlayer();

    m_EraData.CurrentEraName = currentEraDef.Name;
    m_EraData.CurrentEraScore = pGameEras:GetPlayerCurrentScore(m_EraData.PlayerID);

Later in the same function, there's this:
Code:
    m_EraData.DarkAgeThreshold = pGameEras:GetPlayerDarkAgeThreshold(m_EraData.PlayerID);
    m_EraData.DarkAgeThresholdTooltip = GetDarkAgeThresholdTooltip(m_EraData.PlayerID);
    m_EraData.GoldenAgeThreshold = pGameEras:GetPlayerGoldenAgeThreshold(m_EraData.PlayerID);
    m_EraData.GoldenAgeThresholdTooltip = GetGoldenAgeThresholdTooltip(m_EraData.PlayerID);

    if (pGameEras:GetCurrentEra() == pGameEras:GetFinalEra()) then
        m_EraData.FinalEraReached = true;
    end

    -- Determine which era we'll currently have next
    if m_EraData.CurrentEraScore >= m_EraData.GoldenAgeThreshold then
        m_EraData.NextEraType = ERA_TYPE_GOLDEN_AGE;
    elseif m_EraData.CurrentEraScore >= m_EraData.DarkAgeThreshold then
        m_EraData.NextEraType = ERA_TYPE_NORMAL_AGE;
    else
        m_EraData.NextEraType = ERA_TYPE_DARK_AGE;
    end

I am unsure where the values for GoldenAgeThreshold and DarkAgeThreshold originate, as they don't appear to be in any of the Eras-related database tables. That may not matter, though.

It appears that when m_EraData.CurrentEraScore is greater than or equal to m_EraData.GoldenAgeThreshold, the difference between the two values is the excess Era score. In theory, you'd probably need to track that difference through the Era on a per-player basis, and also cap m_EraData.CurrentEraScore to m_EraData.GoldenAgeThreshold as needed once this threshold is exceeded for a given player. Then, when an Era Change event occurs, you'd add the excess back to m_EraData.CurrentEraScore, and reset whatever variable is tracking that value to 0, so that it can start tracking any difference in the new Era; for that, the Spreadsheet suggests Game.ChangePlayerEraScore() might be useful, but I have so far been unable to find any examples of it in use, so again, this is all in theory.
 
Top Bottom