How to access one blueprint from another via input?
So I have this, lets call it a switch, that I have the player enter it's trigger volume and it prints a message that it has registered the player. Then I allow it to accept input to which I have assigned the F key. After the player presses the F key it prints another message letting me know that the key was pressed. Everything up until this point works exactly as desired. But after this point I'm needing to access another blueprint to have that one do what it needs to do. Currently the only thing I have my other blueprint doing is printing a message to let me know it made it there. My trouble comes in when I can't seem to figure out how I actually get to my other blueprint to get that last message. Currently I have no errors or warnings but the code stops right where I am calling my function from the other blueprint. Below are 2 screenshots, one of my trigger blueprint and one of the wall blueprint that I'm trying to activate. Any help would be greatly appreciated.
asked Aug 05 '18 at 10:51 PM in Blueprint Scripting
What you're going to want to do is Cast to the blueprint that contains this function. You have the function Puzzle 1 Solved contained in the blueprints for the wall. So in the blueprints for the Puzzle_1_Trigger_Blueprint you will have to add a Cast To Puzzle_1_Wall_Blueprint after F is pressed. Then you would add in the Call Function node and instead of the target connecting to a different variable you would add it to the "As Puzzle_1_Wall_Blueprint":
This is a recreation of your function. Which I have placed in the blueprint Actor_Apple:
And this is how you would call to that function from another blueprint. Use the "cast to" node which you would obtain in your case just typing in Cast to Puzzle_1_Wall_Blueprint. Use the get all actors out of class node and the "Get" node for the object. And then you'll notice that the call to function is connected to the "As Actor_Apple".
And lastly, you're going to want to have enabled the ability to have inputs in the blueprints for something that is not a character blueprint so pressing this button will actually work:
answered Aug 06 '18 at 12:14 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here