Frictional Games Forum (read-only)

Full Version: Why is this lock script not working?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the level, the key will not unlock the doors. Not even one. And i cant work out why.
Any aid is appreciated.
Quote:void OnStart()
{
AddUseItemCallback("", "KeyLobby", "Door1", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "KeyLobby", "Door2", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "KeyLobby", "Door3", "UsedKeyOnDoor3", true);
}

void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door1", false, true);
PlaySoundAtEntity("", "unlock_door", "Door1", 0, false);
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);
}

void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door3", false, true);
PlaySoundAtEntity("", "unlock_door", "Door3", 0, false);
}
If I remember correctly I think you need to do SetSwingDoorLocked("NameOfDoor", false, false);

I believe what you are doing is having the key Lock the door instead of Unlock the door. Does the sound play?
(02-19-2011, 08:17 AM)Selyp Wrote: [ -> ]If I remember correctly I think you need to do SetSwingDoorLocked("NameOfDoor", false, false);

I believe what you are doing is having the key Lock the door instead of Unlock the door. Does the sound play?

A sound plays, yes...
Ill alter the script
BAH im an idiot. The doors are Level Doors, and thats a script for regular doors.
*Facekick*
(02-20-2011, 09:57 AM)Chilton Wrote: [ -> ]BAH im an idiot. The doors are Level Doors, and thats a script for regular doors.
*Facekick*

Ha it took me a while to figure that one out once too. Tongue