Hi, I’m trying to implement a system where civilians flee when a crime is commited and when all is clear they go back to being idle. The problem is that I thought I had a solution in mind using event dispatchers but they confuse me somewhat.
Here’s a few screenshots. Note that all of this is on the same class (blueprint)
Here’s the binding for the event, when the event is called the NPCs go back to idle:
Here’s what’s sort of confusing me. When I call the event it requires a reference to the object that holds the dispatch. Since the class itself holds the dispatch my assumption is that the call will propagate to each instance of the class. This doesn’t seem to be the case, the call event of the first image triggers on the instance that is calling it and no other instance. If I get all actors of the class and call the event on each instance it works just fine (second image).
So my question is: what are event dispatchers used for? If I need the reference to every instance (not class) that holds the dispatch, why would I use a dispatcher and not just use interface calls or a function call directly on the reference?
Thank you!