Modme Forums

[HELP] Plays custom sounds when i open a door

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


ModmeBot:

Thread By: fedkerr6

how can i add when i open a door with a trigger use, it plays custom sound?

Sorry for my bad english :(


ModmeBot:

Reply By: natesmithzombies

Your English is pretty good. Don't worry about that

I have tested this and it works:

Step 1) Place this function at the bottom of your mapname.gsc:

function play_door_open_sound( flag, sound )
{
	ents = GetEntArray( flag, "script_flag" ); 
	level flag::wait_till( flag ); 
	// iprintlnbold( "^2PlaySound" );
	PlaySoundAtPosition( sound, ents[0].origin ); 
}



Step 2) Add this in your function main:

level thread play_door_open_sound( "zone_flag_here", "sound_alias_here" );



Change "zone_flag_here" to the script_flag of your door trigger. Change "sound_alias_here" to the sound alias that you have in your user_aliases.csv that you would like to play.

Step 3) Repeat Step 2 for every door that you would like to have play a sound.


ModmeBot:

Reply By: ProBeazt

natesmithzombies

level thread play_door_open_sound( "zone_flag_here", "sound_alias_here" );



Change "sound_alias_here" to the sound alias that you have in your user_aliases.csv that you would like to play.

What line of code do I add to my user_aliases.csv?