Download

How to get a character BP to interact with another BP?

I’m getting confused by trying to follow two different tutorials that each have an element of my desired result.

What I want = To destroy an Actor (Item_A) if I press F key whilst in the trigger volume of another BluePrint. I can do this if I add all instructions to the BP of Item_A but I want this to set a Variable that stays with the character. Because if I destroy my actor then it also destroys the Variable.

Here you can see I’m mixing the wrong elements into my character BP. Break Hit is from a line trace tutorial to connect with a object but I’m really wanting to say 'If in the trigger volume of BP_Item_A then do this…

Any ideas?

c43a7b451a1dea9e616df7c033e55bf63e29bfba.jpeg

Hello,
in your character : "get overlaping actors with class filter set on your blueprint then length =/ 0 (only valid if you have only one trigger overlaping. if not you’ll have to loop and check which one you want) on true : destroy actor and set variable in character.
a98a11318f8d7ee532a32ea2b64b1942cce8b4d8.png

Thanks so much for getting me closer, I now have this. When I press F the game freezes :frowning: I’m guessing it’s because I do not have the SET function like you? I’ve looked at the official help page and it says I need to drag whilst pressing alt from an execute node but I’m not getting anything. If I look for SET I cannot find SET on it’s own like you have?

bb115b5ea92901044bf0b6f99386a306587a1ff5.jpeg

To have “set” variable : Create your variable in your character blueprint, then drag it in event graph and you’ll have the choice get or set.
Don’t use your cast. You don’t need it as you ever have your interacting blueprint from overlaping actors node.
Do the same as i did, it works fine.
And don’t let your execute nodes (the white ones) not linked : It is not working when it is not linked.

Thanks! got it working with this. I didn’t quite get the ‘set’ thing, I created a new variable called ‘Type’, set it to ‘int’ as that was a similar colour to what you had. Not quite sure what I was doing but I think it’s what was needed?

9ae8c5b42bd4ff6dcef126c9b1f32dbbc35afeb2.jpeg

Found out that it ultimately won’t work though. I want this action to only happen if I have initiated an event ‘Item_A_Initiated’ but I did that in another BP. So I can’t drag that in my character BP to check if it’s true or not? I brought in ‘Cast to BP_Speech_A’ (where the item is initated) but I’m at a loss how to proceed.

I think I need to make it so when I trigger the initiation in my other BP that it sets a variable (Item_A_Initiated = True) in my CHARACTER bp? but AGAIN it’s that problem of not being able to make an action from BP_A affect something in BP_B ?

c0287c2ab769d9a2c661db2710b8ba10a7d9e729.jpeg

So confusing! I think I’m making it more confusing then it needs to be, hopefully!

I added a variable type (an integer) because you said you needed a variable.
Now that i know more : you can delete the set ^^ Instead use a branch with a boolean “trigger active” as condition (create it before in your character graph). If true then : destroy actor

In your BP_Speech_A when your event occurs : get player character : cast to character : set “trigger active” true.

And then your destroy event will occurs only if your condition event have been done before.

And : Don’t let white nodes unlink : This is one of the main reasons why your blueprint will not work and you’ll wonder why.

Ok, firstly, I know there are unconnected executions. I’ll fix them as I figure this problem out.

I’m going to begin with your comment about the BP_Speech as it sounds like BP_Me is dependent on it. Makes sense;

In your BP_Speech_A when your event occurs : get player character : cast to character : set “trigger active” true.

graph below is BP_Speech_A. ‘get player character’ had no execute socket, the only way of connecting it was through the green one but I’m guessing that’s wrong? I’ve renamed my initial variable to Trigger Active as that is what you’re calling it.

Now that i know more : you can delete the set ^^ Instead use a branch with a boolean “trigger active” as condition (create it before in your character graph). If true then : destroy actor

Confused, set a boolean created in another BP as the condition? It only finds booleans created within this BP (Speech_A)? I have created it in my character BP as you suggested.

e006f3f85c17dcba17f9d8777a52dd80499c96cc.png

It’s scary that I’m getting confused at such a basic level because I plan on expanding on the variables. I have one specific area that tells you an item to fetch, then you get the item and bring it back etc. There will be a lot of ‘If X is true’ commands going on within the same branch and if I can’t even do one of these then I have no hope at all.

Here is the set :
da0467d7a676f044fd0579456fff329e27bc0875.png
d408e1d74c8a43dc10c308f5376caa7b129fa282.png
in character bp, a bool used as condition and in trigger bp, the bool set (i used a custom event, replace it by your own event.)

Edit : I forgot to add a reset trigger active. you’ll have to set it back to false before the destroy node.

Trying to do my trigger first,

  1. Can’t find many casts, even with context sensitive off. Tried dragging off custom event too.

  2. When I set my bool, I don’t get an object slot like you.

plOgSCW.png

The variable trigger active is not in your trigger blueprint, but in your character blueprint. First step is creating this variable in your character blueprint. Then compile and save. Then in your trigger blueprint from player character blue node you drag a wire and type with context sensitive on : cast “the begin of your character blueprint name” and you’ll have it. Then from this cast, you drag from the blue node a wire and type : trigger active and then you’ll have your variable.

Changed the variable name to make more sense. Item_A_Initiated is when I have activated the initial trigger and Item_A_Have is when I have picked it up at another location.

Ok, so this is making more sense but I want to make sure I do understand it. Is this what is happening (on a basic level) ?

**BP_Me ** I still don’t quite get what the length and get nodes are doing but essentially I’m saying 'When self (me) goes over THIS trigger (from another BP) then create variable ‘Item_A_Initiated’. I’m not sure what the = and AND are doing. The branch is asking a question, if that last variable is true then kill self. Isn’t that a mistake? I don’t want to kill me but Item_A ?

