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"

In the blueprint tutorials, when player overlaps two trigger boxes of identical blueprints that activate input to toggle, input only works for one. Why? How to make both work at same time?

Just starting out with UE and I'm going through the "Introduction to Blueprints" tutorials. Just finished no.7 https://docs.unrealengine.com/en-us/Videos/PLZlv_N0_O1gY35ezlSQn1sWOGfh4C7ewO/EmvekeKk-0o where I have to make a blueprint of a light fixture that has a trigger box. When the player enters the trigger box, a prompt to press "F" to toggle the light shows up. Pressing "F" while in trigger box will then toggle light.

All is working fine, but I noticed that because I have 2 of these light fixtures in my level in close proximity, my player can overlap the trigger boxes of both at the same time. When this happens, pressing "F" only toggles the light attached to the trigger box I entered last (and when I leave that last trigger box but remain in the first trigger box, then I toggle the light attach to the first trigger box). Why does this happen and how can I make it so both are toggled? It's more than anything just to learn a bit more about how blueprint and UE work.

This is a screenshot of the event graph I made by following the video, though I made minor changes that shouldn't affect this.

alt text

Product Version: UE 4.20
Tags:
screenshot-58.png (387.9 kB)
more ▼

asked Aug 06 '18 at 07:31 AM in Blueprint Scripting

avatar image

LaNonlorette
3 1 2

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

2 answers: sort voted first

i feel like this is all being over complicated. your lights are all made as a actor and you are just creating many instances of the one actor right? if thats the case and your overlapping two actors at once and you want the input to affect both at once then theres a simple solution, select the F input event then go to the details panel and uncheck consume input. that should solve your issue by allowing multiple actors that have the same priority to use the F input at the same time.

more ▼

answered Aug 13 '18 at 11:20 PM

avatar image

ThompsonN13
10.1k 33 10 25

avatar image LaNonlorette Aug 25 '18 at 07:14 AM

Perfect! Exactly what I was looking for, and so simple. Didn't know there was a priority thing for input events. Totally get it now. I should learn to pay more attention to the details tab. Thanks

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

Edit:

Huge mistake on my part - This would be right if you were storing the lights in the character.

Try one last thing:

Please select the input event "F" and in the "details" tab make sure that "Consume Input" is not checked.

Old:

You are using (and storing) a single SpotLight variable.

This means that you set it once and then override it with the next set node. This way you are storing only the last object you have set.

In order to start/stop multiple lights you should convert this variable to an array and on KeyPressed F you should loop through the array and toggle the visibility of all of them.

more ▼

answered Aug 06 '18 at 08:38 AM

avatar image

dZh0
1.3k 6 5 9

avatar image LaNonlorette Aug 13 '18 at 10:04 PM

I kinda get what you mean. There are a couple of things I still don't get though.

1) What do you mean by set/stored? Where is this object being stored and why can only one at a time be stored at wherever this storage is (without an array)? Are the two separate instances of the same blueprint of a light fixture not considered separate and are thus fighting for the same single available storage space? Is that how it works? Because my default thinking was that these are two separate instances that have their own toggle visibility node that can both store their own spot light and also be triggered at the same time. Am I just clearly wrong?

2) If the first object is overridden when I enter the trigger for the second object (thus making toggling the first one currently impossible), why am I then able to toggle the first object again if I leave the trigger of the second object all the while never having left/re-entered the first object's trigger? How did that first object get stored again? When you say overridden, is that not the same as being replaced?

Also, I just tried an array and couldn't get it to work (keep in mind I just learnt how to make one). What I did was add the spotlight to the array when I enter the trigger box and removed it when I left. I then loop through elements to toggle visibility when F is pressed. This does not change a thing. I also used print screen to show length of array when I enter and leave a trigger box. Most notable is that when I enter the second trigger box while staying in the first, the length is apparently 1. Similarly, when I am in both trigger boxes and I leave only one, the length is apparently 0. So it seems as though the objects act separately when it comes to the arrays, but not input. But perhaps I haven't done it correctly. Is there a way to make an array that can take the light component of two objects?

These are the nodes I added to my old blueprint.

alt text

avatar image dZh0 Aug 13 '18 at 11:39 PM

I am truly sorry.

I assumed that this blueprint is in your actor as I was not too careful watching the tutorial video. I thought you were trying to save references to your spot lights in your character to activate them. I see this is not the case.

I have revised the answer.

avatar image LaNonlorette Aug 25 '18 at 07:17 AM

Mate it is all good. I learned to make my own arrays in blueprint because of you so don't sweat it. But yeah your revised answer is what I was looking for. Appreciate the help.

(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