Event Dispatchers: How to return a value from an event dispatcher?

It is late (for me now) i could not make what your really want (probably because i am sleepy). However i try again tomorrow (in 10 or so hours).

And until then it is how i use dispatchers and how i do communication between blueprints:

Single to many:

  • dispatchers are used for situation when one needs to tell many about some variable
  • i create dispatcher in blueprint that can be easily found and is in single copy.
  • such blueprints are: game state, game mode, players hud, player character
  • so that blueprint of choice gets dispatcher, and sends some variable to everybody interested in it like for player HUD and telling all widgets that HP changed, or telling all lights that its night and they should turn on

Many to single:

  • i create event in same blueprint i made dispatcher
  • then i create function library, and in it function: GET_PlayerHUD, i usually add CORE so it would be: GET_CORE_PlayerHud (easier in blueprint to just write CORE and get all my functions that point to such blueprints). That function inside casts to proper hud class that i created. And returns casted to reference. And its PURE function, so no need for execute pin.
  • so any blueprint that wants to tell anything uses GET_CORE_whatever, and just calls proper EVENT there. And that event can send variables back to MIDDLE MAN blueprint

ps.
DO NOT USE level blueprint. It has one HUGE problem, it loads first and has Begin Play first (before anything else), so it is common and possible that get all actors of class returns nothing, then your game logic is time dependent and loading order dependent

Instead of game level put such logic in game state or game mode. And in level use actors that have their own logic in own bluepritns.

Also second HUGE problem of having code in level blueprint is that for any level you will create same logic, again and again. I have simple RTS with 20 or so very simple maps, doing same even simple logic in every level, then upgrading of fixing bug 20 times, is just nuts.