Modme Forums

Play sound when touch a trigger

Game Modding | Call of Duty: Black Ops 3 | Scripting


Pepergogo:

Hi, so I've a custom script and I'm trying to play a sound when you touch the trigger_multiple, the thing is, it just make the other functions except for play a sound

function boss_fight1()
{
    trig = GetEnt("bf_trig1","targetname");
    door = GetEnt("bf_door1", "targetname");

    trig waittill("trigger", player);

    //Boss fight
    level flag::set( "spawn_zombies" ); //Start zombie spawn
    player playsound("music_BW"); //Start music
    wait(60); //Fight time
    door Delete(); //Delete door
    trig Delete(); //Delete trigger
}

Anyone know what can I do to fix it? :(


Dorp:

Is the sound set up properly in the script and in audacity?


Pepergogo:

Is the sound set up properly in the script and in audacity?

Yeah, I copy another alias that work fine and replace it with the new song
My song is .wav and 48000 hz
But I don't know why doesn't play
And is something with the script because doesn't play any song I put in them


Dorp:

Is your new sound in your user_aliases.csv or a different file?


tmk_boi:

is it in your user aliases?


tmk_boi:

maybe put the player playsound before the spawn zombie?


Pepergogo:

I'm using the script from a function, so is:
function main(){
thread boss_fight
...
}

And then at the bottom the script I post.

I also try putting at the end of the main function but still nothing.
And yeah, I'm usign music.csv, is where I have all the songs and they work fine, is just the script who doesn't play it :(


Dorp:

I'm thinking it has something to do with your mapname.szc file located at usermaps/zm_mapname/sound/zoneconfig. Is the alias set up correctly within this file?


Pepergogo:

I'm thinking it has something to do with your mapname.szc file located at usermaps/zm_mapname/sound/zoneconfig. Is the alias set up correctly within this file?

Yeah, I have correctly cuz the other sounds that are in there play just fine, like the perks, characters and all of that
Is just the script that doesn't play it :(


Dorp:

Try using a different sound from your alias in the script to see if it works. That'll tell you if it's the script or the sound that has the issue.


Pepergogo:

Try using a different sound from your alias in the script to see if it works. That'll tell you if it's the script or the sound that has the issue.

Yeah already try that
I add a new song and nothing, I change to another song that I know that work and still nothing
I know is the script but I don't know why if the alias and everything else is set up correctly :(


Drae77:

Try this :

PlaySoundAtPosition( "ur_sound_here" , (trig.origin));


Pepergogo:

Try this :
PlaySoundAtPosition( "ur_sound_here" , (trig.origin));

Thanks
I'll try it and let you know


Pepergogo:

Try this :
PlaySoundAtPosition( "ur_sound_here" , (trig.origin));

Hi, so it didn't work
I guess I'm gonna leave like this 😂
But thanks for the help


CaramelFudge:

I have had a similar issue and guess what 40 compiles later it worked
so here's my advice
delete your snd sabl files located in
\steamapps\common\Call of Duty Black Ops III\usermaps\zm_zomsinspace\sound\zone\
I deleted the folder called cache banks

keep compiling till they are regenerated and if the sound still doesn't play the script is wrong


Pepergogo:

I have had a similar issue and guess what 40 compiles later it worked
so here's my advice
delete your snd sabl files located in
\steamapps\common\Call of Duty Black Ops III\usermaps\zm_zomsinspace\sound\zone\
I deleted the folder called cache banks

keep compiling till they are regenerated and if the sound still doesn't play the script is wrong

Perfect, I'm gonna try later
Thanks 😎


CaramelFudge:

void <player> PlayLocalSound(<sound name>)
[LIST=1]

  • [MANDATORY] <sound name> The name of the sound or hash
  • CATEGORY: Player
    CLIENT/SERVER: Server
    SUMMARY: Plays a sound locally
    EXAMPLE: self playlocalsound( "evt_squad_activate" )
  • [/LIST]
    This may help as well

    this is in the bops 3 mod docs located in
    Steam\steamapps\common\Call of Duty Black Ops III\docs_modtools

    lots of engine functions there like this.
    just press ctrl F then put what you're looking for in the search bar
    in this case it'd be sound


    Pepergogo:

    void <player> PlayLocalSound(<sound name>)
    [LIST=1]
    • [MANDATORY] <sound name> The name of the sound or hash
  • CATEGORY: Player
    CLIENT/SERVER: Server
    SUMMARY: Plays a sound locally
    EXAMPLE: self playlocalsound( "evt_squad_activate" )
  • [/LIST]
    This may help as well

    this is in the bops 3 mod docs located in
    Steam\steamapps\common\Call of Duty Black Ops III\docs_modtools

    lots of engine functions there like this.
    just press ctrl F then put what you're looking for in the search bar
    in this case it'd be sound

    Thanks! I use something similar and, after compile some times it work :D
    Thanks a lot for the help