Frictional Games Forum (read-only)
[SCRIPT] Sound when picking up an item - 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] Sound when picking up an item (/thread-13169.html)



Sound when picking up an item - Darkaroth - 02-08-2012

Hey all, i would like to know how you play the soundfile of the screaming man already got the sound file for it. ( already got the corpse male to appear when picking up the note too ). This is what i got so far:

Code:
////////////////////////////
// Run when entering map
void OnStart()
{
    AddUseItemCallback("", "key1", "mansiondoor1", "open", true);
    SetEntityCallbackFunc("offensiveletter", "OnPickup");
}

void open(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansiondoor1", false, true);
    PlaySoundAtEntity("", "unlock_door", "mansiondoor1", 0, false);
    RemoveItem("key1");
}

void OnPickup(string &in asEntity, string &in type)
{
    SetEntityActive("man1", true);
    PlaySoundAtEntity("", "15_the_big_scream1", "Player", 0, false);
}



RE: Sound when picking up an item - Ermu - 02-08-2012

Try this putting .snt at the end of the sound file like this:

PlaySoundAtEntity("", "15_the_big_scream1.snt", "Player", 0, false);



I assume you have .snt file done already for the sound file (if it is custom sound)?


RE: Sound when picking up an item - Darkaroth - 02-08-2012

It's not a custom sound, it is some scream located in the sound map itself. and i will try that, thanks.
(02-08-2012, 07:47 PM)Ermu Wrote: Try this putting .snt at the end of the sound file like this:

PlaySoundAtEntity("", "15_the_big_scream1.snt", "Player", 0, false);



I assume you have .snt file done already for the sound file (if it is custom sound)?
Still does not work. Have any other ideas?




RE: Sound when picking up an item - SilentStriker - 02-08-2012

I guess it doesn't work because you are using the wrong callback

instead of SetEntityCallbackFunc use:

SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

and then change the syntax on OnPickup to only (string &in asEntity)





RE: Sound when picking up an item - Darkaroth - 02-08-2012

(02-08-2012, 08:38 PM)SilentStriker Wrote: I guess it doesn't work because you are using the wrong callback

instead of SetEntityCallbackFunc use:

SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

and then change the syntax on OnPickup to only (string &in asEntity)
Will try thanks !