How to get an interactable actor to communicate with a Widget in the player character?

So I have a bunch of Actor bp’s in my level that are spawned from one master bp, each actor has different tags depending on what it does. I have a widget that has items like a checklist, with an image of a checkmark in each of the boxes set to hidden, so when the player interacts with an object, if it has a tag, the checkmark in the widget becomes visible so it looks like they just checked it off as they interacted with it.

My problem has been, the only way I can kind of get it to work is after a “ Actor has tag” branch check in the master object bp, create the widget and do the checkmark un hidden functionality there.

However I have tab set up to Create/remove from parent the widget in the player, and since the bp is calling a new instance of the widget in the master actor and doing the logic there, it’s not showing up on the character widget when they call it.

So how Could I code it so that when the player interacts with the actor, it sets the checkmark to visible in the players widget?

usually i’d have one subsystem ideally, or a manager actor to manage and control the ui.

then on the interactions you get a ref to such subystem or manager, and call the functions there to modify the checklist.

this and you can use GetHUD() as an easy starting place.

just broadcast a generic event GetHUD()→CallEventInteract(Actor Tag, Actor Ref)

in the widget, GetHUD()→BindToEventInteract

Get HUD isn’t showing up, the closest thing is cast to hud.

i personally would not recommend to interact directly with the ui. but instead use a manager to control the ui and communicate with it. that way you avoid having extra code in the widget, and can expand to more complex code. might be safer in the future.

Target is PlayerController so you could even use that or an ActorComponent of it. And of course Cast it to your personally class

Like this? I’m not too sure what I do after this though

you have to create the event on the manager class (HUD)

is your game single or multiplayer btw?

for now lets make it even simpler then you can expand upon the concept later.

so lets just use your player controller as the ‘manager’

in your player controller create an event dispatcher.

when you want to call a HUD event GetPlayerController(0)→CastToMyPlayerController→CallEventDispatcher.

to receive in a widget, on construct GetOwningPlayer→Cast→BindToEventDispatcher

check that works, then you can add payloads to the ED if you like.

It’s single player.

So like this?

yep, although you dont need the character before owningplayer.

then drag off the RedEvent pin to CreateEvent, and off that event put a printstring to test

Wait which picture are you referring to?

the widget, maybe you need it later but right now you dont

I have cast to third person character before the owning player, do I need something else? I’m only using the third person character.

Also I added a print string and tried pushing tab that should call me widget and nothing happened.

i cant see the rest of the code but you cant call the event before the widget exists, so just change the order of operations.

your widget should be persistent anyway, you dont want to create/destroy it everytime the event is called or you will lose the previous state. just set it visible/hidden if you prefer and create it on the player controller on begin play

its not connected (the blue pin) so not in use was all i meant but it could cause your logic to fail if the cast fails

That was another problem I was having I created it on begin play and made it hidden, then changed it to visible on my tab push event, but it just would not change the visibility no matter what I did, So idk, this is the only way it’s working for right now.

i cant see a problem with the visibility but until you get it working you should be validating your references for now just use a print string, so for instance you can rightclick on your JournalWidget and ConvertToValidatdeGet and then on fail printstring something useful. you should likely do this everywhere, ie castfailed etc.

this will help pinpoint problems.

if the event doesnt work its likely that the Call happened before the Bind, this is hard to debug so you just have to be careful.

just to clarify though since you didnt show it but dont forget to

once you get it working you can add input pins to the EventDispatcher, so for instance you can pass through the ActorTag so the widget knows what to update.

unfortunately i’m heading out now but you’re on the right track. good luck.