How to deactivate weapon equip sound for bots?

Hello guys, I am just polishing somethings on my game before releasing a free demo.

I want to deactivate weapon equip sound for bots.

This is the function on UTWeapon:


simulated function PlayWeaponEquip()
{
     Play the animation for the weapon being put down

    if ( WeaponEquipAnim != '' )
        PlayWeaponAnimation( WeaponEquipAnim, EquipTime );
    if ( ArmsEquipAnim != '' && ArmsAnimSet != none)
    {
        PlayArmAnimation(ArmsEquipAnim, EquipTime);
    }

     play any assoicated sound
    if ( WeaponEquipSnd != None )
        WeaponPlaySound( WeaponEquipSnd );
}

I already know how to detect if a weapon is held by a bot instead of a player, and it is working for me for the FireAmmunition() function:


//function to fire gun and play animation/////////////////////////
simulated function FireAmmunition()
{

    //this will check if the weapon is being held by a bot so it will make the bot auto reload the gun  
    if(Instigator.PlayerReplicationInfo.bBot)        
    {        

        //this will check if ammo reached zero to automatically reload weapon for enemy pawn
        if ( AmmoCount <= 1 )
        {
        //this will call the simulated reload function
        Super.AutoReload();
        }

        //this will set a timer to play shoot animation on pawn
        setTimer(0.01, false, 'PlayShootAnim');
        //this will give a time interval to let anim play before shoot firing sequence
        setTimer(0.02, false, 'FinalShootPawn');

    }

However, I edited the PlayWeaponEquip() using this same way of detecting, but it is not working, whenever the bot equips the weapon, it plays the weapon equip sound:


//this function will not play equip sound if weapon is held by enemy////////////////////
simulated function PlayWeaponEquip()
{
    // Play the animation for the weapon being put down

    if ( WeaponEquipAnim != '' )
        PlayWeaponAnimation( WeaponEquipAnim, EquipTime );

    if ( ArmsEquipAnim != '' && ArmsAnimSet != none)
    {
        PlayArmAnimation(ArmsEquipAnim, EquipTime);
    }

    // play any assoicated sound
    if ( WeaponEquipSnd != None && !Instigator.PlayerReplicationInfo.bBot )
        WeaponPlaySound( WeaponEquipSnd );
}

Any ideas?

Use the if in the function TimeWeaponEquipping() where its called

if(!Instigator.PlayerReplicationInfo.bBot)
PlayWeaponEquip();

Hello mate.

Wow, I was acting like a dumb :smiley: :smiley: :smiley: :smiley:

The code was right, there was nothing wrong with that:


// play any assoicated sound
if ( WeaponEquipSnd != None && !Instigator.PlayerReplicationInfo.bBot )
WeaponPlaySound( WeaponEquipSnd );

The problem was on my kismet actorfactory node. I was spawning my debug pawn with my debug controler (Empty Bot Class). Whenever I changed the Controller Class to UTBot, the equip sound stopped to play for the bots.

Anyway thank you guys!

Good job, excellent place for it.