Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: gunrock12
I can't get my multiple triggers with the same targetname to work! it works fine if it
is a simple GetEnt but as soon as i changed it into a GetEntArray all triggers fail to activate.
I almost got this solved! any help is appreciated thank you.
function soundbox1()////////PLAYS SOUND LOOP WHILE PLAYER IS IN THE TRIGGER
{
soundbox1_trig = GetEntArray( "area_sound1","targetname" );
soundbox1_trig waittill("trigger", player);
players = GetPlayers();
for (i = 0; i < players.size; i++)
while(1)
{
while(!(playersistouching(soundbox1_trig)))
wait 0.5;
iprintlnbold("playing sound");
playersPlayLoopSound( "jack" );
wait 8;
}
}
ModmeBot:
Reply By: mathfag
You need a separate function.
function soundbox_trigs() //makes all the trigs call the function soundbox1()
{
soundbox1_trig = GetEntArray( "area_sound1","targetname" );
foreach(trig in soundbox1_trig)
trig thread soundbox1();
}
Putting a while(1) inside a for(;;) is stupid (no offence). The for(;;) loop is pointless because the while(1) makes it loop forever anyway.
function soundbox1()//self = trigger
{
/*
Function waits untill trigger is triggered.
Checks if all players are touching it.
If they are it plays a looping sound, if not it stops it.
*/
snd_playing = 0;
while(1)
{
c = 0;
self waittill("trigger");
for(i=0; i<getplayers().size; i++)="" if(getplayers()[i]="" istouching(self))="" c++;="" if(c="=" getplayers().size="" &&="" snd_playing="=" 0)="" {="" self=""></getplayers().size;><aliasname>",1);
snd_playing = 1;
}
else if(c != GetPlayers().size)
{
self StopLoopSound(3);
snd_playing = 0;
}
wait 0.05;
}
}</aliasname>
Didn't test this out. Hope it works.
Make sure your alias is marked as LOOPING.
ModmeBot:
Reply By: gunrock12
Thanks for the reply though it worked it didn't play the sound and it triggered only once where the trigger's are suppose
to be repeatable. I feel we are getting close though. My alias sound is marked as looping.
ModmeBot:
Reply By: gunrock12
Okay i got it working! just changed around a few things! Was stuck on this for awhile thank you!