UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Looping sounds not looping correctly

broken avatar :(
Created 4 years ago
by ERAWEX
0 Members and 1 Guest are viewing this topic.
975 views
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
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
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 1 day ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
Signature
My published cod maps:

Subzero
Djinncaves
Enclosed (a.k.a baconcube)
Bayern
Snowblind
Furtrelock

Black Ops Perks: https://www.ugx-mods.com/forum/scripts/55/call-of-duty-world-at-war-black-ops-perks/22180/
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
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;
    }
}
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
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?
Marked as best answer by ERAWEX 4 years ago
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 1 day ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
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();
Last Edit: May 25, 2020, 09:42:06 pm by gympie6
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links

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!
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 1 day ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
No problem. :)

 
Loading ...