
Posts
177
Respect
51Add +1
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
main()
{
playsound = getEntArray( "playsound", "targetname" );
for( i = 0; i < playsound.size; i++ )
{
playsound[i] thread play_loop_sound();
}
}
play_loop_sound()
{
while( 1 )
{
players = get_players();
player_touching = false;
for( i = 0; i < players.size; i++ )
{
if( players[i] isTouching( self ) )
{
player_touching = true;
players[i] playLoopSound( "tzp_generator_loop" ); // name of sound
while( player_touching )
{
if( !players[i] isTouching( self ) )
{
players[i] StopLoopSound();
player_touching = false;
break;
}
wait( 0.5 );
}
}
}
wait( 0.5 );
}
}![]() | Has released one or more maps to the UGX-Mods community. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
while( player_touching )
{
if( !players[i] isTouching( self ) )
{
players[i] StopLoopSound();
player_touching = false;
break;
}
wait( 0.5 );
//replace that while loop with self thread TouchingMe(player);
TouchingMe(player){
player endon("disconnect");
while( player isTouching( self ) )
{
wait( 0.5 );
}
player StopLoopSound();
}
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
!!! thanks for explaining that, i went in and changed a few things u pointed out and i remade the script. I tried doing it several different ways but i kept having that issue with the nades. I made it so only when the player is standing in the trigger multiiple it constantly checks if the player is touching something instead of before where it was always checking. Doing that fixed the sound shutting off issue when i use a nade or switch weapons:). Im not sure if thats the best way but it worked nicely. ![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
Yeah hes right, buried somewhere deep in the cod code that im yet to find is a stopLoopedSound() on player ( by the sounds of it - in the grenade throw function )
this is probably used for cleaning up left over sounds, i guess they never wanted us to use "player" for sounds directly ( This is why my craftables sounds stopped working once, took me ages to work out why coz "just coz" wasnt acceptable lol )
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
![]() | Has released one or more maps to the UGX-Mods community. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
i remade the script so it doesn't loop constantly anymore and to fix that issue with nades and switching weapons i...
instead of
players playLoopSound( "tzp_generator_loop" );
i added,
sound = spawn("script_origin", self.origin);
mysounds(sound);
then to stop the sound,
sound StopLoopSound();
with what im trying to do thats the only way i got it to work without bugs