Forum rules - please read before posting.

Can't figure out how to do a flashlight toggle feature (once picked up)

Hello, my game is set in darkness and the player needs to find a flashlight in the 1st scene.
I can do the actual pickup easily (Hotspot > Teleport object to hidden marker > Flashlight now in Inventory).
But once the flashlight's in the Inventory, a global variable should enable the now-available flashlight system: toggle on/off with the F key.
The flashlight effect itself is simply a Point light child on the FP Player prefab, spawned in at runtime.
I tried to do it with a variable and ActionList asset, but failed so far. Any help is appreciated, thanks.

Comments

  • You can use AC's active inputs to bind the F key to an ActionList asset. Then you can add a Light Switch component to your point light, and drag the light to an Object > Send Message > Turn On or Turn Off action within the ActionList asset. When you do this for the first time, AC will automatically add a ConstantID component to your light, so you don't need to worry that the prefab is spawned only at runtime.

  • Thanks, I just found a 2+ yr old post where Chris suggested the same. It doesn't work yet though, I'll have to keep trying.

  • edited September 2022

    OK it's working, but I can't make the flashlight toggle off/on with F now.

  • Share screenshots of your Active Input, ActionList and the object(s) it affects.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.