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"

How do I dynamically assign TriggerVolumes to new PointLights?

Apologies if this is a horribly worded question, but I'm struggling with a project I have been working on.

I'm still fairly new to using UE4! I have a Point Light (PL) and attached Trigger Volume (TV). When entering the TV with a player character, the PL begins to flicker and turn off, with this being reversed when leaving the TV. All of this blueprint scripting is done within the Level blueprint, and will only work with the TV named "TriggerVolume" and the PL named "PointLight".

If I wanted to make a new light that followed the exact same rules, would I really have to copy this blueprint script again, and replace the references to "PointLight" with references to "PointLight2", or is there a more streamlined way of doing this (and less messy!)?

Any help is appreciated!

Thanks

Product Version: UE 4.18
Tags:
more ▼

asked Feb 13 '18 at 05:54 PM in Blueprint Scripting

avatar image

KitLUL
1 1 3

avatar image KitLUL Feb 13 '18 at 09:48 PM

Currently I have my blueprint set up like this, with "LightTrigger" being an actor with a collision box (acting as a trigger volume) and "RemoteLight" being an actor with a PointLight attached.

The aim is to not have to rewrite this OnActorOverlap Event blueprint for each and every time I create a new version of LightTrigger and RemoteLight with copy/paste or something similar.

Find attached the blueprint as it looks currently. Is this even possible? How else would I manage dynamic light switches, based on overlaps, in a randomly generated map? https://i.imgur.com/Lj0kEYf.png

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

1 answer: sort voted first

the simplest solution to the issue in a standard level would be to have two actors, one as the trigger and one as the light. the trigger actor would have a collision volume that when overlapped by the player would use a for each loop to call an event on the light actor. to determine which actors to affect i would use an array of the type of your light actor and make it editable so that when the trigger is placed in the level you could tell the array what to have in it. this is basically what i did in the picture below.

near the end of your last post you said you wanted to do this for a procedural level, this complicates things a bit. where this creates issue is because you dont have static objects in the level to get a reference to. so you would need to make a script to say which lights to affect in the level. for example you could use a get all actors of class then run logic to determine which lights were within 500 units and only affect those. you can make these types of conditions as complex as you like but it will be difficult to get the exact effect you want.

also it depends on how you want to implement the random generation. if you were to create a modular system where have a pre-made room and your generation just places them in random locations then you could just have the logic in the room blueprint modules.

alt text

capture.png (153.6 kB)
more ▼

answered Feb 13 '18 at 11:42 PM

avatar image

ThompsonN13
7k 19 6 15

(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