Frictional Games Forum (read-only)
Cant have PlaySoundAtEntity with SetSwingDoorClosed? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Cant have PlaySoundAtEntity with SetSwingDoorClosed? (/thread-7819.html)

Pages: 1 2


Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_scare1.ogg", "Player", 0, false);
}

Ok so when I move through a locked door which I unlock with a key, it slams behind me, but does not play the sound file I have set above..

void UsedKey1OnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);

}


However a sound effect + entity effect works here.. why not with the other one?

I am getting no errors or anything from starting the custom story, the sound refuses to play. I even tried setting the sound to come from something else like a vase or the door itself, but still no dice.


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - cook - 05-05-2011

PlayGuiSound("react_scare", 1.0f);

It's a GUI sound, I'm assuming that's the problem, paste the command above.


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - ricky horror - 05-05-2011

you're using .ogg for the one that doesn't work, and .snt for the one that does work
PlaySoundAtEntity HAS to be .snt
you can't use .ogg


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

Nope neither of those suggestions seem to work either..

Also what does GUI stand for?


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - jens - 05-05-2011

There must be a snt file for it to work, so if you simply tried react_scare1.snt that does not work, but I think there is a react_scare.snt which will randomly select one of the react_scareX.ogg to play.


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

(05-05-2011, 08:48 AM)jens Wrote: There must be a snt file for it to work, so if you simply tried react_scare1.snt that does not work, but I think there is a react_scare.snt which will randomly select one of the react_scareX.ogg to play.

Tried that and it still does not work..

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);

}

I have tried different variations of of the sound file name as well as the target entity (player).. do i need someone in the first quotations? i didnt for the other script line with the door?


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - cook - 05-05-2011

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlayGuiSound("react_scare", 1.0f);
}

This is what I do, works all the time, so no idea.


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - Ge15t - 05-05-2011

(05-05-2011, 08:58 AM)cook Wrote: void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlayGuiSound("react_scare", 1.0f);
}

This is what I do, works all the time, so no idea.

I copied/pasted that directly replacing my current one and doesnt work.

I even created a SECOND area that sits with the first area:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key1", "mansion_1", "UsedKey1OnDoor", true);
PlayMusic("04_amb.ogg", true, .5, 3, 0, true);
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
AddEntityCollideCallback("Player", "RoomTwoArea2", "CollideRoomTwo2", true, 1);

}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{

SetSwingDoorClosed("mansion_1", true, true);
PlayGuiSound("react_scare", 1.0f);

}

void CollideRoomTwo2(string &in asParent, string &in asChild, int alState)
{

PlayGuiSound("react_scare", 1.0f);

}


And yet it still doesnt work.. im at a complete loss here lol


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - genmills - 05-05-2011

Hmm that seems really weird. I would double check to make sure your sound files are still in their proper place and named correctly? Just a thought since your code does look good. Maybe I'm just not seeing it...


RE: Cant have PlaySoundAtEntity with SetSwingDoorClosed? - ricky horror - 05-05-2011

Code:
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("StartDoor2", false, true);
    PlaySoundAtEntity("", "unlock_door", "StartDoor2", 0, false);

this is actual scripting from the conversion i'm working on
works fine for me

make sure that the third thing typed in (the one next to "unlock_door") is the actual name of the door

other than that, i have no idea why it's not working :/

edit:

try:
Code:
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorClosed("mansion_1", true, true);
    PlaySoundAtEntity("", "react_scare", "mansion_1", 0, false);
}