Download

Help with flashlight system!!

Hi all,

I am currently trying to create a flashlight battery system so for every 5 seconds 1% of the battery power drops. The player starts off with 100% power.

Can somebody please reply with a picture of what I need to do to create this system.

Thanks

Hi Harv10,

I would advice asking more specific questions - right now you are basically asking someone to create the entire system for you, which can take a lot of time and can be done in many different ways.

Here’s the way I would approach it:

Create a blueprint that contains the flashlight mesh. Add a point light to this blueprint that points in the right direction
Add this blueprint as a child component and attach it to your character’s hand socket
Then once you are able to attach the flashlight to your character, create a function or event that keeps track of a timer. You want the total battery life to be 5*100 = 500 seconds total. Once 500 have passed you want to turn off the point light in your Flashlight BP.

This is all very general, but again it should get you on the right track.

If you have any questions while you are doing this post on the forums and we will try to help you!

If you wanted to make it realistic, you could make a Linear Color Curve that interpolates smoothly from white to amber to black, and use the curve to programmatically adjust the light color as time passes. Using a Timeline here would be very useful, too.

U can use bind tick to event or smthing like this.

Use the Set Timer node and tick the ‘Looping’ checkbox to call an event every five seconds.

Here’s something I threw together:

Timeline just goes from 1 to 0 in x amount of time. However long you want.

Flashlight Color Curve: