Advertisement
Elec0

SwiftSlowMo Thoughts

Apr 9th, 2023 (edited)
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.94 KB | Gaming | 0 0
  1. --Author: yakuzadeso & Elec0
  2.  
  3. --------------------------------------------------------------------------------
  4. --Settings
  5.  
  6. --Whether to end slow mo with cool exit or not, right before touching the ground, right before exiting the dash.
  7. EndSlowMoWithCoolExit = true --Set to false if you want the dash to end at the actual end of the dash ability, or end when the dash key is released. Useful for inf swift mod.
  8.  
  9. -- How many ms the initial period of higher time dilation will last
  10. DashStartExtraSlowTime = 500
  11. -- How many ms the main period of slow-mo lasts for, after the extra slow-mo ends
  12. DashSlowTime = 1000
  13.  
  14. -- What time dilation factor the beginning of the dash has (lower is slower)
  15. ExtraSlowFactor = 0.1
  16. -- What time dilation factor the rest of the dash has (after ExtraSlow segment)
  17. SlowFactor = 0.5
  18.  
  19. --------------------------------------------------------------------------------
  20. --Keybinds
  21.  
  22. --Main Key
  23. Key = Key.F --Change "F" to whatever you want. Valid keys on the mod's page.
  24.  
  25. --ModifierKey
  26. ModifierKey = ModifierKey.ALT -- Change "ALT" to whatever you want. Valid Modifier Keys on the mod's page.
  27.  
  28. --------------------------------------------------------------------------------
  29.  
  30. local BipedPlayer = nil
  31. local GameplayStatics = nil
  32. local Enabled = true
  33.  
  34. RegisterKeyBind(
  35.     -- [snip]
  36. )
  37.  
  38. function SlowMoSwift()
  39.     if Enabled then
  40.         print("SlowMoSwift is On!")
  41.     else
  42.         print("SlowMoSwift is Off!")
  43.     end
  44.  
  45.     GameplayStatics = StaticFindObject("/Script/Engine.Default__GameplayStatics")
  46.  
  47.     RegisterHook("/Game/Pawn/Shared/StateTree/BTT_Biped_ShadowBlink_2.BTT_Biped_ShadowBlink_2_C:ReceiveExecute",
  48.         function()
  49.             if BipedPlayer.bInCombatMode and Enabled then
  50.                 StartSlowMo()
  51.             end
  52.         end)
  53.  
  54.     -- No matter what, the slow-mo ends when the ShadowBlink is finished
  55.     RegisterHook("/Game/Pawn/Shared/StateTree/BTT_Biped_ShadowBlink_2.BTT_Biped_ShadowBlink_2_C:ExitTask",
  56.         function()
  57.             EndSlowMo()
  58.         end)
  59.  
  60.     RegisterHook(
  61.         "/Game/Pawn/Shared/StateTree/BTS_Biped_TopLevel.BTS_Biped_TopLevel_C:InpActEvt_DodgeAndBlinkButton_K2Node_CustomInputActionEvent_25",
  62.         function()
  63.             if not EndSlowMoWithCoolExit then
  64.                 EndSlowMo()
  65.             end
  66.         end)
  67. end
  68.  
  69. function StartSlowMo()
  70.     GameplayStatics:SetGlobalTimeDilation(BipedPlayer, ExtraSlowFactor)
  71.     StartSlowMoDelays()
  72. end
  73.  
  74. function StartSlowMoDelays()
  75.     ExecuteWithDelay(math.floor(DashStartExtraSlowTime), function()        
  76.         StartSlowMo2()
  77.     end)
  78.     if EndSlowMoWithCoolExit then
  79.         -- I think, for user customization, that having the overlapping time segments is less intuitive than having 2 sequential
  80.         -- ones. I've found people get confused at the overlap more easily. Just my opinion, though.
  81.         ExecuteWithDelay(math.floor(DashStartExtraSlowTime + DashSlowTime), function()
  82.             EndSlowMo()
  83.         end)
  84.     end
  85. end
  86.  
  87. function StartSlowMo2()
  88.     GameplayStatics:SetGlobalTimeDilation(BipedPlayer, SlowFactor)
  89. end
  90.  
  91. function EndSlowMo()
  92.     GameplayStatics:SetGlobalTimeDilation(BipedPlayer, 1)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement