Hey!
I have now hit my first scripting wall and hope you guys can help. I have a map where I have a static model radio placed at a table. I want to be able to interact with it to turn it on and off. So far I have the following "items" in my scene:
1. The radio - a static model.
2. Script Area around the radio.
Area name field =
radioarea.
PlayerInteractCallback field =
Radio.
3. Sound entity (the little speaker icon).
Name field =
radio1. It is set to Active, and I have not defined a Sound Entity file to it, as I will do this through the script.
I want the music to play only within the area I have defined on the sound entity, and not across the entire map. I have looked through the wiki and searched the forum and Google, but I haven't been able to get it working. Any help would be appreciated!
HPS file:
void OnStart()
{
PreloadSound("radio.snt");
SetEntityPlayerInteractCallback("PlayerInteract", "radioarea", "Radio", true, 1);
}
void Radio(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("radio1", "radio.snt", "radioarea", 0.0, false);
}
SNT file:
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="radio" />
</Main>
</SOUNDS>
<PROPERTIES Volume="0.5" MinDistance="1" MaxDistance="8" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="True" Blockable="False" BlockVolumeMul="0.8" Priority="0" />
</SOUNDENTITY>