Is "keyfordoor" the name of the key? I would normally leave it its default name.
void OnStart()
{
AddUseItemCallback("", "keyfordoor", "mansion_2", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("keyfordoor", "OnPickup");
}
Get rid of
SetEntityCallbackFunc("keyfordoor", "OnPickup"); "keyfordoor" should go into the Key's Callbackfunc in the level editor.
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_2", 0, false);
RemoveItem("keyfordoor");
}
Replace
string &in asItem, string &in asEntity with
string &in entity, string &in type
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster", true);
ShowEnemyPlayerPosition("monster");
}
Replace
string &in asEntity, string &in type with
string &in entity, string &in type
That should make it work.