Advertisement
GillianMC

P3R fix rt

Feb 10th, 2024
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. local UEHelpers = require("UEHelpers")
  2.  
  3. local GetKismetSystemLibrary = UEHelpers.GetKismetSystemLibrary
  4.  
  5. local ksl = GetKismetSystemLibrary()
  6. local engine = FindFirstOf("Engine")
  7.  
  8. local canExecute = true
  9. local init = false
  10.  
  11. --- @param cmd string
  12. function ExecCmd(cmd)
  13. if not ksl:IsValid() then
  14. error("KismetSystemLibrary not valid\n")
  15. end
  16.  
  17. ExecuteInGameThread(function()
  18. ksl:ExecuteConsoleCommand(
  19. engine,
  20. cmd,
  21. nil
  22. )
  23. end)
  24. end
  25.  
  26. function Init()
  27. if init then
  28. return
  29. end
  30.  
  31. init = true
  32. LoopAsync(500, function()
  33. ExecCmd("r.RayTracing.Reflections 1")
  34. return false
  35. end)
  36. end
  37.  
  38. function ExecuteDelayedFix()
  39. if not canExecute then
  40. return
  41. end
  42.  
  43. Init()
  44.  
  45. canExecute = false
  46.  
  47. local delay = 50
  48.  
  49. while delay < 500 do
  50. ExecuteWithDelay(delay, function()
  51. ExecCmd("r.RayTracing.Reflections 1")
  52. canExecute = true
  53. end)
  54. delay = delay * 2
  55. end
  56. end
  57.  
  58. NotifyOnNewObject("/Script/Engine.Level", function()
  59. ExecuteDelayedFix()
  60. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement