Well, PlaySoundAtEntity does just that: Plays a sound at an entity, making it ideal for "3D" sound effects (i.e. having sounds play behind or to the left/right of the player). It can also play a sound at the player himself, but in my opinion, that really over complicates it. PlayGuiSound is a much better "lightweight" alternative, and takes less time to write out.
I use PlayGuiSound in scenarios where the sound makes sense to come from the player (i.e. voice acting), or the entity that makes the sound is in such close proximity that the player couldn't tell the difference anyways (i.e. unlocking a door).
First, the syntax is incorrect, it doesn't match the callback you used
(which I now changed to simplicity's sake). The callback syntax are the words inside the "()", which come after "void function". Use this page to make sure syntax match the callback used:
http://wiki.frictionalgames.com/hpl2/amn..._functions
Next, for the PlaySoundAtEntity function, you didn't really write any of it correctly. Basically, strings are names of things, and are declared (meaning inside of quotation marks i.e. "string" is declared). Bool stands for Boolean value, which is true/false, and float/int are number values; floats being decimals, and int being integers (non decimals).
Aqui esta una revision:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "llave1", "puerta1", "unlock", true);
AddEntityCollideCallback("Player", "paso1", "ActivarArea", true, 1);
AddEntityCollideCallback("Player", "paso2", "Explotar", true, 1);
SetEntityPlayerInteractCallback("linterna", "OnPickup", true);
}
void ActivarArea(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("paso2", true);
}
void unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void Explotar(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("explosive", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void OnPickup(string &in asEntity)
{
SetEntityActive("agrippa", true);
PlaySoundAtEntity("", "girl_scream", "agrippa", 0.5f, false);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I rate it 3 memes.