Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lamp puzzle scripting help
Entih Offline
Junior Member

Posts: 47
Threads: 4
Joined: Sep 2010
Reputation: 0
#2
RE: Lamp puzzle scripting help

What you are trying to do here is actually a classic case of scripting and coding a keypad combination, something I have experience with mapping for Half Life 2. What I would do is name the lamps something meaningful. If there are four, make it 'lamp_combo_1' through 4, maybe even name them with the numbers in the order you want them lit for simplicity. If they must be lit in a certain order without instantly failing on a wrong light, have all four point to the same callback function.

Then, you may want to use local variables to check on how many were lit in total, and how many were lit in proper order.

Essentially, the correct lights and total lights count upward as the player lights them, and then you compare them against each other. If correct lights is less than total lights, it was a failure on the player's part. If they are equal, the player got it right.

To check for this, since all four lamps can point to the same callback (or so I believe, haven't tested extensively), you may have something like this:

if(Type == 'OnIgnite')
{

    if(GetLocalVarInt("TotalLights") < 4)
    {
        if((EntityName == "lamp_combo_1") && (GetLocalVarInt("TotalLights") == 0))
        {
            AddLocalVarInt("CorrectLights", 1);
...
        if((EntityName == "lamp_combo_2") && (GetLocalVarInt("TotalLights") == 1))
        {
            AddLocalVarInt("CorrectLights", 1);
...
    if(GetLocalVarInt("TotalLights") == GetLocalVarInt("CorrectLights"))
...

If you want, I can try and work out the script in more detail in a test map of mine.
10-03-2010, 07:40 PM
Find


Messages In This Thread
Lamp puzzle scripting help - by Soon - 10-03-2010, 07:18 PM
RE: Lamp puzzle scripting help - by Entih - 10-03-2010, 07:40 PM
RE: Lamp puzzle scripting help - by Soon - 10-03-2010, 10:35 PM
RE: Lamp puzzle scripting help - by Entih - 10-03-2010, 11:08 PM
RE: Lamp puzzle scripting help - by Soon - 10-04-2010, 12:58 AM
RE: Lamp puzzle scripting help - by Entih - 10-04-2010, 02:01 AM
RE: Lamp puzzle scripting help - by Soon - 10-04-2010, 03:13 AM
RE: Lamp puzzle scripting help - by Alexander - 10-04-2010, 09:35 AM



Users browsing this thread: 1 Guest(s)