Event Dispacther from NON player BP and Level Blueprint

If by delete you mean Destroy, then you don’t even need a new dispatcher. On Destroyed is already a thing.

I really like pasting images from clipboard rather than uploading...

Every time ActorA gets destroyed, it notifies the GI, the GI will notify the LB.

oh… basically ActorA has been destroyed and once done must be replaced with ActorB. But to do that I need to spawn ActorB with a owner in the same levelmap using LevelBueprint.
It doesn’t work spawing from ActorA so that’s why I need to use a “bridge” like GameInstance

So in your example:

  • ActorA send data that has been deleted
  • GI listen and resend data
  • LevelBlueprint (of each levelmap, that is what I need) are listening

Is that correct?

Yup.

ok but why I see 2 EventDispatcher?

Actors come with Dispatchers already…

image

All I’m saying is that you don’t need to manually create and call a dispatcher when an actor gets Destroyed. It already exists and will be called. You just need to register it. As seen here:


You add custom dispatchers when the available events are not what you need. Or when you need to dispatch specific data. Destroy is an event that even sends the reference of the Destroyed Actor.

It will all work the same anyway.

We don’t even know what’s it gonna be. For as long as it inherits from Actor, it’s already there.

1 Like

one second, thank you so much for youe help because during these days I lost all my energy. But I think the situation is different…

Above you can see our “AactorA”

as you can see ActorA has been hit, an after few hit, it destroyed. Then it has to start with a set of operations, one of them it is to say to the current level BP that it has been destroyd

You should probably Destroy the actor after the calls, not before them.

no I cant. This is the ActorA that cannot overlap the ActorB, secondly spawned

oh sorry, just after the calls… oh ok :slight_smile: I will but first I 'm a bit confused yet about the process… I think I’m feeling tired after one year of coding.

Let me share what I’m doing based on your example

Sorry but I’m a bit confused now :). Here I have all of them:
Actor A
GameInstance
Level BluePrint for all maps

Level BP doesn’t receive the variables from Actor A… I think the problem is in the GameInstance as you can see

I’m currently trying your GameInstance just created a custom event which calls the ED in GameInstance.
The problem is that the levelBlueprints don’t listen to the gameinstance when the ED is firing

in both cases… LevelBlueprint doesnt get the communication whenever actorA has been destroyed.

Just simple question, why it must be level blueprint that have code?
I do not know single reason to use LB.

I jest remembered one tiny detail.

Blueprints and actors load sometimes in strange order.
Level Blueprint is always first, when it starts some other blueprints may not be yet loaded.
For debug such issues (in level blueprint) add check if other actor exists and is loaded, then print result.
On top of all that loading is sometimes diferrent in editor game and in released/standalone game.
So do checks for all missing references.

These 2 are somewhat good reads on the above-mentioned subject:


One note, the Garbage Collection section was not updated when the GC manager (orwhatshername) was introduced / rewritten (around 4.16 - 4.17 perhaps?) so that part may be inaccurate. Probably irrelevant here, though.

Each level has unique gameplay mechanics that appears in that level only? Grasping at straws…

What if you have two levels with same mechanics?
Making inherited game mode with new level mechanics would be better.
Btw. I know that you know. :wink:
Just really curious why ppl are doing code in level blueprint.
Anything i can think of can be coded better elsewhere.
And on top of that level blueprint code is nightmare to maintain.

PS. (I did not read whole topic again, so i may have missed some answrs)
But, i just remembered some small and dirty hax for similar cases.
When i have trouble with referencing actors (hard to get that pointer/reference).
For those cases i create variable in one of blueprints (game mode or something),
Then from actor i want to be referenced i set that variable to that actor pointer.
Now anything that needs that actor can just get what it is in variable.
Yes this is dirty hax, because if referenced actor gets reloaded, pointers may be outdated.

I’ll admit I don’t know what OP’s issue really is. The script I posted is from a working example and can be simplified further by removing the Custom Event in the GI and calling its event dispatcher directly.

  • Actor calls GI’s dispatcher → LB receives GI’s call. That’s pretty much it.

Apart from working in level reloading and ensuring the order is correct for standalone, that’s really it. I don’t think it was explained how the levels are supposed to operate or I missed that.

When talking about hacks (which, imho, are unnecessary but may be necessary for something unorthodox), one can always place an actor with a tag in each level, fetch it by tag and bam, you have access to the level blueprint.

Ok I have to fix the point. As was partially right… I mean.
In my case I’ve been force to use 2 Dispatchers because just using one doesn’t work, because of the level BP.
So ActorA sending data - First LevelDispatcher receive data and it pass data to an event, the second dispatcher here is the only one able to communicate with levelBP
Now works! :slight_smile:

1 Like