Jump to content

Recommended Posts

Posted (edited)

So I'm trying to make a simple script for UE4SS where it does a console command depending on if i'm indoors or outdoors. I have it working but...

Right now it's doing X if indoors and Y if outdoors, my problem is that inside an oblivion gate is considered outdoors and instead i want it to do X as if I was indoors

The code is the following

NotifyOnNewObject("/Script/Altar.AltarCommonGameViewportClient", function(viewPort)
    
    RegisterHook("/Script/Altar.VLevelChangeData:OnFadeToBlackBeginEventReceived", function(context)
        ksl:ExecuteConsoleCommand(engine, "X", nil)
    end)

    RegisterHook("/Script/Altar.VLevelChangeData:OnFadeToGameBeginEventReceived", function(context)        
        local world = viewPort.World:GetFullName()

        if world:find("World/") then
            ksl:ExecuteConsoleCommand(engine, "Y", nil)
        end
    end)
end)

How would i differentiate if outdoors in world or outdoors inside an oblivion gate? 

Edited by Aminados
Posted

While I have absolutely no experience writing script for UE4SS, I believe I see the problem: your script is doing Y for all world spaces and an oblivion gate is technically a world space itself as it has weather (even if it is just a red sky), so you'll have to adjust your script to exclude the oblivion gate world space via keyword and use a "not equal to" command to exclude oblivion gates specifically.

  • 3 weeks later...
Posted

you'll have to do some if/elseif and combo of OR  statements based on parts of the 'world's fullname (the level name)

 

below I use to increase/decrease graphics qualities base on what I define as overworld/city or interior. you can also do a world:find("Oblivion") to focus.

I wrote my slightly different from yours but it exec console commands with more readable meaningful values, but I'm sure you can figure how to adapt for your own purpopse. Hope this makes sense

 

 

    local UEHelpers = require('UEHelpers')
    local ksl = UEHelpers.GetKismetSystemLibrary()
    local engine = UEHelpers.GetEngine()
 
    local function ExecCon(setting)
        for _, command in ipairs(setting) do
            ksl:ExecuteConsoleCommand(engine, command, nil)
        end
    end
 
    -- Scale and preset for dlss
    local low = 0    local medium = 1    local high = 2    local ultra = 3
   -- graphics options commands NOTE the space after coomand
 
    local lumenHW = "Altar.GraphicsOptions.HardwareRaytracingMode "
    local effects = "Altar.GraphicsOptions.EffectsQuality "
    local shadows = "Altar.GraphicsOptions.ShadowQuality "
    local textures = "Altar.GraphicsOptions.TextureQuality "
    local viewDistance = "Altar.GraphicsOptions.ViewDistanceQuality " --apparently barely impacts fps
    local foliage = "Altar.GraphicsOptions.FoliageQuality "
    local globalIllumination ="Altar.GraphicsOptions.GlobalIlluminationQuality "
    local postProcessing = "Altar.GraphicsOptions.PostProcessQuality "
    local reflections = "Altar.GraphicsOptions.ReflectionQuality "
 
    local dlss_DLAA = 2    local dlss_Quality = 4    local dlss_Balanced = 5
    local dlss_Performance = 6    local dlss_UltraPerformance = 7
 
    local dlss = "Altar.DLSS.Quality "
 
    NotifyOnNewObject("/Script/Altar.VOblivionPlayerCharacter", function ()
        RegisterHook("/Script/Altar.VLevelChangeData:OnFadeToGameBeginEventReceived", function()
            -- print("UltraInteriorLowerExterior] hooking VLevelChangeData:OnFadeToGameBeginEventReceived\n")
            local world = UEHelpers.GetWorld():GetFullName()
 
            --overworld
            if world:find("World/L_Tamriel")
                    or world:find("World/L_SEWorld") then
                print("[UltraInteriorLowerExterior] DLSS=Performance, " .. world .. "\n" )
                ExecCon({dlss .. dlss_Performance
                    , shadows .. medium
                    , effects .. high
                    })
            -- cities, ic prison, ic arcane uni
            elseif world:find("World/") then
                print("[UltraInteriorLowerExterior] DLSS=Balanced, " .. world .. "\n" )
                ExecCon({ dlss .. dlss_Balanced
                    , shadows .. ultra
                    , effects .. ultra
                    })
            -- interior
            else
                print("[UltraInteriorLowerExterior] DLSS=Balanced, " .. world .. "\n" )
                ExecCon({ dlss .. dlss_Quality
                    , shadows .. ultra
                    , effects .. ultra
                    })
            end
        end)
 
    end)

 

 

 

 

Posted

sorry, but the forum buggered by formatting

 

hope this is clearer


   

 local UEHelpers = require('UEHelpers')
    local ksl = UEHelpers.GetKismetSystemLibrary()
    local engine = UEHelpers.GetEngine()
 
    local function ExecCon(setting)
        for _, command in ipairs(setting) do
            ksl:ExecuteConsoleCommand(engine, command, nil)
        end
    end
 
    -- Scale and preset for dlss
    local low = 0    local medium = 1    local high = 2    local ultra = 3
   -- graphics options commands NOTE the space after coomand
 
    local lumenHW = "Altar.GraphicsOptions.HardwareRaytracingMode "
    local effects = "Altar.GraphicsOptions.EffectsQuality "
    local shadows = "Altar.GraphicsOptions.ShadowQuality "
    local textures = "Altar.GraphicsOptions.TextureQuality "
    local viewDistance = "Altar.GraphicsOptions.ViewDistanceQuality " --apparently barely impacts fps
    local foliage = "Altar.GraphicsOptions.FoliageQuality "
    local globalIllumination ="Altar.GraphicsOptions.GlobalIlluminationQuality "
    local postProcessing = "Altar.GraphicsOptions.PostProcessQuality "
    local reflections = "Altar.GraphicsOptions.ReflectionQuality "
 
    local dlss_DLAA = 2    local dlss_Quality = 4    local dlss_Balanced = 5
    local dlss_Performance = 6    local dlss_UltraPerformance = 7
 
    local dlss = "Altar.DLSS.Quality "
 
    NotifyOnNewObject("/Script/Altar.VOblivionPlayerCharacter", function ()
        RegisterHook("/Script/Altar.VLevelChangeData:OnFadeToGameBeginEventReceived", function()
            -- print("UltraInteriorLowerExterior] hooking VLevelChangeData:OnFadeToGameBeginEventReceived\n")
            local world = UEHelpers.GetWorld():GetFullName()
 
            --overworld
            if world:find("World/L_Tamriel")
                    or world:find("World/L_SEWorld") then
                print("[UltraInteriorLowerExterior] DLSS=Performance, " .. world .. "\n" )
                ExecCon({dlss .. dlss_Performance
                    , shadows .. medium
                    , effects .. high
                    })
            -- cities, ic prison, ic arcane uni
            elseif world:find("World/") then
                print("[UltraInteriorLowerExterior] DLSS=Balanced, " .. world .. "\n" )
                ExecCon({ dlss .. dlss_Balanced
                    , shadows .. ultra
                    , effects .. ultra
                    })
            -- interior
            else
                print("[UltraInteriorLowerExterior] DLSS=Balanced, " .. world .. "\n" )
                ExecCon({ dlss .. dlss_Quality
                    , shadows .. ultra
                    , effects .. ultra
                    })
            end
        end)
 
    end)

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...