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


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Issues Help Creating A Lever Puzzle
teddan50 Offline
Junior Member

Posts: 15
Threads: 2
Joined: Dec 2011
Reputation: 0
#14
RE: Creating A Lever Puzzle

(12-13-2011, 04:17 PM)nemesis567 Wrote: Set up a development environment like described in here:

http://wiki.frictionalgames.com/hpl2/amn...evenvguide

Note: Make sure that you are using the following code for the PerformLeverTaskCompleted function.

void PerformLeverTaskCompleted()
{
SetSwingDoorLocked("door1", false, false);
SetSwingDoorClosed("door1", false, false);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0.5f, false);
StartEffectFlash(1, 0.4, 1);
}


What have you done to get it to lock?


I have now tried the debug mode, no difference...

I don't really know how I made it work... I tried desperately tried different combinations of the "true" and "false". When I setted it as shown it worked Tongue: SetSwingDoorLocked("door1", true, false);

But as said, the door just won't unlock!!!

Edit:
I realized that my door wasn't propertly placed in the doorway Tongue

I now tried to take the 4 levers that shouldn't be pulled out of the script so it looks like this:

void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_1", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_3", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_5", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_8", "StoreCheckLeverState");
}


void CheckLeverStates()
{
if (GetLocalVarInt("lever_1") == 0
&& GetLocalVarInt("lever_3") == 0
&& GetLocalVarInt("lever_5") == 0
&& GetLocalVarInt("lever_8") == 0)
{
PerformLeverTaskCompleted();
}
}
void PerformLeverTaskCompleted()
{
SetSwingDoorLocked("door1", true, false);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0.5f, false);
StartEffectFlash(1, 0.4, 1);
}

void StoreCheckLeverState(string &in entity, int state)
{
SetLocalVarInt(entity, state);
CheckLeverStates();
}

But now when I pull the first lever, the music and flash starts, but the door doesn't unlock?! I have scripted it so if all 4 levers are pulled the PerformLeverTaskCompleted starts (right?) and if it does, the door should unlock itself.

I just can't understand what I'm doing wrong...

(This post was last modified: 12-13-2011, 08:32 PM by teddan50.)
12-13-2011, 08:07 PM
Find Reply


Messages In This Thread
Creating A Lever Puzzle - by JenniferOrange - 11-21-2011, 11:10 PM
RE: Creating A Lever Puzzle - by Your Computer - 11-22-2011, 12:02 AM
RE: Creating A Lever Puzzle - by BlueFury - 11-22-2011, 12:08 AM
RE: Creating A Lever Puzzle - by JenniferOrange - 11-22-2011, 01:12 AM
RE: Creating A Lever Puzzle - by Your Computer - 11-22-2011, 01:49 AM
RE: Creating A Lever Puzzle - by JenniferOrange - 11-22-2011, 02:04 AM
RE: Creating A Lever Puzzle - by Your Computer - 11-22-2011, 05:13 AM
RE: Creating A Lever Puzzle - by teddan50 - 12-12-2011, 08:58 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-12-2011, 09:12 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-12-2011, 10:01 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-12-2011, 10:17 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 09:14 AM
RE: Creating A Lever Puzzle - by nemesis567 - 12-13-2011, 04:17 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 08:07 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 09:03 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-13-2011, 08:09 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-13-2011, 09:12 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 09:25 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-13-2011, 09:28 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 10:31 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-13-2011, 10:45 PM
RE: Creating A Lever Puzzle - by teddan50 - 12-13-2011, 11:32 PM
RE: Creating A Lever Puzzle - by nemesis567 - 12-14-2011, 12:23 AM
RE: Creating A Lever Puzzle - by teddan50 - 12-14-2011, 12:48 AM
RE: Creating A Lever Puzzle - by nemesis567 - 12-14-2011, 01:02 AM
RE: Creating A Lever Puzzle - by JenniferOrange - 12-14-2011, 08:28 PM



Users browsing this thread: 2 Guest(s)