Okay, all I want to do is make 2 blueprint objects interact.
Let’s say I have two actors: A blueprint for a switch and a blueprint for a door. I want to make it so when I click the left mouse button on the switch, I cast to the door and play the animation on the door.
My problem is that I can’t figure out what the light blue “object” reference in the casting node is suppose to be wired into.
I know that when you reference a character, you simply use “get player controller”. But on just regular blueprint actors, nothing seems to work. Get player pawn, get player character, get gamemode… nothing. Now I’ve heard that you’re suppose to create a variable that you use a reference? But I’m not sure how that works at all. Maybe it’s late and my mind has turned to mush… but I can’t for the life of me figure this out.
I have noticed that most events, such as hits or overlapping, includes pins for “other” as an actor reference, but mouse clicks doesn’t. Is it just not possible? XD
There are several things that could be wrong, So I think a picture or two of your BP graph will help me understand how you are doing this.
This is how I would handle the switch and door:
have a “Actor Reference” variable in the switch, This will be a reference to the door.
Call a Function or Event on the door to open/close it when the switch is activated(via a trace from the players camera)
Done
The variable should be marked as “Editable”(click the green eye next to it in the window pane), Then set it to the door when it is placed in the level.
If you are not already, I recommend reading the beginner tutorials on blueprints to help you get started as you sound like you are not well versed with programming.
That is why I recommend doing some beginners tutorials to learn how blueprints work
I suggest going over these, And is one from that list about BP communication.
I should be able to get some pictures uploaded in the next few hours.
HTH
Edit: I have just seen the video, Going over it now.
Your video inspired me to do this straight away, You clearly and efficently showed me what you wanted.
This is a good skill!
I have created a picture with what is hopefully a helpful depiction of the info:
Oops, the Event despatcher binding example should have been a Bind node instead of Unbind.
Depending on how generic you want this you may want to look into using a “Interface”, Which will allow you to create a abstract representation of how to intereact with the object without having to know how it is implemented or where.
I really need to an example that strips everything down to the basics. One BP that has an object you click on that activates an animation on another. I really can’t believe it’s so involved. Makes me a little depressed.
So… I noticed the teleport station 4 in your example has “from persistent level” on it. Does this mean that the level BP must also be used to accomplish this task?
More simple than I thought. Just create the dispatcher in the BP that I want to actually do something, bind it, and then “call” that dispatcher in the BP that I want to trigger the custom event that tells it to animate. Wow! Now I can get some work done.
It is actually easy once you understand how it works, The problem is getting your head around this stuff.
That is not using the level blueprint, That is saying that teleport station 4 is assigned to the “Other Side” variable.
The teleporter calls functions on the variable “Other Side” to communicate with it, But the simplest way to link one teleporter to another is to make the variable editable and then assigning it a value once placed in the world.
Unfortunetly I have not uploaded to YouTube before, So I think the best thing would be to watch a video showing the steps.
But I don’t know of a video off hand.
Are you using the level blueprint?
There is a documentation page about blueprint communication , It has a short write up about the different ways to communicate between them and a picture showing the nodes.
I’m going through the same hell you are. I’ve read the documentation and watched countless videos. I finally got one method using the Level blueprint to work. I can’t help but think that something so integral to games (communication and passing stuff like variables between blueprints) could have been made easier.
I’m assuming that I’m just ignorant as to why referencing a blueprint couldn’t have been easier. So, let me ask the experts out there…why can’t I just go to a list of blueprints, click on the one I want to connect with and get access to its variables?
Hey, looks like you’ve overcome the issue already, great! I have been struggling with exactly the same thing over the last few days. While looking for my solution I found this video which explains how to toggle 3 lights’ colours from another blueprint nearby, maybe it’ll be helpful for you still or somebody else:
I would replace the flip flop with a boolean that is set to true when the animation/speech is playing and decide from that.
The accessed none means that one of the variables being used by the nodes does not have a value assigned, I recommend placing a breakpoint(F9) on the node(s) that assign the variable a value to get a better idea of what is actually happening.
The timer may need to have its return variable assigned to a variable to avoid GC (garbage collection), I have not tried creating a timer without storing the result from it.
(The different animations/speech things for different objects)
I have not gotten into the animation side of things yet, But it looks like those nodes take a variable to set what animation to play.
I would probably create a dummy actor BP that registers animations and speech files to the “pac man” BP and give each one a ID that is sent to the BP for when a object wants him to popup and say something.
Then all you have to do is pull up the animation and sound file for that ID and tell the systems to play those.
As to the complexity/difficulty of doing this: I have had something that I have needed to do that I thought were really complex/difficult, But when I have actually done it and understand it; It turns out to not be as complex as I initially thought.
Glad you got it working,
Good luck with the game
I also suggest looking through the videos tutorials and livestreams done by Epic .
You may or may not find some useful/unteresting ones, But all of the ones I have watched are of a high standard.
Thank you. I fixed the error by establishing the widget variable on event begin play.
's another video demonstrating an issue I’m having with making my character sit down on the loveseat. I disable the input when he sits down, but he still moves to a clicked location after the input is re-enabled. Thanks again for all your help, and I will definitely keep watching tutorials on these subjects - but sometimes it’s hard to find a solution to exactly what I’m looking for.
Hmmm… Take a look at this video, the thing about a cast is that it also checks if what you’re casting to is indeed the the specified object (in this case the player character) and not some roaming AI for example
In the examples below i show some ways of checking if the object is valid and being able to get the variables from said class for use in another.
What you should really be using is an interface to communicate between BP’s, this should also allow you to get that junk out of the level Blueprint as well
Edit: This is not limited to variables either, when you get into using interfaces you’ll need to understand the concept of targeting which the blue object/actor pins can be used for also
If the target isnt specified then theoretically anywhere you have that interface added to will be called, so you could potentially open up every door in your level at once, which is not helpful :3
I can’t recall off the top of my head if the engine has a failsafe to prevent these sorts of things.
I may be doing things wrong and there may be better ways, but I’ve only worked with this engine and programming in general for about a year or so
Thanks DP, i’ll grab some popcorn and check that video out. I have followed tutorials before where I’ve setup BP interfaces, such as the Twin Stick Shooter. But I didn’t really wrap my mind around how it functions.
I’m to help 100% because I too couldn’t wrap my head around an interface, but once you realise how to use them you’ll feel like an idiot haha :3
And yeah, problem with some of epics tutorials is that it feels like your watching them make content and not actually living up to the definition of a tutorial.
Also, Matthew Wadestein has a **** ton of tutorials covering a lot of UE’s functionality