How do I communicate between two different class blueprints?

This seems like it would be one I can search for but as with most things, every answer given does not solve my problem.

I will simplify.

I have a player (Class blueprint) and I have a volume (Class blueprint). I will have a lot of these volumes and when I step in one with the player, I want a bool to be sent to the player blueprint so a function within the player class can be fired. I tried all the videos available, the power-up tutorial on the wiki and a handful of suggestions from the forums and from the answer hub.

Now I am not saying that all of these options are wrong…there is obviously something that is not getting through to me and I would like to explore that here.

Thank you for your time in this matter…I have run out of options to try or I would not be wasting your time with stupid, apparently easy to accomplish problems.

Event that you will use to detect when player moves in to volume should return instance of player pawn which then you can cast to your class and edit the varable

Hey mikezteh69,

For your two scenario, here is an example setup you can use:

The top graph is what I used to represent the Volume blueprint you want to place multiples of in your level. Whenever your character walks into any instance of that volume, it will trigger an Overlap event that passes the “Other Actor” into whatever functions you want to call (“Other Actor” in this case is your Character). In order to call functions on your Character, you have to Cast that Other Actor to your character class–in my example I’ve called it MyCharacter. If the Cast To succeeds, it then tries to call the MyFunction function, which I added to my MyCharacter blueprint (the lower graph in the screenshot).

Hope this gets you back on the right track for finding a solution!

See this is where something goes strange. This is where I was stuck before. Everything works until I try to place the “MyFunction” node in the MyVolume EventGraph. It is like it doesn’t exist.

Have you compiled the character blueprint? I can replicate your issue if I don’t compile the character blueprint before I try to place the function in the other blueprint.

Yes, everything is compiled and in place. Let me share some images.

Image one is coming off of a tick and image 2 shows the function. Image 3 shows the volume.

So I am ticking to check if the bool becomes true and if it does it will send the message in the print text field. Everything is compiled with no errors. But it never seems to pass the bool as though it doesn’t even exist.

Image 3 i couldn’t post.

If I’m reading this correctly, you need help with image 1, correct?

I don’t think you want to call a function there - you want to cast to your character and get the value of Shadow Bool. I could be wrong, but I think you’re actually setting your bool to false every time you’re trying to print right now because you’re calling your function with an input of false for your bool.

Well the character is holding a lot of stats. One of the stats gets reset when he steps in the volume. So as I understood it from the original answer from Epic above, the function outputs the result. So far so good. But the result being cast from the volume is not updating? That is why I am confused. I honestly could not tell you what part is broken but I can force it to work by checking the Shadow Bool box. So the error is there…it does not change when I step into the volume.

What I mean is if you look at image 1, you call SladeFunction. You don’t want to do that at all - you want to drag out from the “as your character” box, wherever that is, and use a “Get Shadow Bool” node instead.

Pretend “invulnerable” in my picture is your “shadow bool.”

5366-ue4_get_var.jpg

I am not 100% sure I follow, but I cannot get the bool as it is not showing for me to use here even though it is public.

It looks like you’re in SladeShadow in this case, can you just drag it onto the event graph and connect it to the condition of your branch?

Attaching a picture of what I mean.

Image 1 is my character. You can see available variables there.

bIsHidden is in the second image (In the volume). Ultimately I am trying to pass that variable forward.

I think I see what you want to do here.

  1. Add a variable bInShadow to your SladeShadow.

  2. Connect the first node of your Slade Function to a Set node of bInShadow with the value of whatever the input to the function was.

  3. See my previous picture and drag bInShadow in as the test to your branch.

Can you show me this visually? The reason I ask, is because it seems to me that I have all the required nodes and variables in place. The problem is just telling the system how to change the bool value once it has it.

Make a variable on the player for whether they’re in shadow or not. (You may already have one.)

This is your trigger:

5465-ah_trigger.jpg

This is your player:

5466-ah_player.jpg

I don’t think you really need a function here, you’re just checking the value of a bool.

In your ShadowVolume replace calling a function with the Set (VariableName), I didn’t know your whole ShadowVolume blueprint so I just pretended it started with an event and went to the cast I saw.

Edit: Adding modification to one of your pictures.

5477-ah_sv.jpg

What is firing off the custom event though?

Sorry for the late response!! I have been slammed at work. BUT you nailed it. Apologies there was something that just didn’t click in my head but I managed to finally make sense out of it. Thank you very much!