Variable work incorrect

I need that when entering the trigger, the character goes to another actor when the button from the Widget is pressed.

Everything works, but when I want to get a variable that indicates that the light is on, the project behaves strangely. With a “no” answer, in case the value is incorrect, a null value is seen. Which shouldn’t have been. The value 0 should be after 3 seconds, not after 0.7 seconds as I configured “no” in the Print String.

The variable itself is in a widget that I named “UI_Cam”.

Please, help me. What did I do wrong and what should the blueprint look like?





Hey @foxyandr!

So if I am looking at this correctly, this is a FNAF style camera and game where you switch to the camera and turn on a light, scaring (I am assuming Mangle) away. Is that right? It’s not quite clear what you mean by

Could you explain that in a bit more detail about what exactly is going wrong? Is the light not registering? Or is it not running long enough?

I can also see some errors being thrown in your blueprints.

“Item” is already a “Item Type”, you don’t need cast to Cast to Item Type. Have you tried removing the casts and plugging the values directly into where they are intended to go and see if that makes any difference?

Any additional information you can provide will go a long way in solving your problem!

1 Like

Yes, I need to scare Mangle away with a light.

About what doesn’t work.

If I check the conditions through the branch in the UI_Cam itself, where the variable is located, then everything works stably. When the button is pressed, the number 1 and “Yes” are displayed, and after 3 seconds the number is displayed 0 and “No”.

But if I do the same in the Level Blueprint, calling via Cast UI_Cam, it outputs 1 when the button is pressed, but something breaks, the value of 1 is ignored, it display only 1 time, but without “Yes”, is ignored too. Which is why, along with “No”, it also outputs 0. It doesn’t matter how many times you press the button, “No” is printed along with 0, which makes the condition “false” forever. On my screenshot you can see that after “1.0” comes '0.0". In 0,7 seconds, how i set up branch in Level Blueprint. But, in fact, it’s “0.0” should appear 2.3 seconds later

  • Have you tried removing the casts and plugging the values directly into where they are intended to go and see if that makes any difference?

No I didn’t try

Hi.

Your answer gave me an idea of ​​what could be done.

I change the MangleFlash variable from the UI_Cam to the CharacterController and redid some parts of the blueprint and it worked. Thanks a lot!

1 Like