BP_Speech_A

Custom event is an event I have created. Am I creating this so that I can pull in this specific custom event later and save wiring the other nodes? Anyway, this event communicates with my player character and it’s blueprint and creates a variable (Item_A_Initiated) inside my character blueprint. Which I use in another blueprint to say this event happened.

Is there a sort of wiki page where you can search and look at every possible node for Unreal4 blueprints?

78a6c63103daa6644545bdb021032c92eb3339d0.png

To resume what happens :

In trigger blueprint : if a particular event happens then it is notified to character.
In character : when f is pressed :
1 : the length check : length returns how much elements are in the array : if length = 0 then there is no element so nothing happens. if length is different than 0 then there is one or more element in the array then event can be activated.
2 : particular event check : if the variable is true then the event can be activated if not, no.

Both conditions are set on the same branch with a “boolean and” instead of using two branches, one for each condition.

When conditions are both true then the event is activated : destroy actor : This is the actor set in the blue wire which will be destroy : If you don’t link the “get” output to the destroy actor input then, destroy actor will destroy “self” so yes : your character… Don’t forget this wire.

To find infos the best place is : https://docs.unrealengine.com/latest/INT/ for everything
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/index.html for blueprints
https://docs.unrealengine.com/latest/INT/BlueprintAPI/index.html for blueprints nodes infos (they are organised in the same way than in the right click search window.

You’ll have more infos / examples on the ue4 wiki : https://wiki.unrealengine.com/Main_Page
and there are a lot of videos on youtube : https://www.youtube.com/user/UnrealDevelopmentKit/playlists

To learn more : Keep time to look at and try both content examples and blueprint examples : Most of all the usuals questions have a reply in one of them. And the other free projects provide good learning too.

Hey Fen, thanks so much. I’ve been checking a few tutorials today and I now have what I want working! I deleted/changed quite a bit of what you’ve put before, the way I’m doing it right now makes much more sense to me. I’m curious if you have any thoughts as you’ve helped me get to this point.

BP_Me

I’ve actually deleted all previous nodes! Only need my control inputs. As you suggested I created 2 variables, item_A_initiated and item_A_have.

BP_Speech

This is the first trigger. Here I’ve just added 3 instructions at the start to enable the first variable, ‘Item_A_initiated’.

BP_Item_A

Here I’ve setup a new simple tree for when input is enabled. It checks if Item_A_Initiated is enabled. So If I’ve gone through the first trigger I can now destroy actor (pick up this item).

Next up, need to figure out how to make it enable ‘Item_A_Have’ in BP_Me before destroying the actor. I thought I could just cast to BP_Me and set it like that? Seems to only work when getting variables though?

iL4xbqS.png

It works ! Youhou ! ^^
And you found your own way to do it : Really cool :wink:

Having the event in character blueprint or in item_A blueprint is exactly the same. In one case you check if the character overlaps an item_A in the other case you check if the item_A is overlapped by the character.

If you have more than one overlapping event item and that they are not parented, you’ll have to do that for each item but in character you’ll can just add the item in your “overlapping actors” check list with the same event and you can better set yout “loot / destroy” event activation (for example, i use a line trace in my character and i use it to, all with the same left mouse click , shoot, loot items, activate buttons / levers and loot destroyed enemies (those are robots ^^).

But the most important : It works ! Youhou ! ^^
If troubles appear later, then you’ll check them ^^

As you thought, yes, to set your Item_A_Have use the same “cast to” to your character to drag a “set Item_A_Have” that you place after the destroy (then if for some reason “destroy” not happens, variable will not be set)
And remember that you’ll have to reset your variables when their events are finished. Your “initiated” can be set to false after the “destroy” and your “have” when (if you use it for loot system, for example) when you add it to your inventory array.

Computer says no,

I’m trying to follow what you say, that following destroy actor I cast to character BP and set ItemA_Have and disable ItemA_Initiated? I couldn’t even get any variables from my character casting. I had to cheat and create the GET and SET in my character BP, then copy and paste them into my Item BP. Obviously that isn’t the solution?

i0GQNTr.png

Why did you add another cast to ? Use the one you ever have before the branch before the destroy actor and drag your variables from there.

Ah now it’s finally gotten through to me, thanks. So you generally SET via the blue nodes? Here I enable HAVE and disable INITIATED.

YUdmryY.png

Each time you need something specific (get variable / set variable / custom event / function / target location ) and everything that you can’t have from the exec output (the white one), you use the colored output.

Edit : Just remember to use your output for a node which is linked with exec wire after the cast too, even far after (for example if you have a branch and after this branch you have a cast on true, dont use it for nodes after false. You need to do another cast to. (in this situation, of course you can do the cast before the branch but not always)). Said like that it seems obvious but when in, sometimes, we forget the obvious.

I’m clearly misunderstanding something, trying to kill a BP now (previous trigger) but can’t find any tutorials. So I’m guessing it’s the same as destroy actor? Here I have added 2 nodes at the end of my item pickup tree. I was hoping it would go on and cast to my previous trigger (speech_a) and destroy it? Doesn’t work.

Midq8oR.png

I then tried connecting from a colored node as you mention but still no luck.

j15fvKl.png

Your cast to is not linked to something ever registered in your blueprint. To have it working, you need to have your input linked from or a “get all of actors” or from a variable created in your blueprint. Then your cast to will have its source where it will find all the infos its need. And one cast is enough. Two is too much. And never let a white output not linked. When white node is not linked it is ignored by your blueprint.