Download

Call a custom event iin random blueprint actor type from another blueprint actor.

I’m not sure if this is possible, so I figured I’d ask.

Let’s assume I have three actors.

blueprintSpecialEffect
blueprintHuman
blueprintOrc

My goal is to have blueprintHuman or blueprint Orc spawn blueprintSpecialEffect, blueprintSpecialEffect will then perform an action, and once this action is completed tell the creator blueprint(blueprintHuman or blueprintOrc) so.

I know you can pass an actor reference and then call a custom event in that actor but this will not work because I’ll be creating blueprintSpecialEffect from many different actor types.

I could use a generic actor reference but then I would have to cast to xxxxx before calling the custom event. This may work but would be a lot of extra work and not very ideal.

Is there a better way to do this?

To give you an idea of what scenario I would like to use this in …
blueprintHuman dies in game, blueprintSpecialEffect does some fancy animation(let’s ignore the fact we’d do this other ways since this is just an example), once fancy animation ends a call is made to blueprintHuman informing it that the animation finished, and that blueprintHuman may be destroyed(or other actions).

By many different actor types you mean what?

Lets say I have three different blueprints. Each blueprint is spawned at random (so not static to the level). One of these blueprints might spawn another blueprint, telling it to complete an action. Once said action is complete the first blueprint should perform it’s own action.

Have you looked into Event Dispatchers?

I have, and I’ve read so many articles on them. I’ve used similar techniques in C# but I can’t seem to understand how to call an event dispatcher to a unique blueprint from another spawned blueprint.

The SpecialEffect BP will inform the Orc BP that something has happened. Every time you PlayTheSpecialEffect, it will broadcast the *Result *message to **anything **that is listening.

  1. Perform the action
  2. Call the Dispatcher

96ecdfe7df5d1cc18ab23c7b372932470fb2546b.jpeg

The issue is that no Orcs are listening atm. Lets fix that.

  1. The Orc is about to die
  2. We’ll spawn the SpecialEffect to demonstrate its demise
  3. Make the Orc *listen *to any potential Dispatcher messages, whenever they happen
  4. Play the Special Effect which will fire the Orc’s bound custom event

cad0307d70b0aff294e82f6e7ae9863de533a879.png

Think I understand now. Will test it when I’m able to and let you know. Thanks.

Just wanted to let you know event dispatchers worked perfectly. Thank you.