Frictional Games Forum (read-only)

Full Version: Sound when picking up an item
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);
}
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)?
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?

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)


(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 !