How to Increase/decrease Flashlight Brightness?

How would I go about increasing/decreasing flashlight intensity with the scroll wheel ? I know how to set up the input for the mouse wheel, but I’m just having trouble with mapping out the function for increasing/decreasing the intensity of the flashlight brightness. Below is a picture of the scripting for toggling it on/off. I’m using v 4.18. THANKS AHEAD OF TIME!

This could work:

1 Like

Thank you! That’s close but it’s basically just toggling it on and off… Is there a way for it to scroll from 0 to 1000 depending on how much you scroll? Or did I do something wrong?

The example will adjust the value in the increments of 1000 per mouse wheel scroll tick. Try lowering it for more granularity. The default intensity of the Spotlight is 5000 (I think) so I used that as a base here. So 5 scroll downs will switch the light off.

If you require a completely smooth transition, it would require a slightly different approach. A timeline or interpolation.

edit: I’m getting this with increments of 1000:

https://gyazo.com/d790258ddf794fbf201caefb66803d07

Not sure what effect you’re after precisely, but you will most likely want to introduce a clamp, too:

Thank you! The last picture works like a charm and is exactly what I was looking for! Thank you for the quick responses and for all your help! I marked your answer. :slight_smile:

Hi!

Sorry for bumping this thread, but I am trying to apply the solution you provided above to my own project, and what you suggested seems suitable for what I’m trying to do. What I’m trying to do is to control the light intensity of a bonfire BP with my mouse wheel. The bonfire is from this asset pack:
“M5 VFX Vol2. Fire and Flames(Niagara)”.

To be able to make an object component reference to the point light I want to control (like you did with the spot light in your picture), it is my understanding that I need to apply your solution/code inside the bonfire BP. I tried several places, among others in the level blueprint, but to get it looking like in the picture you posted it seems I have to do it in this BP. I am still at a beginner level in Unreal Engine in many ways.

What I don’t understand, is how you connect the spot light component reference to the intensity float (if I understand correctly what I’m looking at) named “Intensity” in the bottom left corner of the picture. When I try to do it with my point light component object reference, it says “directions are not compatible”. What am I missing? See the embedded screenshot below.

I am using UE 5.3.2.

Thank you!

Drag a wire first, then search.

Blueprint execution flows from left to right:

1 Like

Thank you for your help. Unfortunately I’m still having issues making it work :thinking:

First, here is what did work:
I managed to connect the point light component object reference and the light intensity float. It seems the problem was simply that I had placed the get-variable and the point light into the event graph separately and then tried to connect them. That gave me the “directions are not compatible” message I talked about.

The issue now:
I’ve managed to follow and include all the steps/nodes from your solution/code now, but somehow nothing happens to the light intensity when I scroll the wheel. Here’s my replication of your solution:

I also tried changing the link to the value pin on the clamp float, so it comes from the minus-direction and not the plus-direction (see difference in picture below). My reasoning was that the starting value of bonfire’s light intensity in my case is already the maximum of what I want it to have. The bonfire is already lit, it’s not like the flashlight which gets turned on from being completely dark/off. So to get any change when starting to scroll the mouse wheel, I would have to reduce the light intensity, not increase it. But it didn’t make any difference:

I also tried the original solution you provided earlier in the thread, but it didn’t work either:

I’ve also tried “clicking and holding down” the mouse wheel while scrolling with it, and I’ve tried adding the mouse wheel as an input action, tried deleting the “±direction”, tried using “mouse wheel up” event and “mouse wheel down” event instead of “mouse wheel axis”, but to no avail.

In all cases, when I scroll my mouse wheel, nothing happens. The bonfire looks the same as it always has. Do you know any reason why it might not work in my case? If there’s any additional information you need to assist me, then feel to ask. I’m very thankful for the help! :slightly_smiling_face:

Script looks fine. Regular actors do not process input until you enable it. It’s not recommended to do so in most cases. Input is usually handled in the player controller / possessed pawn.

1 Like

I see.
The third person character blueprint is one of the places I tried to do this, but it can’t find/reference the point light by methods I’m used to. The method of selecting something in the outliner/level and then right clicking in the event graph to get an object reference or event connected to it seems to only work in the level blueprint.

The only solutions I can think of are:

  1. Adding a blueprint interface - I think it has been described as a system that “broadcasts” information that other objects can access if they’re “tuned in to the station”. I’ve never used it before, but from watching Matt Aspland’s youtube video, it seems that I MIGHT be able to tell the bonfire’s BP to do certain things by adding a blueprint interface to the Third Person Character BP. From your experience, do you reckon this could be a viable method for my case and worth looking into?

  2. Copying the whole bonfire BP to the Third Person Character BP: but I guess that would mean not just copying the script, but also the particle system, bilboard, point light etc. Otherwise the BP probably wouldn’t work, it would be logic separated from the components/objects it is supposed to control. I guess the bonfire then would have to be carried around by the player character everywhere it goes, which I don’t want.

Thank you for your patience and help!

Are we making a game or a standalone cozy scene? How will the bonfire work from the user / player perspective? You can connect anything to everything if necessary - but that’s the crux, is it necessary? Do tell! One generally chooses a specific tool for the job, this applies to input and communication, too.

If all that is needed is input processing for some random actor that is not gameplay related, you might as well just:

Now it will receive and consume user input.


I MIGHT be able to tell the bonfire’s BP to do certain things by adding a blueprint interface to the Third Person Character BP

The other way round, the interface would go into the bonfire actor, but using an interface requires a reference anyway.

2 Likes

Thank you, I will give the blueprint interface method a shot :slight_smile:!
I feel quite protective of my ideas for the project, which unfortunately makes me quite secretive and careful with what I reveal to others, but I’ll share some of the background and vision. I hope you’ll find it interesting. It is very nice of you to help, and to show your interest!

Background and vision
3 years ago my brother-in-law gave me the components from his old desktop computer so I could use that rather than my crappy laptop for my early attempts with UE. Fast forward to very late last year, he asked me (as a christmas present) for a cozy scene in UE that could be used to relax in, giving a few basic descriptions on the type of scene he wanted. He later revealed he made the wish in part to motivate me to give learning UE and game development another try (I kind of gave it up two years ago after struggling for a long time trying to solve an issue in my project). His idea worked, because doing things for others and not just for yourself makes it easier to keep trying when you meet setbacks and dead ends. The biggest motivation for working on this is that I want to create something he will enjoy (and have fun while doing it), but who knows what it might turn into if I keep on developing it.

I have now reached the point where I’ve basically made what he wished for. I however still have A LOT OF IDEAS that could make it into a real video game and not just a simple scene. In time I hope to implement cinematics, some gameplay, a story, big event-driven changes to the environment in the scene and so on. Controlling the light intensity of the bonfire is part of this, a small step on a path to something potentially bigger. So I consider it to be necessary :slight_smile:

(edited to remove uneccessary details)

• for simple input to work, enable it on the actor. As in the pic above.
• if there’s a player who needs to interact with various objects, you can either Line Trace + Interface to look at something and press a key to interact, or use proximity Overlap + Interface if being close to the interactive object is enough.

1 Like

Apologies for a lengthy and vague explanation of what I’m doing in my project.
Thank you for your suggestions and kind help.