Download

Using Widget to Control Matinee

Let me start of and say that I am learning UE4, blueprints, C++, and so on as I build my game. I’m new to this. Here’s my dilemma: I have a widget called MainMenu and as you could infer it controls Continue, Start, Options and Exit. I’m using buttons to trigger changes whether is be starting, changing the menu, brightness, and so on. I’ve got that down. Where I’m running into a problem is: I want the start button to trigger a matinee event. When you click start, the camera swings over to another room. Currently in my level are two Matinee actors. Matinee 1 is a stationary camera. Matinee 2 is the swing camera. Matinee 1 is being initiated by a box trigger. So as long as the player is in the box, the matinee will continue to run on a loop. I read I should use an Event Dispatcher to communicate between a blue print and a level blue print, but that is only good for actors in the level I thought; won’t work with a widget? I hope I’ve explained all that you need to help me out. Thanks

Hi Davigeist, another new user! :smiley:
I don’t know if I understand exactly your problem, but you can use a sort of “bypass”.

We have HUD BP, UMG BP and LEVEL BP .

**HUD BP
**- Make a Boolean Variable. We call it “MATINEE - BYPASS”

**UMG BP
**- Make a Boolean Variable. We call it “MATINEE - PLAY/STOP”

Now you choose when this variable is True and when it’s False.
True = Play Matinee.
False = Stop Matinee.

  • Make a Branch node
  • Connect “GET MATINEE - PLAY/STOP” to Branch node
  • If “MATINEE - PLAY/STOP” is:
    — True:
    ------ Make a Get All Actors of Class node (Class is your HUD BP)
    ------ Make a GET node
    ------ Connect “Out Actors” of “Get All Actors of Class” to “Target Array” of GET
    ------ Make a “Cast to HUD BP” node from the GET Output
    ------ Make a “SET MATINEE - BYPASS” node from “As HUD BP C” Output
    ------ SET MATINEE - BYPASS: True

— False:
------ Make a Get All Actors of Class node (Class is your HUD BP)
------ Make a GET node
------ Connect “Out Actors” of “Get All Actors of Class” to “Target Array” of GET
------ Make a “Cast to HUD BP” node from the GET Output
------ Make a “SET MATINEE - BYPASS” node from “As HUD BP C” Output
------ SET MATINEE - BYPASS: False

LEVEL BP

  • Make a Get All Actors of Class node (Class is your HUD BP)
  • Make a GET node
  • Connect “Out Actors” of “Get All Actors of Class” to “Target Array” of GET
  • Make a “Cast to HUD BP” node from the GET Output
  • Make a “GET MATINEE - BYPASS” node from “As HUD BP C” Output
  • Make a Branch node
  • Connect “GET MATINEE - BYPASS” to Branch node
  • If “GET MATINEE - BYPASS” is:
    — True:
    ------ Play Matinee
    — False:
    ------ Stop Matinee

Hope this helped…let me know.

How do I make a GET node? I don’t see an option for just “GET”

177165ea337f576845844c7c6ca3a7d692026ed0.jpeg

So this is my code:
MainMenu is the UMG
MainMenuWorld is the Level Blueprint

I placed an Event Tick to have the code continuously running to see if it ever receives the True Command. It does not. What am I doing wrong?

BTW: Cast fail is the only way for it to complete the circuit

Try with something like this:

UMG BP
Put “SET MATINEE PLAY/STOP: True” between “OnClicked” and “Branch”.
2db5514f4fe26a41549acc2dcd441eee42b709fe.png

LEVEL BP [Version 1]
9eb57607d2b180a6b57be782544d4d4424ae2d68.png

or

LEVEL BP [Version 2]
You can change Delay Value from 0 to 0.1 (= 10 ticks a second are OK) .
971173443d3ec3bc6e9e883f75bfcd96c9a031d6.png

Let me know…

Ok, the code works. When I click start, Matinee2 is initiated. AWESOME! However, I need the viewport to stay at the end of Matinee2. In other words, the camera goes from point A, flies to point B, then stays at point B until another action is pressed. I thought I could solve this by teleporting the player character to a box trigger that initiates a looped Matinee. I ran the level and when the player is teleported, the event is triggered, but the Matinee does not play. Here’s my messy code:
3645a079829676f1b17a3e3050e66ac737eaf5f1.png

Here’s a video of it half working

Perfect! Now try with this:


I think my Matinee1 is your Matinee2 and my my Matinee2 is your Matinee3. Anyway…

You stop Matinee1 (I don’t know if it’s important for you), start Matinee2 and loop it until another action is pressed (I called it “New Action”).

I’ve forgotten a Delay between Play and Stop Matinee1 when Matinee Bypass is True.

IMPORTANT: You need to stop your Event Tick.
You can use a Branch with a Boolean variable (TICK STOP) between Event Tick and the Branch with Matinee Bypass.
If TICK STOP is False it refreshes your Branch node with Matinee Bypass.
When Matinee Bypass is True add a “SET TICK STOP: True” node before Play Matinee1.

It worked!!! Thank you so much for the help. I’m now working on reversing the Matinee, but I can take care of that. Thanks so much

I’m happy for you :smiley:

You can use Event Tick for “Set Looping State” too:

Have a good day!

Hi Diat Funa.

I’m wondering if you could expand on the UMG Button onClick to Matinee for me?

I have 4 matinees in my Level Blueprint. I have setup the Buttons in UMG with OnClick events. I’ve followed your guide above to get one of them to work using ‘Event Tick’ and ‘On Begin Play’ but confused how I would trigger each matinee separately. Is that even possible or should I just make 4 levels each with 1 Matinee?

Any help would be appreciated.

UMG BP
592e646feb85ebc1da83984a9568b528e0d4df31.png
LEVEL BP
e9a800a0948225951244cbebe4192d73e03b848f.png

Hi Rennsix!
ATM I can’t help you, but I’ll try tomorrow.

Anyway let me know if I’m right.
You have 4 buttons and 4 Matinee. When you click on “Button x” you want play “Matinee x”…?

Please, let me understand what you want to do.

Yes. I was over thinking the issue and have since solved it for my use case. Basically, I was getting confused as how I was going to split the “Event Tick” event in the Level BP. I was able to do it by executing a “Sequence” from the out pin of the “Event Tick” event so it would start listening for any of the 4 button onClick events. Below is my new UMG BP and Level BP.

UMG BP
b4b7884b204385b906db693c1d50c5b9e90f9bd1.jpeg

LEVEL BP. I added a MatineeController per each matinee so when it’s Finished it just opens the level again and resets the HUD. Probably a little hacky way of doing it but it works.
4ea2dfb90d9a361fc67160e1eac71e95c1cbf5d6.jpeg