Download

Logic Problem

So I have this variable “canInterctDecoy” that turns true or false acording to a certain overlap.
And as you can see in the yellow print the “canInterctDecoy” switches properly, BUT the same variable in the purple print doesnt switch and always stays true as you can see in the second image:


Here the same variable has 2 diferent values at same time:

Any idea why this is happening?

this is the overlap part:

I think you’re not testing what kind of actor is doing the overlap.

It’s no good casting the player to the player, cause that’s always going to work. You need to cast the overlapping actor to the player, that’s why we use a cast:

image

1 Like

But why and how the same bool variable can be false and true at same time? as you can see in the images the yellow print changes if its overlaping or not, while the purple print always stays true and they are the exact same variable.

And unfortunately you sugestion dindt fix the problem :frowning:

This. IMO you need to check if what you are colliding with has the BP Interface, if it does then = true.

Also there is a Branch here with no bool attached: what’s its purpose if it will always have a fixed condition?

" This. IMO you need to [check if what you are colliding with has the BP Interface] if it does then = true."
this is what i am doing, but not with interface, I call the funciton “Can Interact” and send a value true or false if its colliding or not:

The “can interact” event recives that bool and prints the value as yellow:
image
image

AS you can see in the prints the event “canInteract” recives the right value and sets that value to the variable “canInteractDecoy” (notice that yellow print)

The problem is that the same variable “canInteractDecoy” can be false in the yellow print as the same time is true in the purple print

That branch you mentioned need the condition given by the “canInteractDecoy” but since in that purple part its always true, I unplugit just for testing

But for now i just nee to know how can be the same variable true and false at same time

It’s not possible. It’s probably just running the entire thing or enough to trigger =true & =false without any stops.

1 Like

Yes i know its impossible thats why this buggin me out.

I just conected the “canInteract” event output to the purple print and the branch and works how was supose, i just dont get why doesnt work with the variable, and Im afraid that i may need that variable in the future

If you wanna dump a cut down version of the project somewhere to download, I will take a look.

I humbly suggest: if you are going to use overlaps, always check if valid desired actor then logic after branch. If not you can trigger an overlap more than once unintentionally.

Dont need to bother with that its working for now, i will just hope i dont need that variable in the future probably its not a big deal anymore. But thank you very much anyway for the help :slight_smile:


Like this or reverse? this is in the player character blueprint and here i check if the decoy is valid, you menat this or the other way? (in the decoy i check if player character is valid)

1 Like