Frictional Games Forum (read-only)

Full Version: Sound on Pickup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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");
}
PlaySoundAtEntity("Sound", "SoundFile.snt", "EntityForSoundToBePlayedAt", "0", true);
{
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?
Capitalize "string &in astype" as:

string &in asType


Also take the quotes off 6.
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);
}
Don't place the sound in level editor btw.

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