Sound get

You can use this function to get the unique identifying index for a custom sound file located in your workshop mod's files. If the sound file is not found, the function will return the index of the built-in sound asset  instead.

Syntax
sound_get( asset );

Returns
real (sound index)

Basic
// plays the sound file "my_sound.ogg" sound_play( sound_get( "my_sound" ) );

Advanced
// init.gml // stores the sound index in a variable (this is slightly more performant) sfx_my_sound = sprite_get("my_sound");

// hit_player.gml // play the sound when hitting an opponent with AT_NSPECIAL while they're at 100% or more if ( my_hitboxID.attack == AT_NSPECIAL && get_player_damage( hit_player ) >= 100 ) { sound_play( sfx_my_sound ); }