(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
: 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
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...