Need help : MH2Playerpawn : Hit volume for reedemer and UKBadboy // Hitvolume for others weapons

Discussions about Coding and Scripting
Letylove49
Adept
Posts: 394
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Need help : MH2Playerpawn : Hit volume for reedemer and UKBadboy // Hitvolume for others weapons

Post by Letylove49 »

i would like to set a volume hitsound for a specific weapons and another for others

in my MH2Base:

Code: Select all

 

if(bClientHitsounds)
   {
if (PlayerPawn(InstigatedBy) != None && (Victim != InstigatedBy) && (actualDamage > 0))
		{
			if (PlayerPawn(Victim) != None || Bot(Victim) != None) // When player/bot shoot other player/bot
				HitSound = Sound'HitsoundTeam';
			else
				if (Victim.AttitudeToPlayer == ATTITUDE_Ignore || Victim.AttitudeToPlayer == ATTITUDE_Friendly || Victim.AttitudeToPlayer == ATTITUDE_Follow)
					HitSound = Sound'HitsoundTeam';
				else
					HitSound = Sound'HitsoundEnemy';

			MH2PlayerPawn(InstigatedBy).MH2ClientPlaySound(HitSound);


			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_None, clientHitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, SLOT_Interface, clientHitVolume, false);
			//PlayerPawn(InstigatedBy).PlaySound(HitSound, , clientHitVolume, false);
		}

}



 
And now on my custum Playerpawn class:

Code: Select all


class MH2PlayerPawn expands PlayerPawn;

var Name MH2ClientPlayHitsound;
var Name UltimaNuke; // UkBadboy damagetype 
Var Name MushroomNuke; // UkBadboy Altdamagetype 




//Play a sound client side (so only client will hear it
simulated function MH2ClientPlaySound(sound ASound, optional bool bInterrupt, optional bool bVolumeControl )
{   
    local actor SoundPlayer;
    local Name Damagetype;
    

    LastPlaySound = Level.TimeSeconds;  // so voice messages won't overlap
    if ( ViewTarget != None )
        SoundPlayer = ViewTarget;
    else
        SoundPlayer = self;
        
         if((Damagetype=='RedeemerDeath') ||  (Damagetype=='UltimaNuke') || (Damagetype=='MushroomNuke'))

        
        {

    SoundPlayer.PlaySound(ASound, SLOT_None, 8.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Interface, 8.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Misc, 8.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Talk, 8.0, bInterrupt);
    
 }
else
    

    SoundPlayer.PlaySound(ASound, SLOT_None, 16.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Interface, 16.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Misc, 16.0, bInterrupt);
    SoundPlayer.PlaySound(ASound, SLOT_Talk, 16.0, bInterrupt);
    

}

defaultproperties
{

}


i' am able to compile but i have only 1 volume sound yet.
Image

Letylove49 aka Alicia