Changing level based on the player's variable

On the player character, there is an alcoholic value variable that drops from 100 to 0 based on what the player drank in the game.

What I want to do is that if the player’s alcoholic value is 0, it will change to a cutscene.

In the Level Blueprint, I have tried to use trigger box or Event Tick, but that it is wrong because as the player spawned or once the player enters the trigger box, it will immediately switch to the cutscene.

Any suggestion on what can I do?

Level Blueprint that changes the scene when the player enters the trigger box

The bar, green box is the trigger box

In the code that sets the “Player Alcohol Percentage” do a == 0 check right after. If 0 call a custom event.

2 Likes

This ^. Also it’s better not to use " == " on a float value, use the “is nearly equal” node. == will give inconsistent results because of how float precision works.

c++ - Is floating-point == ever OK? - Stack Overflow

Thank you so much for the solution!
It worked and I am now happy :slight_smile:
Thanks for taking your time to reply and help me along the way.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.