Page 1 of 1

Switching lights on in game

PostPosted: Tue Jul 15, 2008 8:04 pm
by Inez Ryan
I hope this doesn't sound like a stupid question.
I want to set up a puzzle which involves switching lights on or off in order to trigger doors opening and other changes. I've been searching the net looking for tutorials for how I might do this, either using Python or Blender's game engine but I'm at a loss. I tried playing with the "visibility" setting in an actuator, but I couldn't get this to work.
I'm assuming that I would start by making the switch into a clickable area according to the tutorial on this site, and then using a bit of python code to link the clickable area with a command to switch the light on or to toggle the light on and off, and at the same time altering a boolean parameter (true/false) to tell the door that it is now unlocked. Given that such puzzles are pretty much standard in Myst/URU games, I'm assuming someone has already created an age with this kind of puzzle and may have a bit of python code that I could use as a template.

Any help greatly appreciated.

Thanks
Inez

Re: Switching lights on in game

PostPosted: Wed Jul 16, 2008 2:22 pm
by Nadnerb
Nope, you'll have to be a pioneer and see what you can do. The ability to put this kind of puzzle together in uru was only recently added, and people are still out fiddling with methods of doing it following the recent plugin release.

Re: Switching lights on in game

PostPosted: Wed Jul 16, 2008 7:35 pm
by Inez Ryan
Aahh! That explains why I haven't been able to find any tutorials which talk about it. I was beginning to think I was missing something really obvious. Thanks.

Re: Switching lights on in game

PostPosted: Thu Jul 17, 2008 4:11 am
by Gbadji
Hi,

I'm not sure to understand correctly what you want to make, but in my age, I have lights which are visible only when certain objects are in a certain place.
I use two procedures to enable/disable the light knowing the name of the lamp:

Code: Select all
    def IEnableObject(self, nom):
        print self.__class__.__name__, '.IEnableObject() pour ', nom
        o = PtFindSceneobject(nom, self.AgeName)
        if o == None:
            print 'Impossible de trouver ', nom, ' !'
        else:
            o.draw.enable()
            o.physics.suppress(false)

    def IDisableObject(self, nom):
        print self.__class__.__name__, '.IDisableObject() pour ', nom
        o = PtFindSceneobject(nom, self.AgeName)
        if o == None:
            print 'Impossible de trouver ', nom, ' !'
        else:
            o.draw.disable()
            o.physics.suppress(true)


But I would be surprised that that answers your question.

See you soon.

Re: Switching lights on in game

PostPosted: Thu Jul 17, 2008 7:10 am
by D'Lanor
I believe Nadnerb means lights can now be controlled with animations instead of Python. The Python way has been known for some time but it should be considered a workaround.

Re: Switching lights on in game

PostPosted: Thu Jul 17, 2008 11:53 am
by Paradox
You likely have two options.

1- Animate the lamp to turn on or off gradually. Write AlcScript to export two plATCAnims for the lamp. Use a responder to send a plAnimCmdMsg when something is clicked.

2- Somehow disable your lamp by default. Use a responder with a plEnableMsg to enable the lamp later.

Re: Switching lights on in game

PostPosted: Thu Jul 17, 2008 2:54 pm
by Inez Ryan
Thanks guys, I'll do my best to digest what you've suggested (although I have to confess to being more than a bit confused).