PrecacheScriptSound

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)

PrecacheScriptSound is a function provided to precache Soundscripts by name. The Soundscript must be declared in the Soundscript manifest document.

Usage

//-----------------------------------------------------------------------------
// Purpose: Add a Sound Script to the precached list so you can use it
// Input  : *soundname - Sound's name as defined in scripts/game_sounds.txt
// Output :
//-----------------------------------------------------------------------------
HSOUNDSCRIPTHANDLE CBaseEntity::PrecacheScriptSound( const char *soundname )


Examples

//-----------------------------------------------------------------------------
// Precache 
//-----------------------------------------------------------------------------
void CPropJeepEpisodic::Precache( void )
{
	PrecacheScriptSound( "JNK_Radar_Ping_Friendly" );
	PrecacheScriptSound( "Physics.WaterSplash" );
	BaseClass::Precache();
}
void CWeaponGravityGun::Precache( void )
{
	BaseClass::Precache();

	PrecacheScriptSound( "Weapon_Physgun.Scanning" );
	PrecacheScriptSound( "Weapon_Physgun.LockedOn" );
	PrecacheScriptSound( "Weapon_Physgun.Scanning" );
	PrecacheScriptSound( "Weapon_Physgun.LightObject" );
	PrecacheScriptSound( "Weapon_Physgun.HeavyObject" );
}