I want to create a simple addon that will play sound files when the player kills an enemy player (gets a killing bl开发者_运维知识库ow). I've looked around on Google but haven't found much in terms of documentation or guides.
Can anyone point me to some up-to-date documentation or some places where I can just find better guides?
Getting started: http://www.wowpedia.org/Getting_started_with_writing_addons
API: http://www.wowpedia.org/World_of_Warcraft_API
What you want to do is to add a trigger for the combat log event for a killing blow. Shouldn't be to hard. And then play a sound, using the API for that.
Addons for the game are created, most simply, by making a new folder in the Interface/AddOns
directory in your game folder and populating this with the core files for your addon. These files should include a "Table Of Contents" file which contains information about your addon, and script(s) which are created using the Lua scripting language (with some custom WoW functions and tables and other bits). To properly get started with this, Wowpedia is generally a pretty good guide, and I also recommend this tutorial.
In your specific situation you should just be able to listen for a game event and then do your custom stuff (i.e. playing a sound) in the desired situation. There isn't actually an event for killing blows at the time of writing, however if you register the COMBAT_LOG_EVENT_UNFILTERED
event and look for the PARTY_KILL
combat event, calling playSoundFile
if the sourceName (arg4) matches the player's name (UnitName("Player")
), you should be set.
精彩评论