There are ways of doing such, by simply using the asEntity parameter. Kinda like what Neelke said, but more flexible. Try this:
void OnEnter()
{
AddUseItemCallback("", "key_study_1", "AreaLock", "UnlockingDoor", true);
}
void UnlockingDoor(string &in asEntity, string &in asItem)
{
SetPlayerRunSpeedMul(0);
SetPlayerMoveSpeedMul(0.2);
SetPlayerLookSpeedMul(0.3);
AddTimer(asEntity + "_door", 2.0f, "Unlocked");
SetSwingDoorLocked(asEntity + "_door", false, true);
}
void Unlocked(string &in asTimer)
{
PlaySoundAtEntity("", "unlock_door", asTimer, 0, false);
SetPlayerRunSpeedMul(1);
SetPlayerMoveSpeedMul(1);
SetPlayerLookSpeedMul(1);
}
As you can see, I edited your callback to be used on an area named AreaLock. You can name it for example AreaLock_1, but the door NEEDS to have the same name but including _door at the end. For for example your area is named
AreaLock, the door the area is located on must be named
AreaLock_door. This is because the code will use the name of the area but add the _door extension to it, then trigger the script on the matching entity.