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
Looping a sound til player exit level
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Looping a sound til player exit level

(07-19-2013, 07:59 PM)Hauken Wrote: Hi, im trying to create some athmosphere regarding sound, this is what i want:

The player walks into an area trigger and activates the sound, it plays at once, then 10 seconds after it plays again and again til the player leaves the level.

From my perspective:

Onstart calls a function that tells void func sound that we're gonna loop this but the function says - not until the player walks in my area but when he do i will call the next function which plays a sound, the onstart code says we're gonna play the sound after 10 seconds again.

---

As it is now the game doesnt crash but it doesnt work either, I've followed the "For" Loop tutorial in the wiki.

What's wrong here?

Also I want to mention this is the first time I'm using loop commands.

PHP Code: (Select All)
void OnStart()
{
    
//Looping athmosperhic sound
    
{      
        for(
int i 0<4i++)
        
AddTimer("S1" i10 i"func_sound");   
    }
}

void func_sound (string &in asParentstring &in asChildint alState)

{
AddEntityCollideCallback("Player""sound_scare""func_sound"true1); 
}

void func_sound(string &in asTimer)

{
string x asTimer;
    if (
== "S1")
    {
        
PlayGuiSound("door_level_cistern_open.snt"0.5);
    } 


You have to voids with the same names. I think this should work:



PHP Code: (Select All)
void OnStart()
{
    
//Looping athmosperhic sound
    
{      
        for(
int i 0<4i++)
        
AddTimer("S1" i10 i"func_sound_x");   
    }
}

void func_sound (string &in asParentstring &in asChildint alState)

{
AddEntityCollideCallback("Player""sound_scare""func_sound"true1); 
}

void func_sound_x(string &in asTimer)

{
string x asTimer;
    if (
== "S1")
    {
        
PlayGuiSound("door_level_cistern_open.snt"0.5);
    } 


I can't really say it surely, as I'm in my vacations in a computer without amnesia.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
07-19-2013, 08:45 PM
Find


Messages In This Thread
Looping a sound til player exit level - by Hauken - 07-19-2013, 07:59 PM
RE: Looping a sound til player exit level - by The chaser - 07-19-2013, 08:45 PM



Users browsing this thread: 4 Guest(s)