Creating a torch

Not sure if this is correct section, please move if you have to!

Hi Guys!

As some of you are aware I’m currently developing a Horror Game see my post in In Progress section.

Just a few questions!

  1. I want to make it so that you can choose how bright you want the players handheld torch to be? Any ideas?

  2. Battery % for the torch, which runs out over time.

  3. Depending on how bright you make the torch is depending on how long the battery lasts for?
    IE -
    Battery = 24 hours (game time)/2 hours (real time) on 25% battery
    Battery = 12 hours (game time)/1 hour (real time) on 50% battery
    Battery = 6 hours (game time)/30 mins (real time) on 75% battery
    Battery = 3 hours (game time)/15 mins (real time) on 100% battery

Any idea on how to setup a blueprint to make this work?

  1. Going to add a 24 hour game time - but only with the moon, so there will be no sun that rises. The moon will set for 4 hours and then come back up. Brightness will change depending on the time of the day/night if you understand?

Any ideas will be great!

Luke

1 + 2 + 3

So you will have to create an actor bp for the torch. After that “get” the light and add an intensity node + an event which will change the brightness. For the battery you will have to create a float variable which will reduce the value over time (with the delay you can control how fast it should decrease). Now you will have to create another float variable which will define the amount of batter power that the torch will loose -> with the “set” nodes you can change that with the brightness of the torch (the print string is just here to print the value of the battery on the screen) :slight_smile:

Hi ,

Once again thanks for your superb help and diagrams!

Does this mean that once the battery percentage reaches 0% the torch will die/won’t be able to be turned on with the T key anymore?

Luke

Not with the upper setup, but you could do it like that (one of several ways):

So when Battery = 0 it will set the brightness to 0

Okay sounds good! Tad confused just by looking at it but ill fiddle around and get to work! Currently at work and not at my Home PC so can’t try it out yet but ill post the results once done!

This should work nearly the same as an ordinary day/night cycle -> Just replace the sky texture with a permanent night texture + a moon :slight_smile:

Thanks for that :slight_smile: I’ll probably do the moon one first and then look at getting the torch done :slight_smile:

Only other thing is, once the battery hits 0… I want the player to be able to right click on the battery click “replace torch battery’s” and it goes back to 100% / 50% depending on the battery condition?

You could do it like that:

So when the battery reaches 0 it will set a bool to true which will let the player to replace the battery (it sets the float variable to 100 again). As he shouldnt be abel to replace the battery before it reaches 0, you always check if the bool variable is on false or true.

green cross -> there you have to add an event that you like, because it depends on how exactly your system should work (where/what exactly the player should click) :slight_smile:

Hi , perfect, you’re amazing!

Basically I’m going to implant the invent system from the marketplace i think and use that for the players invent! so when the player right clicks on a battery inside the inventory it will reload the torch? Easy enough to change?

Dont know, because I dont have that invent system, but as long as you are abel to get a signal from your battery into your torch, it will be pretty easy. :slight_smile: