How do I make this collision prompted widget repeatable?

Hi,

I have the current blueprint for dialogue to fire on a collision but this only happens once, I would like to make this repeatable, so that anytime the player isn’t already in the dialogue widget, it should still be able to activate after the first time.

Currently the player walks into the NPC trigger area for the chat widget, I press ‘E’ and it activates and works great. As soon as I click the ‘Leave’ button within that widget, I’m not able to see the widget again after pressing ‘E’ again, yet I can hear the chat noise from that blueprint.

You remove it from the viewport so it needs readding. On isValid check if the widget is in viewport, if no, add it. The check is necesary, otherwise the editor will complain we’re adding it more than once.

It’s already created and referenced, it just does not have a parent to latch onto.

I’ve assumed the Leave button removes it in a simialar fashion as shown above when we run out of dialogue lines.

Great! I have that working now thank you. Secondary issue now, the dialogue runs through the different text each time I leave and activate it again. Once it finishes the text it starts again.

E key pressed for the first time, first dialogue text appears, I then click Leave.

E key pressed for a second time, second dialogue text appears, I then click Leave.

E key pressed for a third time, empty dialogue appears, I then click Leave.

I am assuming you have two ways of ending that chat. Either we run out of stuff to talk about or we press Leave. Am I correct? How is it supposed to work?

  • :white_check_mark: E key pressed for the first time, first dialogue text appears, I then click Leave.
  • :x: E key pressed for a second time, second dialogue text appears, I then click Leave.

That’s not what you want, right? You want to restart? Or is this fine?

  • :x: E key pressed for a third time, empty dialogue appears, I then click Leave.

What does Leave really do? Perhaps the index needs resetting? If so, it’s a perfect opportunity for an event dispatcher.

Yes I want it to restart each time I press E when the widget isn’t currently showing, sorry I’m not very good at explaining

Leave button

Dialogue Text origin

1 Like

Yes I want it to restart each time I press E when the widget isn’t currently showing

Try it like so:

Clicking the leave button would execute the script at the bottom and reset the index. You’d also no longer need to remove all widgets inside the dialogue.


The Get All does not do anything here atm:

image

And the Remove All may be redundant unless you really must remove the ENTIRE game interface. As a side note, widgets are happy to remove themselves from any container they’re in:

image

Not sure if relevant but good to know.

I’m up to Target button leave but I’m not sure how to create this / what the variables are used
Target

No variables needed, this is the button inside widget. Called:

image

on your end. We’re delegating (the small red square in the upper right) this event. When you drag the data wire and search for it:

image

Does it show up? If no:

image

If so:

This allows you to execute button action in any other blueprint that can hook up to this.


I have assumed this:

Lives or is inside UI widget.

It throws an error I don’t quite understand

ERROR
‘The blueprint (self) is not a widget, therefore Target must have a connection’

WARNING
‘Set UI was pruned because it’s Exec pin is not connected, the connected value is not available and will instead be read as default’

It throws an error I don’t quite understand

The editor is drunk and it’s barely noon. Is this when you compile? Don’t forget to compile the widget, too.


Perhaps the stuff on the left (where we cannot see) is not connected? That’d explain it. Can we see the whole thing?

This :point_up_2: must replace parts of the script you have here :point_down::

and be connected to execution, ofc.

1 Like

Let’s see how I did, I wish it was the drunk editor, but I doubt it, and it’s quickly becoming a drunk developer “cheers”

image


But bits are missing, re-adding to viewport is not there, it seems.

Okay yep, score 1 for drunk me, I didn’t connect the event. Hahah! sorry. it’s connected, however; it appears once and not again

image

But bits are missing, re-adding to viewport is not there, it seems.

I’m not sure what I am suppose to do sorry!

Thought you had that going. Here’s a more complete thing:

Utterly untested but should work :crossed_fingers:

This is what is happening (before your latest reply) I haven’t been able to get the latest changes to work either

  1. First stream is dialogue widget opens
  2. Second stream is Leave button pressed
  3. Third stream is me trying to open dialogue widget again

As before, you’re missing the re-adding part. Once you remove a widget from a viewport, it’s not there, you can’t see it. This part does that:

The rest seems to follow your logic but is, arguably, less spaghetti.

Ah right, False on the Branch was going directly to Remove instead of to Add to Viewport, thank you! here is a working version!

1 Like

Wicked!

1 Like