x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Level Blueprint turning on street lights at day and off at night

Hey everyone! So I don't really know what to do, I want to turn on my street lights at night and off on day time in my Level BP.

https://imgur.com/a/hpznn

I have some street lights in my level with Point lights, the problem is that I cannot think of any way to turn them on and off when it is day and night. Help is greatly appreciated.

Product Version: UE 4.14
Tags:
more ▼

asked Sep 27 '17 at 07:05 PM in Blueprint Scripting

avatar image

Jinvira
16 2 2 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

So you're light should be set to movable because static or stationary light gets baked and therefore cannot be turned off properly. Asuming you have done that you can easily get a direct reference to the asset inside the level blueprint. Just click on the asset inside the level and right click in the level blueprint. Third thing is how you determine day and night. Here, you can simply use a timer by event that triggers the event after a specific time.

alt text

You cannot call any event in the level blueprint from outside. So you have to either do the day/night change inside the level blueprint or create a light manager class inside the level which is storing references of all lights in an exposed array. You can then just get a reference from wherever you do your day/night calculation to that actor and let the actor handle the light off/on switching.

unbenannt.jpg (185.5 kB)
more ▼

answered Sep 27 '17 at 07:49 PM

avatar image

A7E7
168 4 7 10

avatar image A7E7 Sep 27 '17 at 07:53 PM

Or you can create an event dispatcher in the class that does the day/night switch that gets called on day/night switch. Then you can bind to it in the level blueprint or the light manager class.

avatar image Jinvira Sep 27 '17 at 09:27 PM

I did this now:

alt text

It now works but I have to reference every point light in the map. It my not be the final solution though.

unbenannt.png (478.6 kB)
avatar image MADHOUSE Sep 28 '17 at 01:14 AM

I would assume your streetlight point lights/spot lights are a part of a BP actor, for example a bp_streetlight actor. Just create a function in the BP class to turn lights on and off, and have the game mode (or whatever keeps track of day/night) send an interface call when the lights should be turned on or off.

avatar image A7E7 Sep 28 '17 at 05:46 AM

As you can see in his latest screenshot, they are not.

But yeah, if you want this to happen automatic you don't get around creating a special blueprint for your lights (except all dynamic lights in you scene are streetlights, then you could directly call GetAllActorsOfClass() in begin play of your level blueprint and store them in an array). Apart from using GetAllActorsOfClass(), you can use an event dispatcher in your game mode and bind an event in begin play of your BP_StreetLamp.

alt text

alt text

pickparent.jpg (73.0 kB)
impl.jpg (254.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question