Frictional Games Forum (read-only)
Don't need to use the key on door? - 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: Don't need to use the key on door? (/thread-6378.html)



Don't need to use the key on door? - CapnJimmy - 01-25-2011

Hi, just encountered something odd.

Once I pick up the key the door unlocks without using the key on it.

Here's how the script is laid out:

void OnStart()
{
AddUseItemCallback("", "Key1", "Door_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door_1", 0.0f, true);
}

The Item entities are:

Key_1:-
CallbackFunc:
KeyOnDoor

ConnectedProps:
Door1

and Door_1:-
CallbackFunc:
KeyOnDoor

ConnectedProps:
Key1


RE: Don't need to use the key on door? - CapnJimmy - 01-26-2011

Anyone able to help?


RE: Don't need to use the key on door? - Frontcannon - 01-26-2011

discarded bullshit I've written earlier

The CallbackFunc is used for something different entirely. It's immediately called once you interact wth the entity, so what happens is:

you pick up the key
KeyOnDoor is called, door unlocks
you are confused

The CallbackFunc of the door is just redundant now and will do nothing anymore, as for the AddUseItemCallback.
What ConnectedProp does is still new terrain to me either. Just delete everything what you've written in the callback and connectedporp boxes, your script is fine as is Big Grin