Frictional Games Forum (read-only)
Why is this lock script not working? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Why is this lock script not working? (/thread-6638.html)



Why is this lock script not working? - Chilton - 02-19-2011

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);
}



RE: Why is this lock script not working? - Selyp - 02-19-2011

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?


RE: Why is this lock script not working? - Chilton - 02-19-2011

(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


RE: Why is this lock script not working? - Chilton - 02-20-2011

BAH im an idiot. The doors are Level Doors, and thats a script for regular doors.
*Facekick*


RE: Why is this lock script not working? - Selyp - 02-20-2011

(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