I want to make sure that whenever the player completes the level, the enemy gets destroyed, but I cannot seem to find a way to delete the trigger to delete the enemy from a separate blueprint.
You could implement an interface in your enemy blueprint. With this you could execute an event when you completed the level to destroy it. (for 1 enemy)
Or you add an EventDispatcher and Bind an event in the enemy blueprint to it. So they wait for the call of the EventDispatcher and then execute DestroyActor with target self. (for multiple enemies)
How would I go about implementing an event dispatcher?
So in e.g. your PlayerCharacter you would create a EventDispatcher you call on GameOver/LevelComplete and in your enemies you would bind an event to it. Here is a video that shows it. He uses lamps which change their color, here you would use your enemy blueprint and execute the DestroyActor.
Sorry about the lack of reply. I have been busy and have not got to continue working on my project to fix this issue. I will fix continue on this as soon as I can.
it is not working. I cannot call any event from my Elevator Blueprint which makes it impossible to tell whenever the level is actually completed.
Use the Game Mode class to handle it.
Hello, you can use End Play method and use Destroy Actor, that kill all enemy
This method will be work when your game over
Still no luck. I think I need to explain in full detail with what I am working with. I have a separate blueprint that is just a trigger and I want that trigger to destroy my AI that is also on a separate blueprint whenever I cross that trigger. The trigger, AI, and Player are in completely separate actors.
so it would be like this?:
- PlayerCharacter runs through the trigger
- Trigger checks if the OverlappingActor is the PlayerCharacter
- Trigger executes event that kills all AI enemies
Which UE version are you using?
That is exactly what I am looking for. I am using Unreal Engine 5 Early Access
Ok, so 1 example would be:
Trigger blueprint (Blueprint of type Trigger):
That would look like this in the level:
Green = Trigger
Cubes = NPC
Yellow = PlayerCharacter
I will attempt this as soon as I get time to work on my project again. Thank you for helping.