How do I get the variable from another blueprint? What am I doing wrong?

I’m creating a checkpoint thing, where when you touch an object it adds a point to a variable, and when you collide with the floor if checks the variable and depending on the value it teleports you to a different checkpoint. I attached photos of the blueprints. One of them is the blueprint that has the checkpoint variable and whenever you collide with the object it adds 1 point to the variable and the object teleports to the next checkpoint. The other blueprint is where I was the variable. The blueprint is supposed to use the checkpoint variable and add it to the Teleport variable (which is a new one) and then if the teleport variable equals 1 then the player is teleported to the checkpoint. The only problem is that the cast to thing doesn’t work. I think the problem is that I connected other actor to object, but I might be wrong.

Is the first BP inside the player? It should be ok.

If the player is falling on the chair, and the chair has the code and collision box, then the chair needs to check if the other actor is the player, not itself :slight_smile:

Ok, if the bottom one is the chair, whenever something overlaps it ( it doesn’t check what ) it will add one to teleport.

The top BP, whatever it is, will check if the overlapping actor is a chair. If it is, it might teleport depending on the value of checkpoint + teleport.

Instead of casting to a chair, cast to the pawn:

349594-screenshot-1.jpg

That’s what the cast is doing, it’s verifying the identity of the other actor.

You could also cast to the player:

( or 3rd person etc ).

Neither of them are in the player. The one that I want the variable in, is in the object that the player falls on and sends them back to the checkpoint. The one that sets the checkpoint variable is in the object that when the player collides with it, it adds a point to the object. Neither of the blueprints are in the player.

You’re talking about the second image right? The one on the bottom? That’s the blueprint for the chair. I tried setting the other actor (from the On Component Begin Overlap (Box)) to get player pawn, but it didn’t work, it won’t attach to player pawn.

The player falls on a platform and is teleported to a certain checkpoint depending on the variable value at the time. Whenever the player touches the chair, it adds a value to the variable (atleast it’s supposed to). For example, if the player touches the chair for the first time, the variable becomes 1 and whenever the player falls onto the platform they are teleported to checkpoint1, and if they touch the chair again then the variable becomes two and whenever the player falls onto the platform they are teleported to checkpoint2.

For the chair, it’s fine if it adds a value if anything overlaps it since there only thing thats going to be able to overlap it is the player, but with the the top BP how do I make it check if the overlapping actor is a player and not a chair?

If I do that though, then how do I get the variable from the other blueprint?

Saw your answer. Was wondering though, if I cast to the player or pawn, then how do I get the variable from another blueprint?

In the video isn’t he just casting? I did that in the top blueprint. I had it cast to the chair blueprint, so I could get the variable from it. Also if I cast to the player like you said, do I attach anything to it?

You need a reference to the chair in that top blueprint:

Ok, not a great example, he named it badly, try this:

You can make a variable in the blueprint which points at the chair. Casting is not for communication.