How to register player using UI buttons?

TLDR; Can I make it so a cinematic sequence starts for everyone, but stops showing for only anyone pressing the UI skip button?

Hello, I am new to using the UI module and having problems “instigating” the player that pressed a UI button.

I am trying to make a video using the cinematic sequence and cine camera actor, while simultaneously showing a skip butting using the UI module.

Currently I have it set up in a way that pressing the a button shows the UI and cinematic sequence, and I am able to clear the UI when skip is pressed… What I am trying to do is make it so only the user pressing the UI skip button stops seing the video/sequence (while others continue to watch until they skip or the end).

I tried a few things but was unable to change the function from Message:widget_message to Player:player

My code for this file is a little long so here is a snippet of just the relevant parts

Any help greatly appreciated!!!

OnBegin<override>()<suspends>:void=
        Print("OnBegin Started")
        MyButton.InteractedWithEvent.Subscribe(CheckIfUI)

    
    CheckIfUI(Player:player):void=

        MyCinematic.Play()

        # Check if player has UI
        # removes/adds UI to player screen
        # NewCanvas := MakeCanvas()

    MakeCanvas():canvas=
        Print("MakeCanvas Started")

        SkipButton:button_regular=button_regular{ DefaultText := "SKIP" }

        SkipButton.OnClick.Subscribe(SkipFunction)

    SkipFunction(Message:widget_message):void=
        Print("SkipFunction Started")

        if (TmpPlayerUI := GetPlayerUI[Message.Player], TmpCanvas := Canvas?):
            TmpPlayerUI.RemoveWidget(TmpCanvas)
            set Canvas = false

        MyCinematic.Stop()

Thank you!

1 Like

Have you tried MyCinematic.Stop(Message.Player)?

1 Like

I asked a semi-related question about the Cinematic Sequence and Instigators, and from what @RayBenefield said it sounds it wasn’t possible to do what I wanted to do with Verse.

I was trying to start a Cinematic Sequence for only the the instigating player who interacted with a button, while you’re trying to stop a Cinematic Sequence for only the instigating player who clicks a UI button. It might be that either the sequence plays/stops for everyone or nobody, and we can’t pick and choose who. Or maybe stopping is different, I don’t know :face_with_monocle: Do you want the sequence to keep playing, but for the camera of the player who clicked the button to return to normal so that that person is not watching the sequence?

Ray’s answer:

This is a known limitation of the verse wrapper for the Cinematic Sequence Device right now… it’ll eventually get a Player parameter. HOWEVER, there are technical difficulties in allowing multiple people to watch the same cinematic sequence but like overlapped, while someone else is watching it if it is set to instigator only since Verse is server side. So be aware that even when the Verse wrapper gets updated that will also still be a thing.

Wait, is it possible to use (Message.Player) or (Player) with the Cinematic Sequence in Verse? I couldn’t get it to work, and Ray seemed to say it wasn’t a thing. I would really like to be able to play a Cinematic Sequence for only one player not everyone, and I thought it wasn’t possible with Verse. Calling Play() for Cinematic Sequence Device? - I can't get it to for "Instigator Only", only plays for "Everyone."

I had no luck using .Stop(Message.Player) unfortunately - thank you for the suggestion!

2 Likes

Thank you for linking to this, I have been trying for a while today with no luck yet unfortunately - I will be sure to let you know if I find any solution :slight_smile:

1 Like

Ya keep me posted! I thought you may have already seen my similar post but I figured it doesn’t hurt to link it.

You can use a combination of Verse and event binding to ensure its player bound.

This would require 1 trigger device per function. Honestly I’ve found using Verse in conjunction with Event Binding to currently be the most efficient way of building game logic. Of course you need to know the strengths and weaknesses of both to take advantage, however.

2 Likes

That makes sense I will give it a go thank you!

So would you use Verse to activate the Trigger Device for the instigator, and the Trigger Device would activate the Cinematic Sequence Device, using Event Binding? And if the Cinematic Sequence Device is set to Instigator Only, would it automatically work for the Instigator of that Trigger, rather than for everyone? Even if the Trigger itself was activated using Verse instead of Event Binding?

Could you share any other examples of other situations where you would recommend Event Binding instead of Verse? I haven’t used Event Binding much.

1 Like

Exactly :100:

Off the top of my head its hard to give concrete examples as it really depends on the situation and ultimately it will come down fo preferences. Once you start to use multiple devices in long complex logic, event binding comes in clutch.

1 Like

Nice, I’ll keep it in mind as a resource. I’ve been hesitant to use Event Binding much because I feel like when most of my mechanics are laid out in a script except for a few little things that use Event Binding, the Event Binding stuff is kinda lost floating out there unrecorded, and it makes it harder for me to keep track of my logic and how things fit together and flow. Does that make sense?

Like, the script is a book with a narrative that flows, and then there’s a weird chapter missing from the book because that chapter uses Event Binding.

For example, in my Day/Night cycle I didn’t like that before Skydomes were supported with Verse I couldn’t include SkydomeDay.Enable() and SkydomeNight.Disable() in my list of Sunrise functions alongside all of the other things I wanted to happen at Sunrise, and I had to use Event Binding for just the Skydomes. So I had to use a Timer Device instead of Sleep() for just the Skydomes, while I was using Sleep() for the rest of the functions. It’s like, ok it’s daytime so turn off the street lamps, cue the rooster call, set isDay = true… I guess I’ll write a comment that says “Someday I hope I can write Skydome.Enable() here lol”

And then maybe something breaks and most of my Sunrise stuff doesn’t work but the Skydomes do cause they use a different system. And I just find that annoying even though it doesn’t really matter.

In retrospect maybe I could have optimized my system better. Maybe I could have activated a Trigger at Sunrise, instead of needing a Timer. The fix became obsolete anyway. Do you end up using Triggers a lot, to communicate between Verse and Event Binding?

How do you keep track of your Event Binding stuff? Do you use comments?

1 Like

Its all in my head. Im a maniac. Ive been like this with all projects since forever. Some people make notes… I just memorise :face_with_peeking_eye:

1 Like

Ahahhahaha can’t relate!

Maybe you have a better instinct than I do because for memorizing systems, because you have so much practice with the old Creative system of devices and channels! My first experience with game mechanics was scripting it all out in a list in Lua, so when I opened up Creative devices and channels made me feel so disorganized and lost. I felt like I had a hundred weird little guys in the map, that talked to each other in disjointed blips based on a bunch of disorganized settings in a hundred different menus. I just could not map it out in my head. I was very relieved when I learned I was gonna be able to go back to using text for at least some of the mechanics.

I think with Public Beta, Creative users are going to be very happy to realize how much of an advantage it is for them to come into UEFN already familiar with what the various devices do, and how to best use the devices in combination with each other. And Event Binding already exists in Creative, so there’s even more of a headstart.