Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to trigger level blueprint event from Actor BP?

I have an actor blueprint called BP_Interactable_Object that I use for objects that the player can interact with (doors, drawers etc.) I made the blueprint very dynamic in that I can swap the mesh as well as change the type of animation (move or rotate). I now want to add some functionality to allow the actor "Activate" (trigger) an event in the level blueprint like causing a lift to move or turn off a light etc., but I'm not sure how to go about doing this and all of the searches I've done say that you cannot communicate from an actor to the world which seems unbelievable to me.

I started by creating a custom event in my BP_Interactable_Object called "Activate". I then get the game mode, cast it to my game mode and then trigger an event inside the game mode called Interactable Object Activate. The reason I did this was because the game mode is a requirement of every level.

I then created a function inside my game mode blueprint called Get Nearest Interactable Object. This gets all actors of the class BP_Interactable_Object and grabs the one closest to the player so that its not activating all of the Interactable Objects (or only one of them).

From here though, I'm not sure how I can send this info over to the level blueprint to allow for triggering level specific events.

Here's a look at my blueprints so far:

alt text

If it is truly not possible to communicate from an actorBP to the levelBP, then how would one go about enabling interaction with an object to trigger a dynamic and custom event? I.E. when I interact with one door, I might want it to turn off a light in the level, whereas I may want another door to trigger a skeletal mesh's animation. I want to allow the level designer to create these links between objects when the door is interacted with and as far as I know, that sort of thing is only possible through the level blueprint by getting a reference to a specific actor.

Product Version: UE 4.10
more ▼

asked Sep 16 '16 at 01:16 PM in Blueprint Scripting

avatar image

1.1k 81 110 143

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hi. I just want to advice you to learn Event Dispatcher.( https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html ). This is the way you can make actors to call level blueprint's functions. The concept is following: Level BP subscribes to actor's events and when they're fired inside actor BP, Level BP handles them by calling appropriate function.

more ▼

answered Sep 16 '16 at 08:22 PM

avatar image

54 4 5 9

avatar image TorQueMoD Sep 16 '16 at 08:53 PM

Thanks plastik21, I'll be sure to check it out!

avatar image delcasda Jul 06 '18 at 01:34 PM

what about when the actor event dispatcher is created at run-time? is there anyway to get LevelBP subscribes and unsubscribes at run-time?

(comments are locked)
10|2000 characters needed characters left

I had an epiphany this morning when I woke up and realized I was trying to approach this in a completely convoluted way. I'm writing this update to help anyone else who might be having a similar problem when trying to understand how to communicate between a level blueprint and an actor. The first thing I realized is that there is a specific reason why the communication between the level BP and an actor BP is one way. The level has to know about each of the actors placed in the world, but the actor doesn't need to know about the level. This would make the code overly complex.

If you want to create a system where one of the actors in your scene can communicate with the level in the same way I wanted to - i.e. open a door and trigger a level event - then all you need to do to accomplish this is create two booleans inside your door blueprint. Call the first one Activator?, and make it a public variable. Then when the level designer is placing the door in the world, they can check off the Activator bool if they want it to activate something. Name the second boolean Active? and set this to true just before the animation happens and set it to false when the animation is finished. Then inside the level blueprint, you simply get a reference to that door and use a branch to check to see if the Activator? and Active? states are true. If they are, you can run whatever code you like. DONE!

Here's a look at my blueprints:

alt text

I don't know why this was such a hard lesson to learn, but there you have it. Hopefully my question and answer will help someone else.

more ▼

answered Sep 16 '16 at 06:29 PM

avatar image

1.1k 81 110 143

avatar image MikeandRosa Jan 14 '17 at 10:35 PM

I really like what you did here! I had a quick clarifying question: Can this technique also be used to "trigger" a matinee actor from inside a different actors event graph?

avatar image TorQueMoD Aug 25 '18 at 10:50 PM

Technically you could use this to trigger anything but plastik21 is right, Event Dispatchers are the way to handle something like this. There's also less overhead because you're not using Event Tick to constantly check for the event to occur.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question