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"

Need help getting boolean variable to work with media

Here's what I want to achieve:

1- TV is off when starting the game. 2- You can trigger the TV On after you enter the trigger box and pressing E. 3- After the media finished playing, TV will turn off automatically (I've noticed performance hit while media is on).

Here's where the condition comes to play: A = If TV is still playing, pressing the button again will turn off the TV. B= If TV is off, pressing the button will turn on the TV.

Right now I'm using a flip/flop method where it basically always attempts to turn the TV On then Off, so even if the media finished playing you'd hear the "switch off" sound: https://imgur.com/a/JK6xS

I've tried using a branch and variable + condition, but I couldn't get it to work even after trying to connect to several nodes and trying different options for the boolean condition, it usually just tried to turn on the TV for me and doesn't give 2 conditions, most probably a silly mistake I'm doing with variables (I'm still very new to UE): https://imgur.com/a/o8Ey6

Any help to get this properly working would be much appreciated!

Product Version: UE 4.16
Tags:
more ▼

asked Sep 02 '17 at 03:41 PM in Blueprint Scripting

avatar image

mgsmetallica
3 1 1

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

1 answer: sort voted first

When it finishes due to the end of the media, it doesn't trigger your flip/flop, so the next time you push the button, it will be reversed. The same goes for your variable.
To fix this problem, you can set your variable "TV off" to false right when you turn it on, and to true right when you turn it off. Currently, you're only doing it when the media finishes.
By the way, you can log your variables whith the "Print" node, it's useful to understand what's going on.

more ▼

answered Sep 02 '17 at 10:00 PM

avatar image

Syalen
126 5 9 12

(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