Boolean value doesnt change when casted from another BP

First of all, I am only 3 days in UE4 as of today, watched several videos and followed this tutorial to make my own “infinite runner”: Endless Runner: Overview & Player Control | 01 | v4.7 Tutorial Series | Unreal Engine - YouTube

So the problem is that it won’t move if the Boolean isn’t set to true from beginning. Tried the overlap trigger, event tic but no success.

Don’t know what else to do but to ask for help…

Any suggestions?

The selected component is the area that should trigger the bridge on pawn overlap

The overlap event that casts to BP_Bridge to change “Start Moving Component” to true so the “Bridge Component” starts moving 750 units

This “bridge component” will move as soon as it spawns when the Boolean value is set to true from the beginning

Bridge component when idle and after moving

How I am casting to BP_Bridge to get the component moving. Won’t work no matter what I try.

The Other Actor pin refers to the actor triggering the overlap event. Are you sure it’s of type BP_Bridge and not player?

You can drag a wire from the Other Actor pin and get it’s DisplayName then print it on the screen (node PrintString) to make sure you get triggers coming from the correct actors.

I made kinda a breakthrough.
Managed to get the bridge moving, but doesn’t move always.

Video link: [YouTube link][1]

Currently used in BP_Bridge event graph

Currently used in BP_FloorTile_Bridge event graph

What you’re essentially doing is trying to cast a Pawn to BP_Bridge and if your Pawn is not a subclass of BP_Bridge the cast will fail.

So the question is, what are you trying to cast to Bridge?

Did u check the reply I made few minutes before your reply?

I am trying to access the boolean value on BP_Bridge, change it to TRUE when the “RunCharacter”(pawn) runs through a Box Collision, so the “BridgeComponent” moves 750 units when the Boolean value changes, isnt it visible from the pictures…?

Too put it the most simple possible: I want to update a variable on another blueprint via a overlap event on the first blueprint

OK, I’m getting the feeling you don’t quite know how to properly use casting.

Casting, in layman terms, can be described as a form of checking whether something is of particular type. More info here: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/index.html

If you’re trying to create a new object you need to use Spawning: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/SpawnAndDestroyActors/Blueprints/

If there is a particular bridge actor (already existing in the scene) that you’re trying to move, you will need a reference to that object before you can manipulate it. I suggest you watch this training video about blueprint communication: Training Stream Training Blueprint Communications with Zak Parrish

Thank you for the suggestions!
Your feeling is right, I don’t quite know how to use it, especially in this particular case!

I did watch that video and did get the idea of using the Dispatcher, but I would like to solve this problem before attempting to do it with dispatcher. And I already have the feeling it making much more sense to use Dispatcher!

I am trying to explain it in the best way I can, thanks for your patience!

Here is another video with me speaking, I hope it does explain what my problem is right now, and what I don’t know about casting with that certain node: - YouTube

Sorry for my bad spoken english!

One way to do it would be to create a new variable of type BP_Bridge in your BP_FloorTile_Bridge blueprint and make it visible in the details panel (click that eye icon to the right of the variable).

81761-var.png

Then, in the actual scene, you need to assign your particular bridge actor you want to move to that variable.

Finally, because you now have the reference to the bridge you can just use that variable and set your boolean.

Couple of notes:

  • When you use boolean variables, they should ideally define the state of something, like IsBridgeMoving
  • You should make a function like StartMoving in your bridge BP and call this instead of setting your boolean, as it is more intuitive (notice that functions names are almost always verbs, to indicate action)

That’s very helpful! Thanks!
Didn’t even know u can do something like this!