Frictional Games Forum (read-only)

Full Version: Can't make a door unlock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have added something to my map, but when I use the key, it just can't unlock here is the script:

Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "doorkey", "startingDoor", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("Starting_Door", false, true);
        PlaySoundAtEntity("", "unlock_door", "startingDoor", 0, false);
        RemoveItem("doorkey");
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}
The name of the function in the AddUseItemCallback and the function containing the script that unlocks the door is different. Change MyFunc to UsedKeyOnDoor.
EDIT:
BTW, it's void OnStart()
1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section
(04-03-2013, 02:44 PM)Tigerwub Wrote: [ -> ]1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section

It's JAP. And obviously you didn't notice my EDIT: part.
Anyway, he's new here. He probably didn't knew that this is the wrong section. Just give the guy an opportunity.
(04-03-2013, 02:55 PM)JustAnotherPlayer Wrote: [ -> ]
(04-03-2013, 02:44 PM)Tigerwub Wrote: [ -> ]1. you need to have an 'OnStart()' function
2. like japp said, change 'MyFunc' to 'UsedKeyOnDoor''
3. Please look through the wiki before making a thread. Here's a page on how to make a key unlock a door and here's a video
4. This is the wrong section

It's JAP. And obviously you didn't notice my EDIT: part.
Anyway, he's new here. He probably didn't knew that this is the wrong section. Just give the guy an opportunity.

I saw your edit and I know your name is Jap.