UGX-Mods

Call of Duty 5: World at War => Help Desk => Mapping => Topic started by: ERAWEX on May 25, 2020, 01:31:46 pm

Title: Looping sounds not looping correctly
Post by: ERAWEX on May 25, 2020, 01:31:46 pm
Hello there,

I have added some looping sound emitters to my map and for some reason the sounds are looping in to each other, meaning the sound gets lounder/more agressive until the sound is almost unbearable to hear. Is there a way to just loop the sound how it is like let the sound playout fully and then just play it again?

The sound im using is just shy of 3 seconds long idk if that's important.

Any help would be appreciated.

ERAWEX
Title: Re: Looping sounds not looping correctly
Post by: gympie6 on May 25, 2020, 06:00:49 pm
I am not a pro at this kind of stuff but this is how I made looping sound in Snowblind:

Code Snippet
Plaintext
radios()
{
    radiolist = getEntArray("radio_location", "targetname");
    for(i = 0; i < radiolist.size; i++)
    {
        radiolist[i] thread play_radio(radiolist[i]);
    }
}

play_radio(radio)
{
    rememberLastSong = -1;
   
    while(1)
    {
        wait randomIntRange(150,300);
       
        rand = randomInt(6);
        if(rand == rememberLastSong)
        rand = randomInt(6);

        rememberLastSong = rand;        
        radioSong = ("radio_song" + rand);
       
        radio playsound(radioSong);    
        wait 200;
    }
}
Title: Re: Looping sounds not looping correctly
Post by: ERAWEX on May 25, 2020, 06:08:17 pm
I am not a pro at this kind of stuff but this is how I made looping sound in Snowblind:

Code Snippet
Plaintext
radios()
{
    radiolist = getEntArray("radio_location", "targetname");
    for(i = 0; i < radiolist.size; i++)
    {
        radiolist[i] thread play_radio(radiolist[i]);
    }
}

play_radio(radio)
{
    rememberLastSong = -1;
   
    while(1)
    {
        wait randomIntRange(150,300);
       
        rand = randomInt(6);
        if(rand == rememberLastSong)
        rand = randomInt(6);

        rememberLastSong = rand;        
        radioSong = ("radio_song" + rand);
       
        radio playsound(radioSong);    
        wait 200;
    }
}
Yeah me neither :) Alright how would I go about to impement this? Would the comments in the script be right?
Code Snippet
Plaintext
radios() //ADD THIS UNDER ZOMBIEMODE::MAIN IN mapname.gsc?
{
    radiolist = getEntArray("radio_location", "targetname");
    for(i = 0; i < radiolist.size; i++)
    {
        radiolist[i] thread play_radio(radiolist[i]);
    }
}

play_radio(radio) // and then paste this at the end of the .gsc?
{
    rememberLastSong = -1;
   
    while(1)
    {
        wait randomIntRange(150,300);
       
        rand = randomInt(6);
        if(rand == rememberLastSong)
        rand = randomInt(6);

        rememberLastSong = rand;        
        radioSong = ("radio_song" + rand);
       
        radio playsound(radioSong);    
        wait 200;
    }
}

//and then for the radiant part add a trigger with (targetname, radio_location) and then im done? is //that all?
Title: Re: Looping sounds not looping correctly
Post by: gympie6 on May 25, 2020, 09:36:44 pm
oh sorry I will keep it simple:

Code Snippet
Plaintext
radios()
{
    // For entities
    radiolist = getEntArray("radio_location", "targetname");
   
    // For structs, uncomment it if you use structs
    // radiolist = GetStructArray("radio_location", "targetname");
   
    for(i = 0; i < radiolist.size; i++)
    {
        radiolist[i] thread play_radio();
    }
}

play_radio(radio)
{
    while(1)
    {
        radio playsound("YOUR-SONG-NAME");
   
        // set here the time that you would like to wait.
        wait randomIntRange(150,300);
    }
   
    // you can also do this instead of using the whileloop
    // radio  playLoopSound ("YOUR-SONG-NAME");
}
You can add both of this at the bottom of your MAPNAME.gsc file
Then scroll up until you see this:
Code Snippet
Plaintext
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();    
    thread maps\dw_fx::init();    
   
    maps\_zombiemode::main();
under that add:
Code Snippet
Plaintext
level thread radios();
Yes add entities or structs on the map and use the targetname: radio_location
 So it looks like this:
Code Snippet
Plaintext
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();    
    thread maps\dw_fx::init();    
   
    maps\_zombiemode::main();
   
    level thread radios();
Title: Re: Looping sounds not looping correctly
Post by: ERAWEX on May 25, 2020, 09:53:52 pm

oh sorry I will keep it simple:

Code Snippet
Plaintext
radios()
{
    // For entities
    radiolist = getEntArray("radio_location", "targetname");
   
    // For structs, uncomment it if you use structs
    // radiolist = GetStructArray("radio_location", "targetname");
   
    for(i = 0; i < radiolist.size; i++)
    {
        radiolist[i] thread play_radio();
    }
}

play_radio(radio)
{
    while(1)
    {
        radio playsound("YOUR-SONG-NAME");
   
        // set here the time that you would like to wait.
        wait randomIntRange(150,300);
    }
   
    // you can also do this instead of using the whileloop
    // radio  playLoopSound ("YOUR-SONG-NAME");
}
You can add both of this at the bottom of your MAPNAME.gsc file
Then scroll up until you see this:
Code Snippet
Plaintext
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();    
    thread maps\dw_fx::init();    
   
    maps\_zombiemode::main();
under that add:
Code Snippet
Plaintext
level thread radios();
Yes add entities or structs on the map and use the targetname: radio_location
 So it looks like this:
Code Snippet
Plaintext
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();    
    thread maps\dw_fx::init();    
   
    maps\_zombiemode::main();
   
    level thread radios();
Oh wow! Thanks for the help man it is very appreciated!
Title: Re: Looping sounds not looping correctly
Post by: gympie6 on May 25, 2020, 10:11:20 pm
No problem. :)