Doors unlocked after picking up the key?
My doors were working just fine this morning but after adding some scripting now my doors unlock as soon as I pick up there respective keys rather than waiting till I use them. I check the scripting and nothing has changed. Thats the script, what is wrong?
void OnStart()
{
}
void OnEnter()
{
AddUseItemCallback("", "Study_Closet_Key", "Study_Closet", "KeyOnDoor", true);
AddUseItemCallback("", "hallway_key_1", "hallway_door_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "hallway_door_slam_1", "func_slam", true, 1);
SetEntityPlayerInteractCallback("mansion_4", "func_slam", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Study_Closet", false, true);
PlaySoundAtEntity("", "unlock_door", "Study_Closet", 0, false);
RemoveItem("Study_Closet_Key");
SetSwingDoorLocked("hallway_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "hallway_door_1", 0, false);
RemoveItem("hallway_key_1");
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("hallway_door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void func_slam(string &in asEntity)
{
SetPropHealth("mansion_4", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void OnLeave()
{
}
|