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 Help for Amenity Mod (RESOLVED)

Discussion in 'Mod Creation Help' started by SocialMechanic, Oct 25, 2019.

  1. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    So, I made a mod that gives greater bonuses for cities at +6-9 amenities and +10 amenities.
    The mechanic itself works, so I know that is good.
    The problem is that the city cities tab that pops up on the left of the screen when you look at the details of a city doesn't work.
    I know that there is a mod done by "ActJustly.LoveMercy.WalkHumbly's" that also does this but in a different way than me. I looked into the mod and it appears as though you need to also change the city details interface with a Lua file (which I have no experience with). Just to test things out and see if I could at lease get it working, I copied their Lua file and put it into ModBuddy for my mod. I followed LeeS instructions on his PDF and added the Lua file into the "In-Game Actions" as an "AddGameplayScript". I also made the appropriate changes to the text of the Lua file so that it align with my mod (from what I can tell at least).
    When I tested it, it still has the same issue, and I'm not sure what else to do. Is there something else I need to do to get the Lua file recognized? I'm not sure. Thank you.
     
  2. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,447
    Gender:
    Male
    Location:
    Warsaw
  3. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    https://steamcommunity.com/sharedfiles/filedetails/?id=1740175648

    Code:
    include("CityPanelOverview");
    include("CityPanelOverview_Expansion1");
    
    local UV_CITIZEN_GROWTH_STATUS        :table    = {};
            UV_CITIZEN_GROWTH_STATUS[0] = {u=0, v=0  };        -- revolt
            UV_CITIZEN_GROWTH_STATUS[1] = {u=0, v=0 };        -- unrest
            UV_CITIZEN_GROWTH_STATUS[2] = {u=0, v=0};        -- unhappy
            UV_CITIZEN_GROWTH_STATUS[3] = {u=0, v=50};        -- displeased
            UV_CITIZEN_GROWTH_STATUS[4] = {u=0, v=100};        -- content (normal)
            UV_CITIZEN_GROWTH_STATUS[5] = {u=0, v=150};        -- happy
            UV_CITIZEN_GROWTH_STATUS[6] = {u=0, v=200};        -- ecstatic
            UV_CITIZEN_GROWTH_STATUS[7] = {u=0, v=250};        -- utopia
    
    local m_kEspionageViewManager = EspionageViewManager:CreateManager();
    
    function ViewPanelAmenities( data:table )
        print("ViewPanelAmenities");
    
        local status, err = pcall(function()
            Controls.AmenitiesAdvisorBubble:SetHide( m_kEspionageViewManager:IsEspionageView() );
            
            local colorName:string = GetHappinessColor(data.Happiness);
            Controls.AmenitiesConstructedLabel:SetText( Locale.Lookup( "LOC_HUD_CITY_AMENITY", data.AmenitiesNum) );
            Controls.AmenitiesConstructedNum:SetText( Locale.ToNumber(data.AmenitiesNum) );
            Controls.AmenityTotalNum:SetText( Locale.ToNumber(data.AmenitiesNum) );
            Controls.AmenitiesConstructedNum:SetColorByName( colorName );
            Controls.Mood:SetText( Locale.Lookup(GameInfo.Happinesses[data.Happiness].Name) );
            Controls.Mood:SetColorByName( colorName );
            
            if data.HappinessGrowthModifier == 0 then
                Controls.CitizenGrowth:SetText( Locale.Lookup("LOC_HUD_CITY_CITIZENS_SATISFIED") );
                Controls.CitizenGrowth:SetFontSize(12);
            else
                Controls.CitizenGrowth:SetFontSize(12);
                local iGrowthPercent = Round(1 + (data.HappinessGrowthModifier/100), 2);
                local iYieldPercent = Round(1 + (data.HappinessNonFoodYieldModifier/100), 2);
                local growthInfo:string =
                    GetColorPercentString(iGrowthPercent) ..
                    " "..
                    Locale.Lookup("LOC_HUD_CITY_CITIZEN_GROWTH") ..
                    "[NEWLINE]" ..
                    GetColorPercentString(iYieldPercent) ..
                    " "..
                    Locale.ToUpper( Locale.Lookup("LOC_HUD_CITY_ALL_YIELDS") );
                    
                Controls.CitizenGrowth:SetText( growthInfo );
            end
            
            Controls.AmenityAdvice:SetText(data.AmenityAdvice);
    
            g_kAmenitiesIM:ResetInstances();
            local kInstance :table = g_kAmenitiesIM:GetInstance();
            kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_LUXURIES") );
            kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromLuxuries) );
            
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_CIVICS") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_CIVICS") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromCivics) );
            end
            
            kInstance = g_kAmenitiesIM:GetInstance();
            kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_ENTERTAINMENT") );
            kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromEntertainment) );
                
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_GREAT_PEOPLE") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_GREAT_PEOPLE") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromGreatPeople) );
            end
    
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_CITY_STATES") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_CITY_STATES") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromCityStates) );
            end
    
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_RELIGION") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_RELIGION") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromReligion) );
            end
    
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_NATIONAL_PARKS") then
                if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_NATIONAL_PARKS") then
                    kInstance = g_kAmenitiesIM:GetInstance();
                    kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_NATIONAL_PARKS") );
                    kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromNationalParks) );
                end
            end
    
            if(data.AmenitiesFromStartingEra > 0) then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_STARTING_ERA") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromStartingEra) );
            end
            
            if(data.AmenitiesFromImprovements > 0) then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_IMPROVEMENTS") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromImprovements) );
            end
    
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_WAR_WEARINESS") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_LOST_FROM_WAR_WEARINESS") );
                if data.AmenitiesLostFromWarWeariness == 0 then
                    kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesLostFromWarWeariness) );
                else
                    kInstance.AmenityYield:SetText( Locale.ToNumber(-data.AmenitiesLostFromWarWeariness) );
                end
            end
    
            if GameCapabilities.HasCapability("CAPABILITY_CITY_HUD_AMENITIES_BANKRUPTCY") then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_LOST_FROM_BANKRUPTCY") );
                if data.AmenitiesLostFromBankruptcy == 0 then
                    kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesLostFromBankruptcy) );
                else
                    kInstance.AmenityYield:SetText( Locale.ToNumber(-data.AmenitiesLostFromBankruptcy) );
                end
            end
    
            data.AmenitiesFromDistricts = data.AmenitiesFromDistricts or 0;
            if(data.AmenitiesFromDistricts > 0) then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_DISTRICTS") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromDistricts) );
            end
    
            data.AmenitiesFromNaturalWonders = data.AmenitiesFromNaturalWonders or 0;
            if(data.AmenitiesFromNaturalWonders > 0) then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_NATURAL_WONDERS") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromNaturalWonders) );
            end
    
            data.AmenitiesFromTraits = data.AmenitiesFromTraits or 0;
            if(data.AmenitiesFromTraits > 0) then
                kInstance = g_kAmenitiesIM:GetInstance();
                kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_FROM_TRAITS") );
                kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromTraits) );
            end
    
            Controls.AmenitiesRequiredNum:SetText( Locale.ToNumber(data.AmenitiesRequiredNum) );
            Controls.CitizenGrowthStatus:SetTextureOffsetVal( UV_CITIZEN_GROWTH_STATUS[data.Happiness].u, UV_CITIZEN_GROWTH_STATUS[data.Happiness].v );
            Controls.CitizenGrowthStatusIcon:SetColorByName( colorName );
    
            kInstance = g_kAmenitiesIM:GetInstance();
            kInstance.Amenity:SetText( Locale.Lookup("LOC_HUD_CITY_AMENITIES_LOST_FROM_GOVERNORS") );
            kInstance.AmenityYield:SetText( Locale.ToNumber(data.AmenitiesFromGovernors) );
        end);
        
        print("City Panel: ", status);
        if err then
            print(err);
            lastErr = err;
        end
    
    end
    
    print("Injected");
    The code is the Lua code for the other person's mod mentioned above.
    I changed the "UV_CITIZEN_GROWTH_STATUS[7] = {u=0, v=250}; -- utopia" at the top with both of my levels (the second at v=300).
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,630
    Location:
    Illinois, USA
    Unfortunately you need to replace a User Interface file with your custom version instead of adding a new GameplayScript to your mod. So my example does you no good since it is showing how to add a new GameplayScript to the game rather than how to replace an existing User Interface Script.

    You need an ImportFiles type of action instead of an AddGameplayScript type of action.

    The end product in your modinfo file needs to look like this:
    Code:
        <ImportFiles id="LUA_Replacers">
          <Properties>
            <LoadOrder>150000</LoadOrder>
          </Properties>
          <File>LUA/Replacers/CityPanelOverview.lua</File>
          <File>LUA/Replacers/ProductionPanel.lua</File>
        </ImportFiles>
    Instead of like this:
    Code:
        <AddGameplayScripts id="DummyUnlockerBuildingsScript">
          <File>LUA/GameplayScripts/DummyUnlockerBuildingsScript.lua</File>
        </AddGameplayScripts>
    --------------

    There is also a "ReplaceUIScript" type of action but for the most part it is not needed by mods.
     
    Last edited: Oct 26, 2019
  5. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Thank you so much LeeS. You are always a great help. A few questions for you though.
    So, I decided to use the "ReplaceUIScript" action type in ModBuddy,
    Reason being: I'm assuming the syntax you are suggesting I replace is in the mysterious ".modinfo" file?
    I do not have one of those. Is that suppose to be that way? It isn't in my mods directory at all. Am I missing something?

    EDIT: The game wouldn't load. I looked at the "UserInterface.log" file to see if there is a specific error referencing my mod but I didn't see anything (though to be fair, I'm not sure what I'm looking for). I'll post the output.

    Code:
    ForgeUI started up!
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'TutorialOverlay'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'ToolTips'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'DebugPanel'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'IntroScreen'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    START  LuaContext::Initialize() id: 'DebugHotloadCache'        parent: 'DebugContext'        Context: 'DebugContext'
    DebugHotloadCache: register time: 0.002540
    DebugHotloadCache: ControlBase::Initialize time: 0.000001
    DebugHotloadCache: Load Lua time: 0.025830
    END    LuaContext::Initialize() id: 'DebugHotloadCache'
    END   ContextBase::Initialize() id: 'DebugContext'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'DebugViewer'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    END   ContextBase::Initialize() id: 'SubtitleContext'
    START ContextBase::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    START  LuaContext::Initialize() id: 'Intro'        parent: 'StartupScreen'        Context: 'StartupScreen'
    IntroScreen: register time: 0.001379
    IntroScreen: ControlBase::Initialize time: 0.001120
    IntroScreen: Load Lua time: 0.091581
    END    LuaContext::Initialize() id: 'Intro'
    END   ContextBase::Initialize() id: 'StartupScreen'
    START  LuaContext::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    FrontEnd: register time: 0.000288
    START  LuaContext::Initialize() id: 'MainMenu'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    MainMenu: register time: 0.000393
    START  LuaContext::Initialize() id: 'Options'        parent: 'MainMenu'        Context: 'MainMenu'
    Options: register time: 0.000817
    Options: ControlBase::Initialize time: 0.008266
    Options: Load Lua time: 0.357879
    END    LuaContext::Initialize() id: 'Options'
    START  LuaContext::Initialize() id: 'ModsContext'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'AdvancedSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'ScenarioSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'CreditsScreen'        parent: 'MainMenu'        Context: 'MainMenu'
    CreditsScreen: register time: 0.000310
    CreditsScreen: ControlBase::Initialize time: 0.000080
    CreditsScreen: Load Lua time: 0.028989
    END    LuaContext::Initialize() id: 'CreditsScreen'
    START  LuaContext::Initialize() id: 'My2K'        parent: 'MainMenu'        Context: 'MainMenu'
    My2K: register time: 0.000283
    My2K: ControlBase::Initialize time: 0.000002
    My2K: Load Lua time: 0.006592
    END    LuaContext::Initialize() id: 'My2K'
    START  LuaContext::Initialize() id: 'WorldBuilder'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'HallofFame'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'TutorialSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'Lobby'        parent: 'MainMenu'        Context: 'MainMenu'
    Lobby: register time: 0.001277
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'Lobby'        Context: 'Lobby'
    LoadGameMenu: register time: 0.001273
    LoadGameMenu: ControlBase::Initialize time: 0.012105
    LoadGameMenu: Load Lua time: 0.074940
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'PBCNotifyRemind'        parent: 'Lobby'        Context: 'Lobby'
    PBCNotifyRemind: register time: 0.000876
    PBCNotifyRemind: ControlBase::Initialize time: 0.001237
    PBCNotifyRemind: Load Lua time: 0.016669
    END    LuaContext::Initialize() id: 'PBCNotifyRemind'
    Lobby: ControlBase::Initialize time: 0.536934
    Lobby: Load Lua time: 0.062256
    END    LuaContext::Initialize() id: 'Lobby'
    START  LuaContext::Initialize() id: 'HostGame'        parent: 'MainMenu'        Context: 'MainMenu'
    HostGame: register time: 0.000498
    START  LuaContext::Initialize() id: 'ModsMenu'        parent: 'HostGame'        Context: 'HostGame'
    Mods: register time: 0.000697
    Mods: ControlBase::Initialize time: 0.005562
    Mods: Load Lua time: 0.116944
    END    LuaContext::Initialize() id: 'ModsMenu'
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'HostGame'        Context: 'HostGame'
    LoadGameMenu: register time: 0.002170
    LoadGameMenu: ControlBase::Initialize time: 0.000998
    LoadGameMenu: Load Lua time: 0.036260
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'SaveGameMenu'        parent: 'HostGame'        Context: 'HostGame'
    SaveGameMenu: register time: 0.000792
    SaveGameMenu: ControlBase::Initialize time: 0.000645
    SaveGameMenu: Load Lua time: 0.015827
    END    LuaContext::Initialize() id: 'SaveGameMenu'
    HostGame: ControlBase::Initialize time: 0.476815
    HostGame: Load Lua time: 0.040561
    END    LuaContext::Initialize() id: 'HostGame'
    START  LuaContext::Initialize() id: 'StagingRoom'        parent: 'MainMenu'        Context: 'MainMenu'
    StagingRoom: register time: 0.000614
    START  LuaContext::Initialize() id: 'ConfirmKick'        parent: 'StagingRoom'        Context: 'StagingRoom'
    ConfirmKick: register time: 0.000432
    ConfirmKick: ControlBase::Initialize time: 0.000027
    ConfirmKick: Load Lua time: 0.022321
    END    LuaContext::Initialize() id: 'ConfirmKick'
    START  LuaContext::Initialize() id: 'EditHotseatPlayer'        parent: 'StagingRoom'        Context: 'StagingRoom'
    EditHotseatPlayer: register time: 0.000489
    EditHotseatPlayer: ControlBase::Initialize time: 0.000589
    EditHotseatPlayer: Load Lua time: 0.023090
    END    LuaContext::Initialize() id: 'EditHotseatPlayer'
    StagingRoom: ControlBase::Initialize time: 0.088861
    StagingRoom: Load Lua time: 0.076207
    END    LuaContext::Initialize() id: 'StagingRoom'
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'MainMenu'        Context: 'MainMenu'
    LoadGameMenu: register time: 0.000394
    LoadGameMenu: ControlBase::Initialize time: 0.001993
    LoadGameMenu: Load Lua time: 0.015599
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'SaveGameMenu'        parent: 'MainMenu'        Context: 'MainMenu'
    SaveGameMenu: register time: 0.000587
    SaveGameMenu: ControlBase::Initialize time: 0.000330
    SaveGameMenu: Load Lua time: 0.006357
    END    LuaContext::Initialize() id: 'SaveGameMenu'
    START  LuaContext::Initialize() id: 'FrontEndPopup'        parent: 'MainMenu'        Context: 'MainMenu'
    FrontEndPopup: register time: 0.000422
    FrontEndPopup: ControlBase::Initialize time: 0.000027
    FrontEndPopup: Load Lua time: 0.030243
    END    LuaContext::Initialize() id: 'FrontEndPopup'
    START  LuaContext::Initialize() id: 'CivRoyaleIntro'        parent: 'MainMenu'        Context: 'MainMenu'
    CivRoyaleIntro: register time: 0.000302
    CivRoyaleIntro: ControlBase::Initialize time: 0.000072
    CivRoyaleIntro: Load Lua time: 0.004902
    END    LuaContext::Initialize() id: 'CivRoyaleIntro'
    MainMenu: ControlBase::Initialize time: 2.430828
    MainMenu: Load Lua time: 0.142856
    END    LuaContext::Initialize() id: 'MainMenu'
    START  LuaContext::Initialize() id: 'JoiningRoom'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    JoiningRoom: register time: 0.001116
    JoiningRoom: ControlBase::Initialize time: 0.000224
    JoiningRoom: Load Lua time: 0.003157
    END    LuaContext::Initialize() id: 'JoiningRoom'
    START  LuaContext::Initialize() id: 'UserSetupWarning'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    UserSetupWarning: register time: 0.001814
    UserSetupWarning: ControlBase::Initialize time: 0.000058
    UserSetupWarning: Load Lua time: 0.045511
    END    LuaContext::Initialize() id: 'UserSetupWarning'
    START  LuaContext::Initialize() id: 'Test'        parent: ''        Context: 'FrontEnd'
    Test: register time: 0.002360
    Test: ControlBase::Initialize time: 0.000003
    Test: Load Lua time: 0.007137
    END    LuaContext::Initialize() id: 'Test'
    FrontEnd: ControlBase::Initialize time: 2.958199
    FrontEnd: Load Lua time: 0.085992
    END    LuaContext::Initialize() id: 'FrontEnd'
    START  LuaContext::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    LoadScreen: register time: 0.000308
    LoadScreen: ControlBase::Initialize time: 0.002835
    LoadScreen: Load Lua time: 0.060335
    END    LuaContext::Initialize() id: 'LoadScreen'
    
    NumBlocks:   1
    Allocated: 4.00 mb, Used: 4.00 mb, Free: 0.00 mb
    
    NumControls: 2760
    
    ControlBase Size: 200
    
    Active,         Total,         Object Size,         Total Size         Name
       24,            313,            352,             110176,          StackControl
       29,            311,            560,             174160,          GridControl
        0,              2,           2080,               4160,          TextButtonControl
        6,             12,            544,               6528,          UIString512
        0,              1,            800,                800,          MeterControl
       22,             28,            496,              13888,          ButtonControl
        0,              2,             64,                128,          UIMaskInfo
        0,             24,            288,               6912,          UIString256
        2,             14,           1232,              17248,          EditBoxControl
        0,             52,           2448,             127296,          PullDownControl
        1,              1,            304,                304,          ListBoxControl
        1,             38,            368,              13984,          LineControl
        6,            176,            208,              36608,          ControlBase
        0,              3,            160,                480,          UIString128
        5,            101,            224,              22624,          ColorBoxControl
        1,             29,           3696,             107184,          LuaContext
       11,            101,           1552,             156752,          SliderControl
       85,           1356,             96,             130176,          ControlChildList
        0,              3,             96,                288,          UIString64
        1,             49,            384,              18816,          SlideAnim
        1,            134,            384,              51456,          AlphaAnim
       13,             45,            448,              20160,          ScrollPanelControl
        0,              1,            224,                224,          PlatformControl
        2,              3,           2960,               8880,          ContextBase
        4,            164,            368,              60352,          ImageControl
       19,             30,           3200,              96000,          CheckBoxControl
        0,              1,            208,                208,          GroupControl
        1,            357,            944,             337008,          GridButtonControl
       95,            764,            400,             305600,          TextControl
        0,              1,           1600,               1600,          MovieControl
        2,              2,            784,               1568,          GraphControl
    
    Num Child Nodes: 286
    
    Child Node distribution
      202 nodes have     0 children
       47 nodes have     1 children
       18 nodes have     2 children
        7 nodes have     3 children
        1 nodes have     4 children
        5 nodes have     5 children
        3 nodes have    11 children
        1 nodes have    16 children
        1 nodes have    20 children
        1 nodes have    26 children
    
    Controls ID distribution
      121 nodes have control IDs with     0 characters
        3 nodes have control IDs with     2 characters
       16 nodes have control IDs with     4 characters
        1 nodes have control IDs with     5 characters
        5 nodes have control IDs with     7 characters
       13 nodes have control IDs with     8 characters
       11 nodes have control IDs with     9 characters
       17 nodes have control IDs with    10 characters
       24 nodes have control IDs with    11 characters
       15 nodes have control IDs with    12 characters
        6 nodes have control IDs with    13 characters
        9 nodes have control IDs with    14 characters
        9 nodes have control IDs with    15 characters
        5 nodes have control IDs with    16 characters
        7 nodes have control IDs with    17 characters
        4 nodes have control IDs with    18 characters
        2 nodes have control IDs with    19 characters
        3 nodes have control IDs with    20 characters
        5 nodes have control IDs with    22 characters
        1 nodes have control IDs with    23 characters
        2 nodes have control IDs with    24 characters
        2 nodes have control IDs with    25 characters
        2 nodes have control IDs with    26 characters
        2 nodes have control IDs with    27 characters
        1 nodes have control IDs with    29 characters
    
    Contexts containing controls:
      204 controls in context "DebugContext"
       49 controls in context "[NO CONTEXT]"
       16 controls in context "ToolTips"
       15 controls in context "DebugPanel"
        2 controls in context "DebugViewer"
    START  LuaContext::Initialize() id: ''        parent: 'NULL'        Context: 'NULL'
    FrontEnd: register time: 0.000304
    START  LuaContext::Initialize() id: 'MainMenu'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    MainMenu: register time: 0.000276
    START  LuaContext::Initialize() id: 'Options'        parent: 'MainMenu'        Context: 'MainMenu'
    Options: register time: 0.000393
    Options: ControlBase::Initialize time: 0.005383
    Options: Load Lua time: 0.035757
    END    LuaContext::Initialize() id: 'Options'
    START  LuaContext::Initialize() id: 'ModsContext'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'AdvancedSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'ScenarioSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'CreditsScreen'        parent: 'MainMenu'        Context: 'MainMenu'
    CreditsScreen: register time: 0.000267
    CreditsScreen: ControlBase::Initialize time: 0.000075
    CreditsScreen: Load Lua time: 0.001726
    END    LuaContext::Initialize() id: 'CreditsScreen'
    START  LuaContext::Initialize() id: 'My2K'        parent: 'MainMenu'        Context: 'MainMenu'
    My2K: register time: 0.000256
    My2K: ControlBase::Initialize time: 0.000001
    My2K: Load Lua time: 0.002319
    END    LuaContext::Initialize() id: 'My2K'
    START  LuaContext::Initialize() id: 'WorldBuilder'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'HallofFame'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'TutorialSetup'        parent: 'MainMenu'        Context: 'MainMenu'
    START  LuaContext::Initialize() id: 'Lobby'        parent: 'MainMenu'        Context: 'MainMenu'
    Lobby: register time: 0.000808
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'Lobby'        Context: 'Lobby'
    LoadGameMenu: register time: 0.001305
    LoadGameMenu: ControlBase::Initialize time: 0.000357
    LoadGameMenu: Load Lua time: 0.020237
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'PBCNotifyRemind'        parent: 'Lobby'        Context: 'Lobby'
    PBCNotifyRemind: register time: 0.001051
    PBCNotifyRemind: ControlBase::Initialize time: 0.001224
    PBCNotifyRemind: Load Lua time: 0.000725
    END    LuaContext::Initialize() id: 'PBCNotifyRemind'
    Lobby: ControlBase::Initialize time: 0.028375
    Lobby: Load Lua time: 0.014612
    END    LuaContext::Initialize() id: 'Lobby'
    START  LuaContext::Initialize() id: 'HostGame'        parent: 'MainMenu'        Context: 'MainMenu'
    HostGame: register time: 0.000465
    START  LuaContext::Initialize() id: 'ModsMenu'        parent: 'HostGame'        Context: 'HostGame'
    Mods: register time: 0.000509
    Mods: ControlBase::Initialize time: 0.001419
    Mods: Load Lua time: 0.008244
    END    LuaContext::Initialize() id: 'ModsMenu'
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'HostGame'        Context: 'HostGame'
    LoadGameMenu: register time: 0.000585
    LoadGameMenu: ControlBase::Initialize time: 0.000276
    LoadGameMenu: Load Lua time: 0.014464
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'SaveGameMenu'        parent: 'HostGame'        Context: 'HostGame'
    SaveGameMenu: register time: 0.000330
    SaveGameMenu: ControlBase::Initialize time: 0.000468
    SaveGameMenu: Load Lua time: 0.005332
    END    LuaContext::Initialize() id: 'SaveGameMenu'
    HostGame: ControlBase::Initialize time: 0.038928
    HostGame: Load Lua time: 0.021180
    END    LuaContext::Initialize() id: 'HostGame'
    START  LuaContext::Initialize() id: 'StagingRoom'        parent: 'MainMenu'        Context: 'MainMenu'
    StagingRoom: register time: 0.000387
    START  LuaContext::Initialize() id: 'ConfirmKick'        parent: 'StagingRoom'        Context: 'StagingRoom'
    ConfirmKick: register time: 0.000425
    ConfirmKick: ControlBase::Initialize time: 0.000023
    ConfirmKick: Load Lua time: 0.002969
    END    LuaContext::Initialize() id: 'ConfirmKick'
    START  LuaContext::Initialize() id: 'EditHotseatPlayer'        parent: 'StagingRoom'        Context: 'StagingRoom'
    EditHotseatPlayer: register time: 0.000486
    EditHotseatPlayer: ControlBase::Initialize time: 0.000254
    EditHotseatPlayer: Load Lua time: 0.000734
    END    LuaContext::Initialize() id: 'EditHotseatPlayer'
    StagingRoom: ControlBase::Initialize time: 0.007375
    StagingRoom: Load Lua time: 0.029195
    END    LuaContext::Initialize() id: 'StagingRoom'
    START  LuaContext::Initialize() id: 'LoadGameMenu'        parent: 'MainMenu'        Context: 'MainMenu'
    LoadGameMenu: register time: 0.000331
    LoadGameMenu: ControlBase::Initialize time: 0.000260
    LoadGameMenu: Load Lua time: 0.013347
    END    LuaContext::Initialize() id: 'LoadGameMenu'
    START  LuaContext::Initialize() id: 'SaveGameMenu'        parent: 'MainMenu'        Context: 'MainMenu'
    SaveGameMenu: register time: 0.000283
    SaveGameMenu: ControlBase::Initialize time: 0.000324
    SaveGameMenu: Load Lua time: 0.005295
    END    LuaContext::Initialize() id: 'SaveGameMenu'
    START  LuaContext::Initialize() id: 'FrontEndPopup'        parent: 'MainMenu'        Context: 'MainMenu'
    FrontEndPopup: register time: 0.000280
    FrontEndPopup: ControlBase::Initialize time: 0.000024
    FrontEndPopup: Load Lua time: 0.002649
    END    LuaContext::Initialize() id: 'FrontEndPopup'
    START  LuaContext::Initialize() id: 'CivRoyaleIntro'        parent: 'MainMenu'        Context: 'MainMenu'
    CivRoyaleIntro: register time: 0.000260
    CivRoyaleIntro: ControlBase::Initialize time: 0.000053
    CivRoyaleIntro: Load Lua time: 0.000624
    END    LuaContext::Initialize() id: 'CivRoyaleIntro'
    MainMenu: ControlBase::Initialize time: 0.229332
    MainMenu: Load Lua time: 0.077044
    END    LuaContext::Initialize() id: 'MainMenu'
    START  LuaContext::Initialize() id: 'JoiningRoom'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    JoiningRoom: register time: 0.001062
    JoiningRoom: ControlBase::Initialize time: 0.000063
    JoiningRoom: Load Lua time: 0.001197
    END    LuaContext::Initialize() id: 'JoiningRoom'
    START  LuaContext::Initialize() id: 'UserSetupWarning'        parent: 'FrontEndContainer'        Context: 'FrontEnd'
    UserSetupWarning: register time: 0.000951
    UserSetupWarning: ControlBase::Initialize time: 0.000026
    UserSetupWarning: Load Lua time: 0.003142
    END    LuaContext::Initialize() id: 'UserSetupWarning'
    START  LuaContext::Initialize() id: 'Test'        parent: ''        Context: 'FrontEnd'
    Test: register time: 0.001236
    Test: ControlBase::Initialize time: 0.000002
    Test: Load Lua time: 0.003439
    END    LuaContext::Initialize() id: 'Test'
    FrontEnd: ControlBase::Initialize time: 0.321758
    FrontEnd: Load Lua time: 0.017934
    END    LuaContext::Initialize() id: 'FrontEnd'
    [1572183472002] (SHUTDOWN) ===============================
    
    NumBlocks:   1
    Allocated: 4.00 mb, Used: 4.00 mb, Free: 0.00 mb
    
    NumControls: 2761
    
    ControlBase Size: 200
    
    Active,         Total,         Object Size,         Total Size         Name
        5,            314,            352,             110528,          StackControl
        8,            311,            560,             174160,          GridControl
        0,              2,           2080,               4160,          TextButtonControl
        3,             12,            544,               6528,          UIString512
        0,              1,            800,                800,          MeterControl
        2,             28,            496,              13888,          ButtonControl
        0,              2,             64,                128,          UIMaskInfo
        0,             24,            288,               6912,          UIString256
        1,             14,           1232,              17248,          EditBoxControl
        0,             52,           2448,             127296,          PullDownControl
        0,              1,            304,                304,          ListBoxControl
        1,             38,            368,              13984,          LineControl
        2,            176,            208,              36608,          ControlBase
        0,              3,            160,                480,          UIString128
        4,            101,            224,              22624,          ColorBoxControl
        0,             29,           3696,             107184,          LuaContext
        1,            101,           1552,             156752,          SliderControl
       18,           1356,             96,             130176,          ControlChildList
        0,              3,             96,                288,          UIString64
        1,             49,            384,              18816,          SlideAnim
        1,            134,            384,              51456,          AlphaAnim
        1,             45,            448,              20160,          ScrollPanelControl
        0,              1,            224,                224,          PlatformControl
        1,              3,           2960,               8880,          ContextBase
        3,            164,            368,              60352,          ImageControl
        2,             30,           3200,              96000,          CheckBoxControl
        0,              1,            208,                208,          GroupControl
        0,            357,            944,             337008,          GridButtonControl
        4,            764,            400,             305600,          TextControl
        0,              1,           1600,               1600,          MovieControl
        0,              2,            784,               1568,          GraphControl
    
    Num Child Nodes: 43
    
    Child Node distribution
       26 nodes have     0 children
        9 nodes have     1 children
        3 nodes have     2 children
        4 nodes have     3 children
        1 nodes have     5 children
    
    Controls ID distribution
       13 nodes have control IDs with     0 characters
        3 nodes have control IDs with     2 characters
        1 nodes have control IDs with     7 characters
        5 nodes have control IDs with     8 characters
        3 nodes have control IDs with     9 characters
        5 nodes have control IDs with    10 characters
        6 nodes have control IDs with    11 characters
        3 nodes have control IDs with    12 characters
        2 nodes have control IDs with    13 characters
        1 nodes have control IDs with    17 characters
        1 nodes have control IDs with    19 characters
    
    Contexts containing controls:
       16 controls in context "ToolTips"
       15 controls in context "DebugPanel"
       10 controls in context "[NO CONTEXT]"
        2 controls in context "DebugViewer"
    ForgeUI shutting down.
    
     
    Last edited: Oct 27, 2019
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,630
    Location:
    Illinois, USA
    You would not actually want to use the "ReplaceUIScript" type of action because it will interfere with the methods used by Gathering Storm to update the User Interface "mode" for the city panel details when Gathering Storm is active.

    Spoiler How Firaxis Does This Stuff -- copied from a Discord Chat with another modder :

    You can re-write one function but you have to do like Firaxis does with the GS updates to the Vanilla UI lua files.
    Code:
    <ReplaceUIScript id="Expansion2_CityPanel" criteria="Expansion2">
        <Properties>
                <LuaContext>CityPanel</LuaContext>
                <LuaReplace>UI/Replacements/CityPanel_Expansion2.lua</LuaReplace>
        </Properties>
    </ReplaceUIScript>
    In this example they are replacing the original "CityPanel.lua" file with a new script called "CityPanel_Expansion2.lua". But what they do is add the contents of the original "CityPanel.lua" file into this new "CityPanel_Expansion2.lua" file via what is called an "include" command, and within the text of the "CityPanel_Expansion2.lua" file they add/re-write functions as needed for the Gathering Storm EXPAC

    ---------------------------

    You can also directly replace the content of the "CityPanel.lua" file with a new version with your re-written functions via an "ImportFiles" type of action. Like this:
    Code:
        <ImportFiles id="LUA_Replacers">
          <Properties>
            <LoadOrder>150000</LoadOrder>
          </Properties>
          <File>LUA/Replacers/CityPanelOverview.lua</File>
          <File>LUA/Replacers/ProductionPanel.lua</File>
        </ImportFiles>
    In this example I am re-writing the entire file and adding my new version into the game so that mine replaces the original one the game would want to use.
    Since I am doing it from a mod that contains altered versions of "CityPanelOverview.lua" and "ProductionPanel.lua" I am not actually affecting the contents of the original game-files in any way. I am making my version load over the contents of the original ones in the game's Virtual-Memory File System that lua and dds files get dumped into while the game is running.

    To use the "ImportFiles" method you have to copy the entire original file into your mod and then re-write as necessary. You will be replacing the entire original file when using this method -- you cannot just add only an alterred version of one or two functions within the file.

    This "ImportFiles" method is the one you want to use

    -----------------------------------------------

    Lua works based on the "last definition" method. So if I do this:
    Code:
    function LeesCats()
       print("Cats")
    end
    function LeesCats()
       print("Dogs are not Cats")
    end
    LeesCats()
    I will get the following printed into the game's lua log file:
    Code:
    Dogs are not Cats
    because the second definition of the function over-writes the first.

    -------------------------

    So what Firaxis does with GS updates to Vanilla UI scripts is they dump the contents of the Vanilla lua file into an update file and then re-write any functions they need to for GS.

    In Modbuddy what you want to do is select an Action-Type of "Import Files" rather than "UpdateDatabase", "ReplaceUIScript", or "AddGameplayScripts". I merely mentioned the "ReplaceUIScript" type of action for completeness sake, but you would not want to use it.

    Because of the way files are "Imported" into the game's Virtual File System, all such imports are conducted before any other actions with regard to lua files are conducted. So your custom version of the City Details lua file will be used by the game instead of the usual Vanilla one, and Gathering Storm will automatically also use your version instead of the usual one provided by Firaxis. You just have to make sure you do not rename the actual lua file you are re-writing: you can place your re-written version of CityPanel.lua (for example) in any folder within your mod that you choose when simply providing an altered version of the file via the "ImportFiles" method, but you must not rename the actual file itself. Note that in my example within the spoiler I am using a folder path of
    Code:
    LUA/Replacers/
    Even though this is not the same folder path as used the game it does not matter since when importing files into the Virtual File system all that matters is that the actual file-names are the same.

    The modinfo file is a text xml file created by modbuddy when you "Build" the mod. This file is actually what tells the game what it should do with the files within a mod. What you do in Modbuddy is set-up the files and so forth needed by your mod, and then use Modbuddy's "Build" function to actually generate the mod that the game uses. The modinfo file will not appear anywhere within the Modbuddy project: it only appears in the mod folder that is created by Modbuddy and sent to folder
    Code:
    C:\~~\Documents\My Games\Sid Meier's Civilization VI\Mods
    This mod folder that is created by Modbuddy is the actual mod -- it is here that you would look for the modinfo file. It is often useful to open the modinfo file with Notepad++ or a similar text-editor program to ensure that what you thought you were getting done in Modbuddy is actually what the Modbuddy tool is "doing" when it creates the mod.
     
    Last edited: Oct 27, 2019
  7. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    Several things:
    I suppose one of the parts I'm most confused about is how the mod that I'm using as an example is doing things.
    The mod creators have the following syntax on the top of their lua file, which is named "UtopiaUI.lua" (and not the name of the file it is intended to replace):
    Code:
    include("CityPanelOverview");
    include("CityPanelOverview_Expansion1");
    It also ends with the syntax
    Code:
    print("Injected");
    I assumed this syntax means that the file was intended to replace only the indicated data with those files. Is this not true?
    The "UtopiaUI.lua" file actually doesn't fulling include all of the data of the original "CityPanelOverview.lua". If it WAS intended to fully replace it, it would be missing a lot of information.
    In their mod's .modinfo file, they do have the "UtopiaUI.lua" using the "ImportFiles" action, so that's a good catch. I should have caught that. Thank you.

    Using the information you have given me, I'm going to indicate what I did step by step as I do it to see if it works.
    1. I'm creating two new files and naming them "CityPanelOverview.lua" and "CityPanelOverview_Expansion1.lua" (or at least I was)
    2. It appears that "CityPanelOverview_Expansion1.lua" doesn't have anything to do with what I'm wanting to change, and just includes the "new" loyalty stuff. I'm figuring that, if I keep my LoadOrder low, enough to kick in after the vanilla files but before the expansion files, I should be fine (if I'm interpreting how this works correctly). So, I'm just going to work with the "CityPanelOverview.lua" for now.
    3. I go into my "CityPanelOverview.lua" file and copy and paste the syntax from the original file into mine. I then make the changes that I need. Looking at what the mod creators did, it appears only this change is really needed:
    Code:
    local UV_CITIZEN_GROWTH_STATUS        :table = {};
            UV_CITIZEN_GROWTH_STATUS[0] = {u=0, v=0};    -- revolt
            UV_CITIZEN_GROWTH_STATUS[1] = {u=0, v=0};    -- unrest
            UV_CITIZEN_GROWTH_STATUS[2] = {u=0, v=0};    -- unhappy
            UV_CITIZEN_GROWTH_STATUS[3] = {u=0, v=50};   -- displeased
            UV_CITIZEN_GROWTH_STATUS[4] = {u=0, v=100};  -- content (normal)
            UV_CITIZEN_GROWTH_STATUS[5] = {u=0, v=150};  -- happy
            UV_CITIZEN_GROWTH_STATUS[6] = {u=0, v=200};  -- ecstatic
            UV_CITIZEN_GROWTH_STATUS[7] = {u=0, v=250};  -- euphoric
            UV_CITIZEN_GROWTH_STATUS[8] = {u=0, v=300};  -- actualized
    The last two levels are my additions (both the "euphoric" and "actualized" levels). I noticed that, for the most part, this is the only change from the other creator's mod's file from the original.
    Also, for the sake of completion, I'm going to include the syntax of the other files that are part of my mod.
    Code:
    <GameInfo>
        <Types>
            <Row Type="HAPPINESS_EUPHORIC" Kind="KIND_HAPPINESS"/>
            <Row Type="HAPPINESS_ACTUALIZED" Kind="KIND_HAPPINESS"/>
        </Types>
        <Happinesses>
            <Replace HappinessType="HAPPINESS_ECSTATIC" Name="LOC_HAPPINESS_ECSTATIC_NAME" MinimumAmenityScore="3" MaximumAmenityScore="5" GrowthModifier="20" NonFoodYieldModifier="10" RebellionPoints="-1"/>
            <Row HappinessType="HAPPINESS_EUPHORIC" Name="LOC_HAPPINESS_HAPPY_NAME" MinimumAmenityScore="6" MaximumAmenityScore="9" GrowthModifier="40" NonFoodYieldModifier="20" RebellionPoints="-1"/>
            <Row HappinessType="HAPPINESS_ACTUALIZED" Name="LOC_HAPPINESS_ECSTATIC_NAME" MinimumAmenityScore="10" GrowthModifier="80" NonFoodYieldModifier="40" RebellionPoints="-1"/>
        </Happinesses>
        <Happinesses_XP1>
            <Row HappinessType="HAPPINESS_EUPHORIC" IdentityPerTurnChange="12"/>
            <Row HappinessType="HAPPINESS_ACTUALIZED" IdentityPerTurnChange="24"/>
        </Happinesses_XP1>
    </GameInfo>
    Code:
    <GameData>
        <BaseGameText>
            <!-- Happiness Text. -->
            <Row Tag="LOC_HUD_CITY_STATUS_EUPHORIC">
                <Text>Euphoric!</Text>
            </Row>
            <Row Tag="LOC_HUD_CITY_STATUS_ACTUALIZED">
                <Text>Actualized!</Text>
            </Row>
            <Row Tag="LOC_HAPPINESS_EUPHORIC_NAME">
                <Text>Euphoric</Text>
            </Row>
            <Row Tag="LOC_HAPPINESS_ECSTATIC_ACTUALIZED">
                <Text>Actualized</Text>
            </Row>
        </BaseGameText>
    </GameData>
    The gameplay code (first batch) DOES work, because the bonuses have been displayed ingame.
    Of course, since the display isn't working, I can't fully test to see if the text works.
    4. I removed my previous lua file and added my "CityPanelOverview.lua" to the "ImportFiles" action. I've also removed the LoadOrder, hoping that it will kick in after the vanilla files but before the expansion files.
    5. I saved, rebuilt, and built the mod. About to load a game with just this mod.
    6. The game loaded (surprisingly). I got +34 amenities (using a cheat mod) and the panel actually opened (which it has never done before), HOWEVER...
    7. The gameplay changes are being listed (+80% growth, +40% non-food yields, etc.), but the panel still says "Status: Ecstatic" rather than "Actualized" as it should.
    8. I use Notepad++ to search for every file in the games UI folders (vanilla, expansion1, and expansion2) for the syntax "UV_CITIZEN_GROWTH_STATUS"
    9. I find that there is a file "CityPanel.lua" that has the same section of information as the "CityPanelOverview.lua".
    10. I make a new lua file and name it "CityPanel.lua". I copy the entire original file, paste the contents into my file, add the two lines of syntax with my happiness levels, add the lua file to the ImportFile actions, save, rebuild, Build, and try it again.
    11. Same thing, still only says "Ecstatic".

    So, its still not working but I feel like I'm missing something.
     
  8. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    I'm sorry to bump this LeeS, but I was hoping you could look at this one last time and see if you can point out what I did wrong.

    EDIT: One thing I also wanted to mention is that if the Amenities are between +6 and +9, it says Happy.
    So, it seems as though it is bouncing bacl to the Happy label for 6-9 and then going back up to Ecstatic for 10+... I'm not sure what that means...
     
    Last edited: Nov 5, 2019
  9. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,630
    Location:
    Illinois, USA
    Code:
        <Happinesses>
            <Replace HappinessType="HAPPINESS_ECSTATIC" Name="LOC_HAPPINESS_ECSTATIC_NAME" MinimumAmenityScore="3" MaximumAmenityScore="5" GrowthModifier="20" NonFoodYieldModifier="10" RebellionPoints="-1"/>
            <Row HappinessType="HAPPINESS_EUPHORIC" Name="LOC_HAPPINESS_HAPPY_NAME" MinimumAmenityScore="6" MaximumAmenityScore="9" GrowthModifier="40" NonFoodYieldModifier="20" RebellionPoints="-1"/>
            <Row HappinessType="HAPPINESS_ACTUALIZED" Name="LOC_HAPPINESS_ECSTATIC_NAME" MinimumAmenityScore="10" GrowthModifier="80" NonFoodYieldModifier="40" RebellionPoints="-1"/>
        </Happinesses>
    
    You need to fix the "Name" issues here first (assuming you have not already done so) before you can really proceed further. Your code is telling the game to use the "Name" for "Happy" when the status is "Euphoric", and to use the "Name" for "Ecstatic" when the status is "Actualized".
     
  10. SocialMechanic

    SocialMechanic Chieftain

    Joined:
    May 11, 2019
    Messages:
    88
    OMG I feel like a FREAKING IDIOT!!!!! Thank you so much. THAT DID IT!!!
     

Share This Page