The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting an on/off radio
Kalidus Offline
Junior Member

Posts: 5
Threads: 1
Joined: Apr 2013
Reputation: 0
#1
Scripting an on/off radio

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>
(This post was last modified: 05-05-2013, 11:29 AM by Kalidus.)
05-03-2013, 05:48 PM
Find


Messages In This Thread
Scripting an on/off radio - by Kalidus - 05-03-2013, 05:48 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-03-2013, 06:45 PM
RE: Scripting an on/off radio - by Kalidus - 05-04-2013, 07:13 PM
RE: Scripting an on/off radio - by Daemian - 05-04-2013, 10:44 AM
RE: Scripting an on/off radio - by Daemian - 05-04-2013, 10:56 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-04-2013, 07:20 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-04-2013, 08:36 PM
RE: Scripting an on/off radio - by Kalidus - 05-04-2013, 10:57 PM
RE: Scripting an on/off radio - by Daemian - 05-05-2013, 05:10 AM



Users browsing this thread: 1 Guest(s)