Frictional Games Forum (read-only)

Full Version: Activate sound when open door!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When i open my door i want the sound to be activated. But its not working its just silanceSad
This is my script and i dont know if i have done something wrongConfused

void OnStart()
{
AddUseItemCallback("", "keystudy_1", "Door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_study_1", "mansion_1", "KeyOnDoor2", true);
AddEntityCollideCallback("Player", "ScriptArea_2", "MonsterCloset", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "rustningbort", true, 1);
SetEntityPlayerInteractCallback("note_letter_2", "spawn_func", true);
SetEntityPlayerInteractCallback("mansion_3", "Doorgris", true);
SetEntityPlayerInteractCallback("Door_1", "Ljud", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, false);
PlaySoundAtEntity("", "unlock_door", "Door_1", 0, false);
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, false);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
}

void MonsterCloset(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("armour_nice_complete_1", true);
}
void rustningbort(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("armour_nice_complete_1", false);
}
void spawn_func(string &in item)
{
SetEntityActive("servant_grunt_1", true);
}
void Doorgris(string &in item)
{
SetEntityActive("pig_corpse_2", true);
}
void Ljud(string &in item)
{
SetEntityActive("Sound_2", true);
}
void OnLeave()
{

}




//___________________
Try typing "unlock_door.ogg" instead of just "unlock_door" for your PlaySoundAtEntitiy callback. Have you checked out the wiki for Amnesia mapping and scripting? Your script is a bit unorganized and maybe this can help.