Frictional Games Forum (read-only)
[SCRIPT] Activate sound when open 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Activate sound when open door! (/thread-12412.html)



Activate sound when open door! - Bramme - 01-06-2012

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()
{

}




//___________________



RE: Activate sound when open door! - Krymtel - 01-07-2012

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.