1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE2 - UT2kX Need to make PlayDyingSound use the “I’m hit” character sound

Discussion in 'Programming' started by Silver_Ibex, Apr 11, 2011.

  1. Silver_Ibex

    Silver_Ibex Member

    Joined:
    Feb 27, 2001
    Messages:
    654
    Likes Received:
    0
    In the pawns PlayDyingSound function I want to replace the default sounds with the controllers class “I’m hit” voice message sound.

    So that players will just shout “I’m hit” when they die.

    How do you ask the controller for the proper class sound name? So it can be played by the Pawn.

    Code from Pawn class
    Code:
    function PlayDyingSound()
    {
    local name ImHit;
    
    	// Dont play dying sound if a skeleton. Tricky without vocal chords.
    	if ( bSkeletized )
    		return;
    
    	if ( bGibbed )
    	{
            PlaySound(GibGroupClass.static.GibSound(), SLOT_Pain,3.5*TransientSoundVolume,true,500);
    		return;
    	}
    
        if ( HeadVolume.bWaterVolume )
        {
            PlaySound(GetSound(EST_Drown), SLOT_Pain,2.5*TransientSoundVolume,true,500);
            return;
        }
    //removed the default sounds
    	//PlaySound(SoundGroupClass.static.GetDeathSound(), SLOT_Pain,2.5*TransientSoundVolume, true,500);
    
    //now what should go here???
    
    	}
    	
    
    }
    
     
  2. Wail of Suicide

    Wail of Suicide Member

    Joined:
    Apr 11, 2006
    Messages:
    738
    Likes Received:
    0
    Code:
    function PlayDyingSound()
    {
    local name ImHit;
    
    	// Dont play dying sound if a skeleton. Tricky without vocal chords.
    	if ( bSkeletized )
    		return;
    
    	if ( bGibbed )
    	{
            PlaySound(GibGroupClass.static.GibSound(), SLOT_Pain,3.5*TransientSoundVolume,true,500);
    		return;
    	}
    
        if ( HeadVolume.bWaterVolume )
        {
            PlaySound(GetSound(EST_Drown), SLOT_Pain,2.5*TransientSoundVolume,true,500);
            return;
        }
    //removed the default sounds
    	//PlaySound(SoundGroupClass.static.GetDeathSound(), SLOT_Pain,2.5*TransientSoundVolume, true,500);
    
    //now what should go here???
    
    	}
    }
    What you want for the "I'm Hit" sound is the VoiceType.
    For xPawn the default value defined is:
    VoiceType="xGame.MercMaleVoice"

    If you look inside of MercMaleVoice you'll find this is the sound you're looking for:
    OtherSound(4)=Sound'TauntPack.mm_im_hit'

    Luckily, for all the default xVoicePacks, the OtherSound(4) is actually the "I'm hit!" sound. So you can rely on that to be correct for all the stock voice packs.

    What you'll have to do is use the function DynamicLoadObject (http://wiki.beyondunreal.com/Legacy:DynamicLoadObject)

    Code:
    DynamicLoadObject (string ObjectName, class ObjectClass, optional bool MayFail)
    To load the VoicePack and then presumably you can just play the VoicePack.OtherSounds[4].
     
  3. Silver_Ibex

    Silver_Ibex Member

    Joined:
    Feb 27, 2001
    Messages:
    654
    Likes Received:
    0
    Thanks I will look into that :cool:
     

Share This Page