How to follow a good design logic to enable the same output through different Trigger events ?

I know how to do this using C++, but I’m learning Blueprint and I want to know if there’s a more convenient way to do this using simple drag and drop. Essentially, what I’m trying to do is that I want a widget (Let’s call it W) to display every time I enter a box trigger. I’ve managed to accomplish so much. Now I want to place some other, let’s say 5, more trigger boxes in the scene, and I want the same widget ‘W’ to pop up. Now I can just simply replicate the blueprint logic for all 5 trigger boxes, but I don’t feel good seeing all the redundant logic.

So is there a way where I can get all the “OnAcorTriggerOverlap”(s) from all the Trigger boxes, and all of them output pins go into the Create FKey Widget box.
I cant find a node that just gives me all the trigger events in one place, and I have no idea how to proceed. Any help would be appreciated :frowning:
Thanks :slight_smile:

Create a Blueprint to handle this.

Variables:

  • Public array of Trigger Box for you to specify in game that should show the widget.
  • Public User Widget Class to specify which widget you want to show.
  • Private Int counter of how many times the player is overlapping some of the triggers.
  • Private User Widget to store your created widget instance.

216389-ue-answerpic43b.png

Then follow below as I iterate through the list of given widgets on BeginPlay and bind the events to custom events contained here.

  • When the counter goes over 0, create and add the widget (you could optimize this by reshowing the old widget if the player re-enters the area).
  • When the counter hits 0, remove the widget if it exists.

Copy this snippet of code [HERE][3].

To Use, simply place your new BP into your world, specify the Widget it should create, and add references to the TriggerBox actors that you want to trigger this BP.

Perfect. Thanks a lot man!