Get an Epic Experience with Premium

Pet Battle Music

Audio & Video Login to Add Favorites
  • 1 Like
  • World of Warcraft
  • 63 Monthly Downloads
  • Supports: 5.1.0
  • 4,293 Total Downloads
  • Updated 01/12/2013
  • Created 09/02/2012
  • 6 Favorites
  • Project Site
  • Comments
  • Release Type: Release
  • License: MIT License
  • Newest File: 1.2

About Pet Battle Music

1.2 is here!

Version 1.2 has finally been released. This version now includes optional separate music for different battle types (e.g. wild, NPC, PvP).

See music.lua for instructions on adding music and config.lua to configure the AddOn.


This AddOn simply plays custom music (like Pokemon music) during pet battles. To add tracks, follow the instructions in music.lua.

For copyright reasons I can't distribute any Pokemon music with this AddOn, but if you know of some suitable music with a permissive licence (or in the public domain), just leave a comment on Curse or WoW Interface and I'll see if I can package it with future releases.

For the latest alpha versions, check CurseForge. API documentation for AddOn authors can be found here.

The source code is now available on GitHub.

CAUTION: The included Populate_Music scripts will completely overwrite your existing music.lua file! Make sure you back up any manual changes you make.

tag 1.2
Choonster <>
2013-01-12 22:09:01 +1100

Tagging as 1.2


    - Victory/defeat music will now stop playing when
    ... you enter a new battle.
    - Updated music.lua with the new instructions.
    - Removed libraries from TOC/.pkgmeta
    -- We're using animation objects instead of AceTimer now
    - Added support for Ogg files to the scripts.
    - Replaced README.txt with (for GitHub)
    - Updated TOC Interface number.
    - Added support for separate music tables
    -- Most public API functions now take a music table name as their first
    -- The script part files are now numbered to support easy construction
    of music.lua using for loops.
    - Moved settings from core.lua to a new config.lua file.
    -- Added a :GetOptionValue() method to the API to get the value of
    options set in config.lua
    - More documentation changes
    - Changed .docmeta format


First Previous Page 1 of 5 Next Last
  • #75

    Please explain how you determinate when to play win or defeat music cause if my opponent forfits and im thus winning i get the defeat sound to hear?



  • #76

    I use the PET_BATTLE_FINAL_ROUND event to detect victory or defeat. This event has a single argument that describes who the winner is; if it's LE_BATTLE_PET_ALLY the player won, otherwise the player lost.

    Try run this script in game and tell me what it outputs when you win or lose a battle:

    /run local f=PBT or CreateFrame("Frame","PBT")f:RegisterEvent("PET_BATTLE_FINAL_ROUND")f:SetScript("OnEvent",function(_,_,w)print("Winner: LE_B_P_"..(w==LE_BATTLE_PET_ALLY and"ALLY"or w==LE_BATTLE_PET_ENEMY and"ENEMY"or"WEATHER"))end)

    Last edited by Choonster on 8/14/2013 11:28:15 PM
  • #62

    I'm trying to add music with the Java Script, but after changing the game path, i receive the message "Added 0 music files to music.lua". I put a mp3 file in every folder, just in case, but i still receive the same error.

    Thanks for help.

  • #63

    Could you copy and paste the section of your JavaScript file starting with START OF CONFIG and ending with END OF CONFIG into a new CurseForge Paste and paste the URL of that here?

    Could you also tell me where your WoW folder is and what Windows Explorer shows in the "Type" column for MP3 files?

    Last edited by Choonster on 4/17/2013 1:57:41 AM
  • #74

    Well, nothing seems to work, so i just put them manually and worked like a charm.

    The script beat me tho. :(


    Thanks anyways for your help, and sorry for the troubles.

  • #73

    Everything I'm seeing says the script should be working, I have no idea why it isn't. Try run the alpha script from comment #65 from the command prompt with cscript C:\Path\To\Script.js. Do you get any errors or strange output?

  • #72

    The Script shows the following:

    Name: Prueba* Type: Archivo de Audio MPEG Layer 3 Length: 00:02:26

    * that's the title of the MP3 i put there.

  • #71

    I have no idea why the script isn't working. Try this script with MUSIC_DIR set to a folder with around 5 music files in it:

    To run it, open a command prompt (Start > All Programs > Accessories > Command Prompt or press Windows Key + R and type cmd without the quotes) and type cscript C:\Path\To\Script.js >> pbmout.txt before pressing Enter. This should create a text file called pbmout.txt in the folder shown at the start of the current line of the prompt (usually your user folder).

    Post the contents of that file here.

    Last edited by Choonster on 4/18/2013 1:13:14 PM
  • #70

    OS Name: Microsoft Windows 7 Home Premium

    Property Name: Duración

    Index: 27


    (Duración = length)

  • #69

    Strange, it works perfectly well on my computer.

    Could you run the GetLengthIndex_Windows.js script and click OK until you get to "Length" (or whatever it's called on your computer) and then put the contents of that popup in a comment?

  • #68

    Tried the alpha JS, changing the values you pointed out. Still, the same message.

  • #65

    Ah, I forgot that I never packaged the changes with START OF CONFIG as a release version. Try use this alpha version:

    You'll need to set the WOW_DIR, MP3_TYPE and OGG_TYPE variables at the top to the appropriate values.

  • #64

    Ok, i couldn't find "START OF CONFIG", only "END OF CONFIG", so i copied everything from the beggining to that point.

    Also, my WoW folder is C:\Juegos\World of Warcraft, and in the Type column, it says "Archivo de Audio MPEG Layer 3".

    Maybe it's a language problem?


    Thanks again for your help.

  • #52

    I just pushed a new alpha version to CurseForge that includes the JS script changes I mentioned below.

    Please let me know whether this version works properly or has some errors.

  • #41

    I feel like an idiot because people are able to get this to work, and yet I'm not. Hopefully someone can help me out here!

    I have a variety of mp3s I've put into the proper locations. I'm on a Mac (10.7) and didn't feel like going through the whole mp3info thing, so I used the sh command to populate the file with the mp3s and then just replace the zeroes with the appropriate length. Upon logging into the game, a note comes up in the chat log acknowledging that it found 12 tracks. However, when I start a pet battle, I get nothing. The music mutes and nothing plays. I've tried opening the config file and changing it from SFX to Music, but that had no affect.

    Since that didn't work, I tried installing this addon on my girlfriend's PC running Windows 8. I installed the addon, put the mp3s in the appropriate place, and updated the javascript file with the proper location. However, the javascript file results with a window that says no tracks were added even though I have everything in the right place.

    The only thing I could think of is that something could be wrong with the mp3s, but they work fine on both the PC and the Mac, so I'm not sure what's up. Any thoughts from anyone? I'm including the code for the music.lua file below:

    Last edited by lainsnavi on 3/4/2013 12:00:58 PM
  • To post a comment, please login or register a new account.
Login to Curse

Don't have an account? Create One.

Get an epic experience with Curse Premium
  • Faster addon downloads
  • Premium-Only Beta Giveaways
  • Ad-Free Curse experience
  • Premium Curse Client
  • and many More Features
  • Learn More »

Absolute Lojack Giveaway!