Disable certain player action like a flashlight in a certain level

Hey I was wondering how you would disable a certain player bp action in a level. I have multiple levels but I only want to disable an action in 1 of the level aka a flashlight. I not sure how though because if I disable it in the player bp it disables it for all the other levels. This is my flashlight bp in the player

And this is the player viewport

ignore the “Mouse Y” and “Mouse X” on the 1st screenshot thats just to give sway with the flashlight. If anyone knows how to disable it for the certain level it would help out a lot!

You should have a Boolean variable in your character like bFlashlightAllowed and then branch based on it in the InputActionFlashLight event just before the FlipFlop node.

Now how to set this variable is up to you.

  • You can set it on BeginPlay in the Level blueprint. Get the player controlled pawn, cast it to your blueprint and set bFlashlightAllowed = false.
  • You can set it with a trigger volume. OnOverlap with the player pawn set bFlashlightAllowed = false (after a cast).
  • Or you can set it in your GameState before loading a particular level.

Happy coding :wink:

I dont have a player pawn?

they way my level starts is from a “player start” would that be a pawn?

oh wait id want it to disable with an overlap event if like a trigger box if thats possible? screenshots would help as well. Sorry if im annoying >_<

nvm figured it out xd ty sorry for the hassle

You certainly have a player actor / pawn / character. This is whatever the thing with the capsule and the camera is on your second screenshot.

I imagine your input Mouse Y and Mouse X are in the the event graph of this object.

This is your pawn.

This is entirely possible. You will just have to additionally turn it off before setting bFlashlightAllowed=0 so it does not remain on all the time.

I am not currently writing from a mobile device. I’ll try to set something up for you once I get to a PC.