Boolean acting erratically

Hey all,

I’ve set up a boolean in my skydome to dectect when its daytime and when its night time and do different things at each time such as play music. It works, but its doing some really erratic things so I created a video to explain.

If anyone can help figure out what’s wrong it would be appreciated.

About the sound cues, they are Auto Active. So they start playing automatically.
And you have to fade out the other music, so they don’t get mixed.

The clouds won’t change because the Begin Play only runs once. You need to trigger the fading. Also you can use the debugger which is a great tool to figure out whats going on.

Oh, and in the time line, you can use only one curve to fade between day & night with Play and Reverse.

Ahh yes they were set to auto active thanks for noticing that. They’re still flipped though and if I try to add a fade out they both just stop playing all together.
Also if the day starts any later than 480 (8am) as I set in the range, it doesn’t play the daytime music. For example if I set it so the game starts at noon the day time music doesn’t start till it hits 8 am again. I’d like it to play the music at any point within that range.

Oh right… begin play only fires once, so its not firing again every time the day and night cycles. That makes sense. Is it possible to change the particles from the Skydome blueprint if they’re only in the world and not part of the skyBP ? IE can you change a persistent level object from an actor blueprint?

Yes you can change any object spawned on the level. But i would move the particle system into an actor as a component. And add an event which does the fading for the clouds.

With this you can get all actors by a specific type on the level.

Then just call the event to fade the clouds.

(It is simpler. But if its not the case, then you have to use Event Dispatchers which are a bit more complicated. )

Ok cool. The reason I don’t want to put them into an actor is that I have their scale and world position perfect and don’t want to have to re-adjust.
Wouldn’t get all actors of class give you every particle in the level not just a specific set of them? And what if the clouds are made up of 2 different particle systems? Just do it twice?

So thank you very much for your help Azarus. Using the Get All Actors of Class instead of my variable to the blueprint fixed my problems. I don’t know why the variable wasn’t working because I created it the same way all the tutorials say to but I’m just happy everything is working now.

The Day and Night value of my bool is still reversed but that’s an easy workaround.

Thanks again for your help!

The variable should work. The only problem was that your script ran only once at begin play? If my answers solved the problem, then please accept it. Thanks :slight_smile:

yeah sorry I thought it was only a comment earlier so I just gave it a vote up. When I use Event Tick It is working but its still flipped the night and day for some weird reason. Like I said good enough for me that it works but its technically still acting weird.

Can you post a screenshot about your current blueprints? The two you were showing in the video.

So I’ve set the bool to take the current minute and if it is within the specified range, it IS day time. I divide the minutes by 60 to get the approximate hour so 480 = 8am and 950= is almost 4:50pm (that’s the time when the sun rises and sets).

But for whatever reason when the bool is true, it thinks its night time. I don’t understand it. Maybe its just the way the Skydome was configured?

Can you print out the values of the Current Minute? If its still not working feel free to shoot me a message on the forum:
https://forums.unrealengine.com/member.php?14600-Azarus

Yeah, that’s how I figured out when sunrise and sunset happen. I hooked the current minute up to a print string and noted the values when the transition happens. As I said, it all works properly as far as the BP is concerned but when Daytime is TRUE you can see its playing the Music Night node but the music that plays is actually the day time music. I’ve also set this up for some fire flies that come out at night. Regardless of what I do, if I want it to happen during day time I have to connect it to the false branch and vice versa which doesn’t make sense. Here’s some screens:

Ok i noticed that you’re not Fading out the Daylight Music when its Night, And you’re not Fading out the Night Music when its Daylight. Everything else looks fine. Have a look at the Fade Out node.

yeah as I said above, when I add in the fade out, the music doesn’t play at all. Right now they fade into each other perfectly cause the one that’s playing fades and the other doesn’t. Anyway, its odd that the time of day is somehow inverted, but its easy to work around so not a really big deal.