Looping sounds not looping correctly

broken avatar :(
Created 50 days ago
by ERAWEX
0 Members and 1 Guest are viewing this topic.
129 views
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 3 days ago
Posts
45
Respect
Forum Rank
Legless Crawler
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: 7 hours ago
Posts
412
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
×
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 LinksDistenc5TeffrieTeffrie
I am not a pro at this kind of stuff but this is how I made looping sound in Snowblind:

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: 3 days ago
Posts
45
Respect
Forum Rank
Legless Crawler
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:

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?
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 on Today at 09:52:13 pm
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 7 hours ago
Posts
412
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Hellowa!
×
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 LinksDistenc5TeffrieTeffrie
oh sorry I will keep it simple:

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:
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();   
    thread maps\dw_fx::init();   
   
    maps\_zombiemode::main();
under that add:
level thread radios();
Yes add entities or structs on the map and use the targetname: radio_location
 So it looks like this:
    /*--------------------
     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: 3 days ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links

oh sorry I will keep it simple:

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:
    /*--------------------
     ZOMBIE MODE
    ----------------------*/
    [[level.DLC3.weapons]]();
    [[level.DLC3.powerUps]]();   
    thread maps\dw_fx::init();   
   
    maps\_zombiemode::main();
under that add:
level thread radios();
Yes add entities or structs on the map and use the targetname: radio_location
 So it looks like this:
    /*--------------------
     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: 7 hours ago
Posts
412
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Hellowa!
×
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 LinksDistenc5TeffrieTeffrie
No problem. :)

 

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
Loading ...