Hey Stangi
I'll try and post a thorough explanation for you
First if all your Area (Script) must have a name and instead of a sound object placed out you would place out a new Area (Script) and give it a name as well. This is where we want to play our sound from.
I'll call them
myTrigger and
SoundArea.
Then in your script (.hps) file for your area you would add the following line of code to check for 'collision/collide' with the area.
AddEntityCollideCallback("Player", "myTrigger", "PlaySound", true, 0);
Put it where you see fit, I'd recommend the OnStart() function for the area, depending on what you really want to do.
As you can see in the function's parameters we have "Player", that is the entity/object that will collide with the trigger; in this case simply the player.
Then we have "myTrigger", that is our trigger area which the object will collide with. Once this happens we will call on a function simply named PlaySound.
You have to define this function and it is here you'll play your sound. I'd do it like this:
void PlaySound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("someSound", "general_rain_m.snt", "SoundArea", 0, true);
}
This would give you a rain sound playing at the SoundArea.
Alternatively if you want to have a placed out sound, like you mentioned in your post, we could 'disable' this sound by checking off the 'Active' box in its properties. And when the player is entering the myTrigger area we could simply enable the sound with the following code:
SetEntityActive("specialSound", true);
In the PlaySound() function instead.
The sound you placed out would be called
specialSound.
Hope this helps!