Question: How do I implement functional battery drain and recharge for a night vision post-process in Unreal Engine using Blueprints?

Hello! I’m working on a night vision mechanic in Unreal Engine using Blueprints. I currently have two post-process volumes: one for normal vision and one for night vision. I’m toggling between them using the “N” key with a FlipFlop node, and that part works fine.

However, I want to add a battery mechanic to my night vision system:

What I want to achieve:

  1. Battery Drain: When night vision is active, the battery should drain over time automatically.
  2. Battery Refill: The player can collect batteries scattered throughout the level, which should replenish the battery value.
  3. Disable Night Vision at 0%: When the battery reaches 0%, night vision should automatically turn off and revert to normal vision. I

've attached a screensh
ot of my current Blueprint setup here:

  • How should I properly implement the battery drain when night vision is active?
  • How can I automatically revert to normal vision when the battery reaches 0?
  • How should I handle battery pickup events that restore battery life?

Hey @Elixable! Welcome to the forums!

On your “Drain Battery” event, that’s where you do “Battery --” then SET Battery float’s value to that. Between the drain and the Event “Drain Battery” node is where you should do the check of Battery <=0, then on False do nothing but… (cont)

on True, turn off flashlight and Invalidate timer by handle. To get the handle for that, promote the return value off of the set timer by event and then use that. :slight_smile:

Just make an event to be called from elsewhere that takes “Battery” (float), adds however much you want, run that through a Clamp(float) with your minimum and maximum, and then Set Battery again! :slight_smile:

Hope that helps!

1 Like