Switching lights on in game

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Switching lights on in game

Postby Inez Ryan » Tue Jul 15, 2008 8:04 pm

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
Inez Ryan
 
Posts: 5
Joined: Tue Jul 15, 2008 7:51 pm

Re: Switching lights on in game

Postby Nadnerb » Wed Jul 16, 2008 2:22 pm

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.
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: Switching lights on in game

Postby Inez Ryan » Wed Jul 16, 2008 7:35 pm

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.
Inez Ryan
 
Posts: 5
Joined: Tue Jul 15, 2008 7:51 pm

Re: Switching lights on in game

Postby Gbadji » Thu Jul 17, 2008 4:11 am

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.
The French's Mystpedia age Project - http://www.mystpedia.net
To find me in the Cavern: Gbadji KI #6911493 or Alatan KI#7869109
User avatar
Gbadji
 
Posts: 73
Joined: Sat Feb 02, 2008 5:59 am

Re: Switching lights on in game

Postby D'Lanor » Thu Jul 17, 2008 7:10 am

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.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Switching lights on in game

Postby Paradox » Thu Jul 17, 2008 11:53 am

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.
Paradox
 
Posts: 1290
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: Switching lights on in game

Postby Inez Ryan » Thu Jul 17, 2008 2:54 pm

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).
Inez Ryan
 
Posts: 5
Joined: Tue Jul 15, 2008 7:51 pm


Return to Scripting

Who is online

Users browsing this forum: No registered users and 9 guests

cron