Frictional Games Forum (read-only)
Sound on Pickup - 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: Sound on Pickup (/thread-12857.html)



Sound on Pickup - samixxa - 01-25-2012

Hi everyone Im New to this so its all kinda confusing, i have a script activating a monster when i pickup a key, how do I make so it does play a sound also?
Code:
{
SetEntityCallbackFunc("key_2", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
    SetEntityActive("monster_1", true);
    ShowEnemyPlayerPosition("monster_1");
}



RE: Sound on Pickup - Tripication - 01-25-2012

PlaySoundAtEntity("Sound", "SoundFile.snt", "EntityForSoundToBePlayedAt", "0", true);



RE: Sound on Pickup - samixxa - 01-25-2012

{
SetEntityCallbackFunc("key_2", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster_1", true);
ShowEnemyPlayerPosition("monster_1");
PlaySoundAtEntity("Sound_1", "00_laugh.snt", "Player", "6", true);
}

Gives an Error?



RE: Sound on Pickup - Statyk - 01-25-2012

Capitalize "string &in astype" as:

string &in asType


Also take the quotes off 6.


RE: Sound on Pickup - samixxa - 01-25-2012

The sound comes instantly instead of comming when picking the key up?

Lower part of script
Code:
void OnPickup(string &in asEntity, string &in asType)
{
    SetEntityActive("monster_1", true);
    ShowEnemyPlayerPosition("monster_1");
    PlaySoundAtEntity("Sound_1", "00_laugh.snt", "Player", 6, true);
}



RE: Sound on Pickup - flamez3 - 01-25-2012

Don't place the sound in level editor btw.




RE: Sound on Pickup - samixxa - 01-25-2012

I found a sollution.. I think.. Smile but thanks