Communication between two blueprint actors

Hi guys!

I have two blueprints. First one is responsible for enemy, second one - for spawn area (like room or something like this).
Now, I need Room to spawn Enemy:

  1. when player is in proximity (distance<500)
  2. (if previous enemy was killed and player is out of proximity) when player reaches proximity once again, spawn next enemy.
    Is there a way to do it without storing reference to Room inside of the Enemy instance? Any help would be appreciated.

You can check in your spawn blueprint if the Player is near enough. When it is, cast to your blueprint to spawn the enemy. Here you Need a reference.

But you can also do this with a blueprint Interface. Make a Interface and in this simply make a function like Spawn. This Interface Need to be Setup in both blueprints. Then, when the Player is near and you want to spawn, you can call the Interface message (this message calls then your function).

Thanks, but the main problem is still unsolved - how do I spawn Enemy only when the previous one was killed (destroyed)?

I would highly recommend to invest some time into making a system that will allow you to communicate between any blueprints as you wish. Basic idea is very simple: you have to use event dispatchers. Event Dispatchers | Unreal Engine Documentation

So, here is how I did it for my project and it works very nicely:

  1. make an event dispatcher in a common class that everyone have access to, like Game Instance/Game Mode. You can use input parameters, for example: FName: cmd, String: param1, String Param2, etc.

  2. Make a custom event that will call that event dispatcher to subscribers

  3. in actors/level bps bind (subscribe) your processing event to that event from step 1. if you expect to receive something, place a switch on cmd to filter out what is not for this blueprint

  4. when you need to send an message to someone else: cast to your game instance / mode, and call function from step 2.

Using this universal method you will be able to communicate between level blueprint and actors, actors and level blueprint, actor to actors.