Forum rules - please read before posting.

Light Switch

Ive been getting lights set up in game and have come to see that the whole light switch thing is a tad misleading or Im just not understanding things.

Is there a setting to simply send a message to toggle On / Off or do I need to use 2 hot spots
in order to toggle a light on/off?

I assumed it would be more along the lines of
 "SendMessage Toggle On or off depending on the current state"
Instead I see Im sending 2 messages one "Send On " while the other hotspot sends out the "Off"
This seems all wrong to me.There must be a cleaner way to accomplish such a simple task.

Comments

  • Yes you are right, it would be nice to send a toggleSwitch depending if it's on or off.

    But you don't need two hot spots. Just store the state of the light into a variable and check it in the interaction/ActionList like so:


    1. Check variable isLightOn == true -> skip to 4 else continue

    2. Message Send TurnOn : continue

    3. Set variable isLightOn = true : stop

    4. Message Send TurnOff : continue

    5. Set variable isLightOn = false : stop

  • Thank you so much UndyingSpite .

    I knew I was jumping through to many hoops for such a simple task.

    Thanks again!
  • Anyway we can save the lights state when saving?

    I turn on the light, save game 1,  quit..........

    Load Game 1 , I need things to return back to its former self.

    Example : Lights on, door is open, crate is smashed and so on....

    Im  only focusing on the lights for the time being. I assume the rest will fall into place.
  • EDIT : I managed to find that globals are saved and the states are surviving its proper last known state
    However,, I cant seem to find out how to force the lights to the last know state.

    Does anyone know how I can fire off a "check" when the game loads / scene loads to set the lights on / off according to the saved state?

  • edited January 2015
    Create an Cutscene that uses a Variable: Check Action to either turn the light on or off, depending on a bool's value.  Set this as your scene's Cutscene On Load, and it will load after the variables have been restored.

    Alternatively, try moving the lights out of the scene's view (e.g. 1000 units downward) instead of turning them on/off.  The RememberTransform script will then save their position automatically - no need for variables or manually setting with Cutscenes.
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.