Thread Tools Display Modes
09-26-10, 02:13 AM   #1
RightLegRed
A Murloc Raider
Join Date: Sep 2010
Posts: 8
Played Killed Target Event?

I've looked through the wiki and other sites, I can't seem to find an event that fires when the player kills its target.

Is there one? If not, what would be an alternative?
  Reply With Quote
09-26-10, 02:24 AM   #2
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
http://www.wowwiki.com/API_COMBAT_LO...ecial_Events_2

I cant remember if it includes you even if not in a party, but it definately wont work on other players in a raid, only party members
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
09-26-10, 02:26 AM   #3
RightLegRed
A Murloc Raider
Join Date: Sep 2010
Posts: 8
Originally Posted by Xubera View Post
http://www.wowwiki.com/API_COMBAT_LO...ecial_Events_2

I cant remember if it includes you even if not in a party, but it definately wont work on other players in a raid, only party members
I'll try that, thanks. Also, I appear to have placed this in the wrong section, could someone please move it for me?
  Reply With Quote
09-28-10, 12:15 PM   #4
RightLegRed
A Murloc Raider
Join Date: Sep 2010
Posts: 8
I'm sorry for the double post and the late reply - only just got to testing this. This doesn't appear to work. I'm new with events and don't fully understand how they're used in WoWLUA.

Here's my code -
Foo.lua
Code:
if event == "PARTY_KILL" then 
 hunted=hunted+1
end
slash_command.lua
Code:
SLASH_HUNT1 = "/hunt"
SlashCmdList["HUNT"] = function(msg, editBox)
	if hunted == nil then
	SendChatMessage("You haven't killed any monsters");
	else
	SendChatMessage(hunted, "SAY");
	end
end
Foo.xml
Code:
<Frame name="Foo_Frame">
  <Scripts>
     <OnLoad>
        Foo_OnLoad();
     </OnLoad>
     <OnEvent>
        Foo_OnEvent(self, event, ...); -- The ... parameter passes all arguments that would otherwise be implicitly sent prior to 3.0.
                                       -- As of 3.0, you will need to explicitly send these arguments (as done here).  
     </OnEvent>
  </Scripts>
</Frame>
AutoLoot1.toc
Code:
## Interface:
## Title: Hunt Tracker
## Author: Surgeon
## Version: 1.00.0
## URL: N/A
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: hunted
Foo.lua
Foo.xml
slash_command.lua
Could someone tell me why it isn't working? Thanks (:

Last edited by RightLegRed : 09-28-10 at 12:26 PM.
  Reply With Quote
09-28-10, 01:59 PM   #5
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
Foo.lua
Code:
function Foo_OnLoad(self)
    self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    SLASH_HUNT1 = "/hunt"
    SlashCmdList["HUNT"] = function(msg)
        if hunted == nil then
	    SendChatMessage("You haven't killed any monsters", "SAY");
	else
	    SendChatMessage("Number of killing blows: "..hunted, "SAY");
	end
    end
end

function Foo_OnEvent(self,event,...)
    local timestamp, type = ...
    if type == "PARTY_KILL" then
        hunted = ( hunted or 0 ) + 1 --in case hunted isnt declared yet
    end
end
Foo.xml
Code:
<Frame name="Foo_Frame">
  <Scripts>
     <OnLoad>
        Foo_OnLoad(self);
     </OnLoad>
     <OnEvent>
        Foo_OnEvent(self, event, ...);
     </OnEvent>
  </Scripts>
</Frame>
AutoLoot1.toc
Code:
## Interface:
## Title: Hunt Tracker
## Author: Surgeon
## Version: 1.00.0
## URL: N/A
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: hunted
Foo.lua
Foo.xml
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
09-28-10, 05:26 PM   #6
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Don't forget to actually check that you're the one killing (source guid/name)
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Played Killed Target Event?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off