|
local UEHelpers = require("UEHelpers") |
|
|
|
local GetKismetSystemLibrary = UEHelpers.GetKismetSystemLibrary |
|
|
|
local ksl = GetKismetSystemLibrary() |
|
local engine = FindFirstOf("Engine") |
|
local canExecute = true |
|
|
|
-- mod settings, change these to your liking |
|
local HDROut = false -- Enable 10bit HDR Output, requires HDR enabled in Windows settings |
|
local VSM = true -- Enable Virtual Shadow maps, more crisp and accurate shadows |
|
local disableStreaming = true -- Disables textures streaming. Loads all texture assets on level load to reduce CPU overhead with a cost of memory usage. Requires 8GB or better. |
|
local lowSpecMode = false -- Enable ultra low quality mode for low spec hardware, run the game with "-dx11" |
|
|
|
-- from now on do not touch |
|
|
|
--- @param cmd string |
|
function ExecCmd(cmd) |
|
if not ksl:IsValid() then |
|
error("KismetSystemLibrary not valid\n") |
|
end |
|
|
|
ExecuteInGameThread(function() |
|
ksl:ExecuteConsoleCommand( |
|
engine, |
|
cmd, |
|
nil |
|
) |
|
end) |
|
end |
|
|
|
function getConsoleVar(cmd) |
|
local value |
|
if not ksl:IsValid() then |
|
error("KismetSystemLibrary not valid\n") |
|
end |
|
value = ksl:GetConsoleVariableIntValue(cmd) |
|
return value |
|
end |
|
|
|
function ExecuteDelayedFix() |
|
if not canExecute then |
|
return |
|
end |
|
|
|
canExecute = false |
|
|
|
local delay = 50 |
|
|
|
while delay < 500 do |
|
ExecuteWithDelay(delay, function() |
|
if HDROut == true then |
|
if getConsoleVar("r.AllowHDR") ~= 1 then ExecCmd("r.AllowHDR 1") end |
|
if getConsoleVar("r.HDR.EnableHDROutput") ~= 1 then ExecCmd("r.HDR.EnableHDROutput 1") end |
|
if getConsoleVar("r.HDR.Display.OutputDevice") ~= 3 then ExecCmd("r.HDR.Display.OutputDevice 3") end |
|
if getConsoleVar("r.HDR.Display.ColorGamut") ~= 4 then ExecCmd("r.HDR.Display.ColorGamut 4") end |
|
if getConsoleVar("r.HDR.UI.CompositeMode") ~= 1 then ExecCmd("r.HDR.UI.CompositeMode 1") end |
|
if getConsoleVar("r.HDR.UI.Level") ~= 1 then ExecCmd("r.HDR.UI.Level 1") end |
|
end |
|
if VSM == true then |
|
if getConsoleVar("r.Shadow.Virtual.Enable") ~= 1 then ExecCmd("r.Shadow.Virtual.Enable 1") end |
|
if getConsoleVar("r.Shadow.Virtual.Cache") ~= 1 then ExecCmd("r.Shadow.Virtual.Cache 1") end |
|
if getConsoleVar("r.Shadow.Virtual.Cache.StaticSeparate") ~= 1 then ExecCmd("r.Shadow.Virtual.Cache.StaticSeparate 1") end |
|
if getConsoleVar("r.Shadow.Virtual.UseFarShadowCulling") ~= 1 then ExecCmd("r.Shadow.Virtual.UseFarShadowCulling 1") end |
|
if getConsoleVar("r.Shadow.Virtual.SMRT.TexelDitherScaleLocal") ~= 8 then ExecCmd("r.Shadow.Virtual.SMRT.TexelDitherScaleLocal 8") end |
|
end |
|
if disableStreaming == true then |
|
if getConsoleVar("r.TextureStreaming") ~= 0 then ExecCmd("r.TextureStreaming 0") end |
|
end |
|
if lowSpecMode == true then |
|
if getConsoleVar("r.AllowPrecomputedVisibility") ~= 0 then ExecCmd("r.AllowPrecomputedVisibility 0") end |
|
if getConsoleVar("r.AllowSimpleLights") ~= 0 then ExecCmd("r.AllowSimpleLights 0") end |
|
if getConsoleVar("r.AllowStaticLighting") ~= 0 then ExecCmd("r.AllowStaticLighting 0") end |
|
if getConsoleVar("r.AOQuality") ~= 0 then ExecCmd("r.AOQuality 0") end |
|
if getConsoleVar("r.BloomQuality") ~= 0 then ExecCmd("r.BloomQuality 0") end |
|
if getConsoleVar("r.ContactShadows") ~= 0 then ExecCmd("r.ContactShadows 0") end |
|
if getConsoleVar("r.DetailMode") ~= 0 then ExecCmd("r.DetailMode 0") end |
|
if getConsoleVar("r.DisableLODFade") ~= 1 then ExecCmd("r.DisableLODFade 1") end |
|
if getConsoleVar("r.DistanceFields") ~= 0 then ExecCmd("r.DistanceFields 0") end |
|
if getConsoleVar("r.EarlyZPass") ~= 0 then ExecCmd("r.EarlyZPass 0") end |
|
if getConsoleVar("r.Fog") ~= 0 then ExecCmd("r.Fog 0") end |
|
if getConsoleVar("r.HLOD") ~= 0 then ExecCmd("r.HLOD 0") end |
|
if getConsoleVar("r.ShadowQuality") ~= 0 then ExecCmd("r.ShadowQuality 0") end |
|
if getConsoleVar("r.SkyAtmosphere") ~= 0 then ExecCmd("r.SkyAtmosphere 0") end |
|
if getConsoleVar("r.StaticMeshLODDistanceScale") ~= 5 then ExecCmd("r.StaticMeshLODDistanceScale 5") end |
|
if getConsoleVar("r.Streaming.MipBias") ~= 4 then ExecCmd("r.Streaming.MipBias 4") end |
|
if getConsoleVar("r.Streaming.PoolSize") ~= 1 then ExecCmd("r.Streaming.PoolSize 1") end |
|
if getConsoleVar("r.Streaming.FullyLoadUsedTextures") ~= 0 then ExecCmd("r.Streaming.FullyLoadUsedTextures 0") end |
|
if getConsoleVar("r.ViewDistanceScale") ~= 0.4 then ExecCmd("r.ViewDistanceScale 0.4") end |
|
end |
|
canExecute = true |
|
end) |
|
delay = delay * 2 |
|
end |
|
end |
|
|
|
NotifyOnNewObject("/Script/Engine.Level", function() |
|
ExecuteDelayedFix() |
|
end) |
|
|
|
--fine adjustments |
|
|
|
RegisterKeyBind(Key.Y, {ModifierKey.ALT}, function() |
|
local tod = FindFirstOf("BP_Sky_C") |
|
if tod:IsValid() then |
|
local startTod = tod["Time of Day"] |
|
startTod = startTod + 3 |
|
if startTod > 2359 then startTod = 0000 end |
|
tod["Time of Day"] = startTod |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.T, {ModifierKey.ALT}, function() |
|
local tod = FindFirstOf("BP_Sky_C") |
|
if tod:IsValid() then |
|
local startTod = tod["Time of Day"] |
|
startTod = startTod - 3 |
|
if startTod < 0 then startTod = 2359 end |
|
tod["Time of Day"] = startTod |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.P, {ModifierKey.ALT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Fog - Manual Override'] ~= true then weather['Fog - Manual Override'] = true end |
|
weather["Fog"] = weather["Fog"] + 0.5 |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.L, {ModifierKey.ALT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Cloud Coverage - Manual Override'] ~= true then weather['Cloud Coverage - Manual Override'] = true end |
|
weather["Cloud Coverage"] = weather["Cloud Coverage"] + 0.1 |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.O, {ModifierKey.ALT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Fog - Manual Override'] ~= true then weather['Fog - Manual Override'] = true end |
|
local startFog = weather["Fog"] |
|
startFog = startFog - 0.5 |
|
if startFog <= 0 then startFog = 0 end |
|
weather["Fog"] = startFog |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.K, {ModifierKey.ALT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Cloud Coverage - Manual Override'] ~= true then weather['Cloud Coverage - Manual Override'] = true end |
|
local startCoverage = weather["Cloud Coverage"] |
|
startCoverage = startCoverage - 0.1 |
|
if startCoverage <= 0 then startCoverage = 0 end |
|
weather["Cloud Coverage"] = startCoverage |
|
end |
|
end) |
|
|
|
--quick adjustments |
|
|
|
RegisterKeyBind(Key.Y, {ModifierKey.SHIFT}, function() |
|
local tod = FindFirstOf("BP_Sky_C") |
|
if tod:IsValid() then |
|
local startTod = tod["Time of Day"] |
|
startTod = startTod + 100 |
|
if startTod > 2359 then startTod = 0000 end |
|
tod["Time of Day"] = startTod |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.T, {ModifierKey.SHIFT}, function() |
|
local tod = FindFirstOf("BP_Sky_C") |
|
if tod:IsValid() then |
|
local startTod = tod["Time of Day"] |
|
startTod = startTod - 100 |
|
if startTod < 0 then startTod = 2359 end |
|
tod["Time of Day"] = startTod |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.P, {ModifierKey.SHIFT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Fog - Manual Override'] ~= true then weather['Fog - Manual Override'] = true end |
|
weather["Fog"] = weather["Fog"] + 2 |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.L, {ModifierKey.SHIFT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Cloud Coverage - Manual Override'] ~= true then weather['Cloud Coverage - Manual Override'] = true end |
|
weather["Cloud Coverage"] = weather["Cloud Coverage"] + 0.5 |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.O, {ModifierKey.SHIFT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Fog - Manual Override'] ~= true then weather['Fog - Manual Override'] = true end |
|
local startFog = weather["Fog"] |
|
startFog = startFog - 2 |
|
if startFog <= 0 then startFog = 0 end |
|
weather["Fog"] = startFog |
|
end |
|
end) |
|
|
|
RegisterKeyBind(Key.K, {ModifierKey.SHIFT}, function() |
|
local actor = FindFirstOf("BP_Sky_C") |
|
local weather = actor['Ultra Dynamic Weather'] |
|
if weather:IsValid() then |
|
if weather['Cloud Coverage - Manual Override'] ~= true then weather['Cloud Coverage - Manual Override'] = true end |
|
local startCoverage = weather["Cloud Coverage"] |
|
startCoverage = startCoverage - 0.5 |
|
if startCoverage <= 0 then startCoverage = 0 end |
|
weather["Cloud Coverage"] = startCoverage |
|
end |
|
end) |
god-level work
do you think it'll be possible to add more weather effects?