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
09-28-10, 09:43 PM   #7
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Is this contained in a function, or is it really in the file body?

Code:
if event == "PARTY_KILL" then 
 hunted=hunted+1
end
If the latter, that's your problem - there is no "event" at that point, and the code is only called once.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
09-29-10, 01:22 AM   #8
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
If you're gonna use XML you should start and end the file with

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">

>> your frame's here <<

</Ui>
Also you can change
SendChatMessage() which will actually send a message to the server for everyone to see to print() or DEFAULT_CHAT_FRAME:AddMessage() or ChatFrame1:AddMessage() which only you will be able to see.

__________________
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.

Last edited by v6o : 09-29-10 at 01:25 AM.
  Reply With Quote
09-29-10, 07:55 AM   #9
mikma
A Cyclonian
 
mikma's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 45
http://wowprogramming.com/snippets/W..._party_kills_4
  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