Modme Forums
Menu:

Audio Trigger

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


Brodie3750:

Hey,

wondering if someone can help me setup an audio trigger so that when i enter a certain area a sound plays.
I have tried using IceGrenades tutorial as well as Wakkas tutorial but neither seem to be working if anyone can assist it would be greatly appreciated :)

Sidenote: When attempting to use icegrenades tut/script, i can get everything setup however when in game, the text pops up saying "music Activated" and then instantly is followed by "music over", not sure why as have followed it step by step and everything is exactly the same as what nade has done

Wakkas: I just simply dont understand/seems more complicated to me?


BunkerBaerIGER:

Try this.
Create a trigger_multiple and change the KVPs
targetname = YourTriggerName
cursorhint = "HINT_NOICON"

Open your mapname.gsc

Underneath
zm_usermap::main();

Paste this line:
level thread init_Triggers();

Paste this at the end of map name.gsc

function init_Triggers()
{
    trigger1 = GetEnt("YourTriggerName","targetname");
    trigger1 thread trigger_play_sound("YourSoundAliasName", true); //true - Play sound to all players

    //trigger2 = GetEnt("YourTriggerName2", "targetname");
    //trigger2 thread trigger_play_sound("test_sound");
}

function trigger_play_sound(Soundname, AllPlayers)
{
    self waittill("trigger", player);

    if(isdefined(AllPlayers) && AllPlayers)
    {
        self PlaySound(Soundname);
    }
    else
    {
        self PlaySoundToPlayer(Soundname, player);
    }
}

Compile & Link your map and run