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
Script Help Creating a distant sound
bagobonez Offline
Member

Posts: 66
Threads: 11
Joined: Jul 2011
Reputation: 0
#7
RE: Creating a distant sound

(05-19-2012, 08:26 PM)bagobonez Wrote:
(05-19-2012, 06:10 PM)Rapture Wrote: //The sound will be called when you enter the area "Area_Sound". I will have it play the sound and set a Timer that calls back onto itself every 4 seconds.
void OnStart()
{
  AddEntityCollideCallback("Player", "Area_Sound", "Script_Sound", true, 1);
}

//This is the callback
void Script_Sound(string &in asParent, string &in asChild, int alState)
{
  PlaySoundAtEntity("Sound_Grunt01", "amb_alert.snt", "Area_Sound01", 0, false);

  AddTimer("Sound01", 4, "Script_Sound");
}

//This part will be called when the player interacts with your "Door". I'm assuming you know how to have a callback function work on a Entity. (On the Door's properties)
void DoorTouch(string &in entity, string &in type)
{
  RemoveTimer("Sound01");
  StopSound("Sound_Grunt01", 1);
}

Does anyone else have problems with the frictional forums text editor... I'm spending more time trying to fix up all the text it screwes up, as opposed to helping someone.
Wow, thanks a lot. Will give this a try!
Ugh, I'm still confused. Let me explain exactly what I'm doing because I'm not sure you guys understand exactly what it is I'm trying to do. I have a set of strewn about armor pieces on a table. When the player leaves the area and is out of eyesight of the armor, I want there to be a hammering sound that plays AT THE AREA OF THE ARMOR and just plays the one time, and when the player returns to that area he notices the armor has been assembled into a full statue. The assembling of the armor I don't have a problem with, it's just getting that sound to play once and once only AT THE AREA of the armor and only when the player triggers the callback to have the armor assemble. So it doesn't technically have to be when the player interacts with a door, it could be a simple collide area script if that would make it easier. But I don't want the sound to start playing a loop and then the player walks back to the armor and says "Well, i notice this armor somehow assembled itself, but why is the hammering sound still going?"
05-19-2012, 11:28 PM
Find


Messages In This Thread
Creating a distant sound - by bagobonez - 05-19-2012, 04:33 PM
RE: Creating a distant sound - by SilentStriker - 05-19-2012, 04:35 PM
RE: Creating a distant sound - by Rapture - 05-19-2012, 04:36 PM
RE: Creating a distant sound - by bagobonez - 05-19-2012, 04:48 PM
RE: Creating a distant sound - by Rapture - 05-19-2012, 06:10 PM
RE: Creating a distant sound - by bagobonez - 05-19-2012, 08:26 PM
RE: Creating a distant sound - by bagobonez - 05-19-2012, 11:28 PM
RE: Creating a distant sound - by Rapture - 05-20-2012, 12:01 AM



Users browsing this thread: 2 Guest(s)