Frictional Games Forum (read-only)
Can't make a door unlock - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Can't make a door unlock (/thread-21032.html)



Can't make a door unlock - jmayo - 04-03-2013

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()
{

}



RE: Can't make a door unlock - PutraenusAlivius - 04-03-2013

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()


RE: Can't make a door unlock - Tiger - 04-03-2013

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


RE: Can't make a door unlock - PutraenusAlivius - 04-03-2013

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


RE: Can't make a door unlock - Tiger - 04-03-2013

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