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
Sound script help
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#8
RE: Sound script help

You kinda need a timer to loop a function. Use this, but make sure to change the float to the amount of time (in seconds) you want between sounds, and change int (in the if function) to the amount of times you'd like it to repeat. You can add more stuff under the if statement:


void OnStart()
{
AddTimer("time_loop", float, "Sound_Loop");
SetLocalVarInt("loop_var", 0);
}

void Sound_Loop(string &in asTimer)
{
CheckVar();
PlaySoundAtEntity("step", "step_walk_wood_squeaky", "Player", 0.0f, false);
AddTimer("time_loop", float, "Sound_Loop");
AddLocalVarInt("loop_var", 1);
}

void CheckVar()
{
if(GetLocalVarInt("loop_var") == int)
{
RemoveTimer("time_loop");
StopSound("step", 2.0f);
}
}

I rate it 3 memes.
08-26-2012, 09:58 PM
Find


Messages In This Thread
Sound script help - by cammie827 - 08-26-2012, 02:18 AM
RE: Sound script help - by Adny - 08-26-2012, 02:21 AM
RE: Sound script help - by cammie827 - 08-26-2012, 02:25 AM
RE: Sound script help - by Adny - 08-26-2012, 02:28 AM
RE: Sound script help - by cammie827 - 08-26-2012, 02:32 AM
RE: Sound script help - by Ongka - 08-26-2012, 04:24 AM
RE: Sound script help - by cammie827 - 08-26-2012, 09:50 PM
RE: Sound script help - by Adny - 08-26-2012, 09:58 PM
RE: Sound script help - by cammie827 - 08-26-2012, 11:35 PM
RE: Sound script help - by Adny - 08-26-2012, 11:39 PM
RE: Sound script help - by cammie827 - 08-26-2012, 11:49 PM



Users browsing this thread: 1 Guest(s)