Changing a variable from another blueprint

I want to decrement a variable(EnemiesAmount) after the NPC(a character) dies. The variable is saved in the EnemySpawner(an actor). I looked into communicating between blueprints but can’t quite wrap my head around this issue

In the blueprint that does the counting (Enemy Spawner) you could:


Ideally though, since it’s a spawner, it’s safe to assume this is where the enemies are created; instead of the Get All node, you’d actually bind each Enemy’s onDestroyed as they spawn and increase the counter by 1.

A preferable method but I might be assuming too much:

Thanks for the answer, how would you call the event from the Npc? The actor isn’t overlapping or a child class, so I wouldn’t know where to get the object.

The 2nd Solution is how I did the spawner. only going from npc to spawner is the problem.

Thanks for the answer, how would you
call the event from the Npc?

You do not need to, it will be called from within the actor that is being destroyed. The spawner is just picking up that very broadcast. You’re already calling Self → Destroyed in the enemy after they’ve received enough damage, right? (in the original image)

By registering the onDestroyed event as demonstrated above, you’re asking the Spawner to execute a Custom Event whenever an enemy is destroyed.

No need to cast or worry about references. :slight_smile: Try it out.


Actors come with a bunch of Event Dispatchers already, the onDestroyed event is one of them. There are many others and new can be added, too; each can carry any data you desire.