Frictional Games Forum (read-only)

Full Version: Key On a Cabinet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, so quick question

what would I use to make a key on a closet door unlock it


Like

would this work

void OnStart()

{
AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);

}


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");
}


but for a closet door? I dont know what function you would use..
void OnStart()

{
AddUseItemCallback("", "Thekey", "TheDoor", "Thefunc", true);
}


void Thefunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("TheDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "TheDoor", 0, false);
RemoveItem("Thekey");
}

try that!
Doors, closets, and that desk with the swing door on the right hand side all use the same functions. Setswingdoorlocked will work properly on all of them.
right, but what function would that be?

hmm. I see what you mean, I've done level doors and regular doors no problem, but a closet door... Im not sure on.
ah thank you andy, always helpful!