0 of 0

File information

Last updated

Original upload

Created by

keanuWheeze

Uploaded by

NexusGuy999

Virus scan

Safe to use

740 comments

  1. NexusGuy999
    NexusGuy999
    • premium
    • 893 kudos
    Locked
    Sticky
    Patch 2.2 compatibility: ?
    I don't know if the mod will require to be updated, but core frameworks (CET) will
    In the past, the first CET updates for a new patch have been prone to be not stable and missing important features used by mods, thus I recommend waiting until all core frameworks have been fully updated.
  2. SimulacrumRift93
    SimulacrumRift93
    • supporter
    • 0 kudos
    Can you post the keybinding names you used for the entire controller because yours are different from the official ones? I'd specifically like to bind it to R3 and I think this would help a lot of people out.
    1. SimulacrumRift93
      SimulacrumRift93
      • supporter
      • 0 kudos
      I created my own solution by mounting it to dpad_right and setting a threshold so that the flashlight toggles on button presses, but doesn't toggle when holding it so it doesn't interfere with you summoning your car. It doesn't seem to toggle while in menus either when just pressed. Here's the updated code for the init file! Hope this helps!

      local flashlight = {
          runtimeData = {
              inMenu = false,
              inGame = false,
              holding = false,
              cetOpen = false,
              inputUsed = false
          },

          defaultSettings = {
              fadeTime = 0.15,
              offset = 0.3,
              brightness = 20,
              angle = 40,
              falloff = 10,
              range = 100,
              color = 2,
              red = 255,
              green = 255,
              blue = 255,
              controllerMode = true
          },
          settings = {},

          config = require("modules/utils/config"),
          settingsUI = require("modules/settingsUI"),
          logic = require("modules/logic"),
          Cron = require("modules/external/Cron"),
          GameUI = require("modules/external/GameUI")
      }

      function flashlight:new()
          registerForEvent("onInit", function()
              self.archiveInstalled = ModArchiveExists("flashlight.archive")
              if not self.archiveInstalled then
                  print("[Flashlight] Error: \"flashlight.archive\" file could not be found inside \"archive/pc/mod\". Mod has been disabled to avoid crashes.")
                  return
              end

              self.config.tryCreateConfig("config.json", self.defaultSettings)
              self.config.backwardComp("config.json", self.defaultSettings)
              self.settings = self.config.loadFile("config.json")
              self.logic.initColors()

              self.settingsUI.setupNative(self)
              self.logic.addObserver(flashlight)
              self.logic.callState = questPhoneCallPhase.Undefined

              Observe("RadialWheelController", "OnIsInMenuChanged", function(_, isInMenu)
                  self.runtimeData.inMenu = isInMenu
              end)

              self.GameUI.OnSessionStart(function()
                  self.runtimeData.inGame = true
                  self.logic.initColors()
              end)

              self.GameUI.OnSessionEnd(function()
                  self.runtimeData.inGame = false
                  self.logic.despawn()
                  self.logic.active = false
              end)

              self.GameUI.OnPhotoModeOpen(function()
                  self.runtimeData.inMenu = true
              end)

              self.GameUI.OnPhotoModeClose(function()
                  self.runtimeData.inMenu = false
              end)

              Observe("PlayerPuppet", "OnGameAttached", function(this)
                  this:RegisterInputListener(this)
              end)

              Observe("PlayerPuppet", "OnAction", function(_, action)
                  if not self.settings.controllerMode or self.logic.callState == questPhoneCallPhase.IncomingCall
                      or not (self.runtimeData.inGame and not self.runtimeData.inMenu) then return end

                  local actionName = Game.NameToString(action:GetName(action))
                  local actionType = action:GetType(action).value

                  if actionName == "dpad_right" and not self.runtimeData.inputUsed then
                      if actionType == "BUTTON_PRESSED" then
                          self.runtimeData.holding = false  -- Reset holding status on press
                          self.Cron.After(0.2, function()
                              if not self.runtimeData.holding then  -- Only toggle if NOT held
                                  self.runtimeData.inputUsed = true
                                  self.logic.toggle(flashlight)
                                  self.Cron.NextTick(function()
                                      self.runtimeData.inputUsed = false
                                  end)
                              end
                          end)
                      elseif actionType == "BUTTON_HOLD_PROGRESS" then
                          self.runtimeData.holding = true  -- Mark as holding to prevent toggling
                      elseif actionType == "BUTTON_RELEASED" then
                          self.runtimeData.holding = false  -- Ensure reset on release
                      end
                  end
              end)

              self.runtimeData.inGame = not self.GameUI.IsDetached()
          end)

          registerForEvent("onShutdown", function ()
              self.logic.despawn()
          end)

          registerForEvent("onUpdate", function (deltaTime)
              if not self.archiveInstalled then return end

              if self.runtimeData.inGame and not self.runtimeData.inMenu then
                  self.Cron.Update(deltaTime)
                  self.logic.run(self)
              end
          end)

          registerInput("flashLightToggleIn", "Toggle Flashlight", function(down)
              if not self.archiveInstalled then return end

              if down then
                  if self.runtimeData.inGame and not self.runtimeData.inMenu then
                      self.logic.toggle(flashlight)
                  end
              end
          end)

          return self
      end

      return flashlight:new()
    2. dframed
      dframed
      • premium
      • 5 kudos
      This is perfect - thank you so much!
    3. itsamomo
      itsamomo
      • member
      • 0 kudos
      YOU'RE MY HERO!

      Seriously, this has been bugging me for such a long time but only just thought to check the posts here. All I wanted was not to be turning my radio on all the time. Preem, thanks choom.
    4. Gordo972
      Gordo972
      • member
      • 1 kudos
      Thanks, works well
    5. SimulacrumRift93
      SimulacrumRift93
      • supporter
      • 0 kudos
      No problem, boss!
    6. SimulacrumRift93
      SimulacrumRift93
      • supporter
      • 0 kudos
      You got it, choom!
    7. SimulacrumRift93
      SimulacrumRift93
      • supporter
      • 0 kudos
      Glad it works well, homie!
  3. SKYNET202
    SKYNET202
    • member
    • 0 kudos
    Is there a way to get the mod to work? I tried changing the key bind on keyboard and controller. Even reinstalled the mod multiple times.
    1. BuggyBlueJay
      BuggyBlueJay
      • premium
      • 0 kudos
      It may be lut switcher, as was discussed on the night vision mod page. Try disabling lut switcher and seeing if it works.
  4. iambayer
    iambayer
    • supporter
    • 0 kudos
    Windows and Firefox flagged the download as Malware??? 
  5. Endersgone
    Endersgone
    • supporter
    • 6 kudos
    Can anyone explain how I might be able to bind it to something besides the left dpad?  Doesn't seem configurable in mod settings
    1. Same here! Would be great if you can map your buttons in native ui just like the nightvision mod eg.  press left dpad and RB button
    2. Burnout122812
      Burnout122812
      • premium
      • 10 kudos
      Just go into the init file and change "dpad_left" to whatever controller button config you want. I changed mine to dpad_up just so it's still quick to get to.
    3. Thanks for the tip!  What  do I enter if I want to activate it  by pressing  "X" and "RB" button simultaneously?
    4. Burnout122812
      Burnout122812
      • premium
      • 10 kudos
      I am not sure about choosing multiple buttons simultaneously. Never tried it before.
    5. I see!
    6. Jmolinares03
      Jmolinares03
      • member
      • 3 kudos
      the best mapping would be RB+B, it doesn't interfere with other game function.

      NexusGuy999 please try to make this possible.

      If you do this, you will get a definitive edition. that is sure
    7. lyff2333
      lyff2333
      • member
      • 3 kudos
      I find one solution that works well by far:
      1. Define the action:
      Open Cyberpunk>>2077>>r6>>config>>inputContexts.xml (Remember to backup),find <context name="Locomotion" >, and add one line above  </context>:
      <action name="Flash"map="Flash"priority="-1" />
      Then find <!-- HOLD ACTIONS --> and add this:
      <hold action="Flash"timeout="0.5" />
      Then find <!-- EVENTS --> and add this line
      <acceptedEvents action="Flash" >
      <event name="BUTTON_PRESSED" />
      <event name="BUTTON_RELEASED" />
      <event name="BUTTON_HOLD_PROGRESS" />
      <event name="BUTTON_HOLD_COMPLETE" />
      </acceptedEvents>
      Just make what you add be like the original ones.
      2. Binding:
      Open inputUserMappings.xml in the same folder, add this:
      <mapping name="Flash" type="Button" SIEJADependent="true" >
      <button id="IK_Pad_RightThumb"/>
      </mapping>
      It seems work well no matter where you put it, to make sure, you can put it below the entry of "dpad_left".
      You can try any other button you want (check the other entries, like "IK_PAD_LR_THUMB"), but "IK_Pad_RightThumb" seems good enough for me.
      3. Modify the mod:
      Open Cyberpunk 2077>>bin>>x64>>plugins>>cyber_engine_tweaks>>mods>>flashlight>>init.lua, change "dpad_left" into "Flash".
      4. Done
      It will only function in the normal context, which means you won't turn on the flashlight while driving. Hope this useful :>
    8. lyff2333
      lyff2333
      • member
      • 3 kudos
      By the way, I'm using alternative control scheme.
    9. Gn3xus
      Gn3xus
      • member
      • 9 kudos
      @lyff2333, Thank you sooooo much for the tip and subsequent eureka moment on my end !
      See, I've unsuccessfully been trying to figure out how to achieve that a while back without ever understanding the proper way to make it work in an input loader .xml file and I have been hoping for months a proper update to customize controller keybind(s) would come but your tip is what I needed, along with so many others, so Kudos to you dear fellow player ! :)

      So, to anyone interested in using InputLoader instead of editing vanilla inputUserContexts and inputUserMappings files, here are my SimpleFlashlight.xml file (to be placed in r6\input\ - with Input Loader installed, of course) contents :
      Spoiler:  
      Show

      <?xml version="1.0"?>
      <bindings>
          <!-- inputContexts -->
          <context name="Flashlight" >
      <action name="Flashlight" map="Flashlight" priority="-1" />
          </context>

          <context name="Locomotion" append="true">
      <include name="Flashlight" />
          </context>

          <hold action="Flashlight" timeout="0.3" />

          <acceptedEvents action="Flashlight" >
          <event name="BUTTON_PRESSED" />
              <event name="BUTTON_RELEASED" />
          <event name="BUTTON_HOLD_PROGRESS" />
              <event name="BUTTON_HOLD_COMPLETE" />
          </acceptedEvents>

          <!-- inputUserMapping -->
          <mapping name="Flashlight" type="Button" >
      <button id="IK_Pad_DigitRightDown"/>
          </mapping>

          <!-- Flashlight Gamepad Combo -->
          <buttonGroup id="IK_Pad_DigitRightDown" timeWindow="0.08f" >
              <button id="IK_Pad_DigitRight" />
              <button id="IK_Pad_DigitDown" />
          </buttonGroup>

      </bindings>

      Of course, it also requires editing Simple Flashlight's init.lua to use "Flashlight" instead of "Flash" but that's just my choice, as long as they match in both files, use whatever name you want.
      Finally, completely optional but for sake of completeness, I also edit the SettingsUI.lua descriptive text to reflect the chosen keybind/combo in the NativeSettingsUI side tip when hovering on the Controller Support toggle entry.

      Thank you veeery much once again ! :)

      PS: I got rid of the SIEJADependent="true" part as I've never seen it used in any mod and it doesn't seem to be required at all.
      (Never been able to find what it stands for either tbh)
    10. lyff2333
      lyff2333
      • member
      • 3 kudos
      Good job and nice cooperation! Now other guys could enjoy this mod more easily.
      For the PS issue: just some lazy guy tired of testing, never mind XD
    11. Coloredboyadv
      Coloredboyadv
      • premium
      • 5 kudos
      Gn3xus 3rd kudos to you fam!
    12. Gn3xus
      Gn3xus
      • member
      • 9 kudos
      Hey, thanks but lyff2333 deserves kudos just as much if not more imo
    13. Mrblack08
      Mrblack08
      • member
      • 1 kudos
      Hey Lyff233,

      I couldnt get your way to work. When I do my game crashes and I notice when I start the game and it says to press a button to continue....that button is not display and when I press any button on my controller it crashes. Using PS5 controller.  If I remember correct it is asking me to press the game pad which is mapped to "_" or at least that is what it looks like on screen. 

      But everyway when I try and edit all those files it just doesnt work and I cant figure out why. 

      EDIT: Found what was causing it. This line "priority="-1". Once I removed that the mod loads and works when I press in on the right thumbstick for a second. Not sure what the priority line does but it seems to break something with all my other mods I assume.
    14. Jmolinares03
      Jmolinares03
      • member
      • 3 kudos
      Gn3xus I recreated all the steps as you explained, but the final step you modified (init.lua) I don't understand.

      could you explain me better pls, or upload this configurations files in your account. thanks 
    15. Gn3xus
      Gn3xus
      • member
      • 9 kudos
      @Jmolinares03, sorry I didn't explain well (if at all) initially. It refers to Lyff2333's instructions, step 3 :
      Simple Flashlight's original init.lua has a part where it makes the mod listen to a vanilla "action name" : "dpad_left" (at line 94)

      But since we introduce a new "action name", be it "Flash" (like Lyff2333 chose), "Flashlight" (like I chose) or whatever we choose to name it (basically anything other than a vanilla action name), we need to reflect that in the init.lua by replacing "dpad_left" with "Flashlight" or whatever that "action name" we introduced is.

      Hope this makes sense to you and you can make it work :)
    16. rokku87
      rokku87
      • member
      • 0 kudos
      Is there a way to unbind photo mode and bind the flashlight to the controller double button press? I never use photo mode. 
    17. Th3Sa1n7
      Th3Sa1n7
      • supporter
      • 4 kudos
      @lyff2333

      Thank you!
    18. stroboscope
      stroboscope
      • member
      • 0 kudos
      same here. i hate accidentally triggering photo mode.. i'd rather involuntarily switch on my flashlight like the clumsy choom I am.
    19. Mybunshin
      Mybunshin
      • supporter
      • 20 kudos
      Thanks! You are so awesome! :D
    20. BurnableAddress
      BurnableAddress
      • supporter
      • 1 kudos
      The left joystick press does nothing by default in the game, this is the best binding for it if you want a controller binding that otherwise does nothing and has its own unique button press. 
    21. BurnableAddress
      BurnableAddress
      • supporter
      • 1 kudos
      I tried changing it in the init file but all that seemed to do is disable the radio while on foot. Now the menu doesn't even come up for the radio. The little graph for the radio button on the UI is red and the left d-pad only operates the flashlight while on foot, which is still fine for me. (It does still also skip conversations but will turn the flashlight on and off if you use it during a conversation also). If anyone has a correctly modified init file they could simply upload it so we can replace it with ours. 

      Thanks! 
    22. LiFeSII
      LiFeSII
      • supporter
      • 2 kudos
      @Mrblack08
      Thanks man, i was wondering why my game will crash when using any control input. After deleting the priority -1 it works flawless
    23. mangoCT137
      mangoCT137
      • member
      • 0 kudos
      If you want to use the key combination, you need to change step two to this:
      <mapping name="Flash" type="Button" SIEJADependent="true" >
      <button id="Flashlight" />
      </mapping>
      <buttonGroup id="Flashlight" timeWindow="0.1f" >
      <button id="IK_Pad_LeftThumb" />
      <button id="IK_Pad_B_CIRCLE" />
      </buttonGroup>

      You can freely combine keys, but not every combination is useful.
    24. Daimos22
      Daimos22
      • premium
      • 77 kudos
      @lyff2333, Thank you, that worked great👍🙌
    25. hboy62
      hboy62
      • member
      • 0 kudos
      Thank you. That's very helpful
    26. JacksonD07
      JacksonD07
      • premium
      • 3 kudos


      When you first open the .ini file, the highlighted text will read dpad_left. Change it to whatever you want, I just used dpad_up on mine. 
  6. JacksonD07
    JacksonD07
    • premium
    • 3 kudos
    just a quick note, renaming the archive file disables the mod (at least for me). Strange, I've never had a mod stop working by putting a number in front of it's original file name, but sure enough, flashlight will only work for me if I leave the archive file name unchanged. :) 
  7. Duff1996
    Duff1996
    • member
    • 0 kudos
    does not work anymore
    1. SimulacrumRift93
      SimulacrumRift93
      • supporter
      • 0 kudos
      Check out my post right above yours. It should apply a fix. Just replace the code in the .init file with it.
    2. Can you please elaborate?? Recently there have been a lot of issues with this mod along with other mods that use the config.json file like night vision, sit anywhere, etc.
  8. LEONPTA85
    LEONPTA85
    • member
    • 0 kudos
    works great, but how do i disable controller dpad. it comes on when skipping dialogue. i have controller with extra buttons and mapped it to keyboard which works great for me. just want disable dpad button.
  9. scottyus1
    scottyus1
    • premium
    • 114 kudos
    Please can someone make it work with the ' LEFT THUMBSTICK
    1. Daimos22
      Daimos22
      • premium
      • 77 kudos
      +
    2. datchleforgeron
      datchleforgeron
      • member
      • 0 kudos
      +1
  10. lillmuppen
    lillmuppen
    • premium
    • 8 kudos
    Awesome mod, it's so dark in some places especially with RT+PT so this mod is a must have and it also adds to the immersive because i mean....who does NOT have a flashlight in a world like this when out shooting people and doing spy work ;)
  11. Finnick420
    Finnick420
    • member
    • 1 kudos
    for some reason i don't have any shadows from the torch light when using reshades
    1. lillmuppen
      lillmuppen
      • premium
      • 8 kudos
      Reshades applies various effects, so you will have to fiddle around with that to make it work, or don't use reshades and use LUT or something instead.