1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Answered Trying to get a sound to play when you melee with the Wolfbow

Discussion in 'Call of Duty: Black Ops 3 Answered Questions' started by Collie, Nov 29, 2016.

  1. Collie

    Collie Member

    9
    12
    13
    Credits:
    75
    Exactly as the title says, I'm trying to get the game to play a specific sound when the player melees with the wolf bow out. I have put the sound in my mod's folders, however I am having difficulties getting the game to recognize that the player is holding the wolfbow. Here is the code I am using:
    PHP:
    function wbowmelee()
    {
        for(;;)
        {
            if(
    self MeleeButtonPressed())
                {
                    if(
    self getcurrentweapon()=="elemental_bow_wolf_howl")
                    {
                        
    playsoundatposition"mus_snarl", (0,0,0) );
                        
    wait(1.5);
                        continue;
                    }
                    else
                    {
                        
    wait(2);
                        continue;
                    }
                }
            
    wait(0.05);
        }
    }
    I know the issue is with the game not recognising that the wolfbow is equipped, as putting a iprintlnbold in along with the sound does not produce any results. In addition, if anyone has any experience with using sounds in mods could you tell me exactly how that works? I want to use sounds more in my mods, but I am unsure if I am doing it right here.
     
    CabCon likes this.
  2. CabCon

    CabCon Head Administrator Staff Member Head Staff Team

    3,570
    2,286
    293
    Credits:
    104,353
    Hi Collie,
    this is a common issue with the weapon system you did. In Black Ops 3 weapons aren't strings, they are entity's. If you want to check the current weapon with a string you need to add this field to getcurrentweapon():

    getcurrentweapon().name

    This will return the weapon name as a string.

    I will recode your function when I'm at home. Thank you!

    Best regards,
    CabCon.
     
    Collie likes this.
  3. SCP

    SCP Moderator Staff Member Donator

    352
    365
    73
    Credits:
    2,687
    It's like @CabCon said, I made a function which should work:
    Code:
    function wbowmelee()
    {
        for(;;)
        {
            if(self MeleeButtonPressed())
            {
                if(self getcurrentweapon().name=="elemental_bow_wolf_howl")
                {
                    self playSound("mus_snarl");
                    wait 1.5;
                }
            }
        wait .05;
        }
    }
     
    Collie and CabCon like this.
  4. Collie

    Collie Member

    9
    12
    13
    Credits:
    75
    Thanks for the help! I had a problem with actually getting the sound to play, but I solved that on my own.
     
    SCP and CabCon like this.
  5. SCP

    SCP Moderator Staff Member Donator

    352
    365
    73
    Credits:
    2,687
    Sure, you're welcome! :smile:
     

Related Content

  1. BunkerBaerIGER
  2. TotalModzHD
  3. TyNotTie
  4. JayCoder
  5. Alexisloic21

Share This Page