Frictional Games Forum (read-only)
Script which activates a sound when you pick up something. Help please - 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 which activates a sound when you pick up something. Help please (/thread-14897.html)



Script which activates a sound when you pick up something. Help please - meneadeszz - 04-18-2012

hello.

i would like to have a script when you pickup an item music or a sounds starts playing.

im thinking something like this

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

SetEntityPlayerInteractCallback("Letterone", "PickUpNote1", false);

asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity



void MyFunc(string &in asEntity)


void PickUpNote1(string &in asEntity)
{
PlaySoundAtEntity("NoteRoar", "insanity_monster_roar03.snt", "Note1Roar", 0, false);
}
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

Could somebody help me i don't see a problem i don't see a erro when i start the story but when i pick up Letterone.
The soundsdoesn't start



RE: Script which activates a sound when you pick up something. Help please - i3670 - 04-18-2012

*Answer in the other thread, created by you*



RE: Script which activates a sound when you pick up something. Help please - LulleBulle - 04-18-2012

void OnStart()
{
void SetEntityCallbackFunc("letterone", "PickUp");
}

void PickUp(string &asEntity, string &in type)
{
PlaySoundAtEntity("Play", "SoundFileHere", "Player", 0, false);
}