Thread Tools Display Modes
02-16-10, 07:22 AM   #1
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Simple Killing blow checker.

Hi.
I want a simple (as simple as possible) killing blow checker.
All I want it to do is check if the player got a killing blow, and if so play a single soundfile and show an image (if hidden the scale would be 0.0001 and alpha 0)
The image has to support transparency.

I'm no coder but sort of like this

registerevent:PlayerKillingBlow

image = ("image.png")

if (PlayerKillingBlow) then
playSoundFile("kill.wav")
image:SetScale (1)
image: SetAlpha (1)
else
image:SetScale (0.0001)
image: SetAlpha (0)
end
__________________

  Reply With Quote
02-17-10, 06:46 PM   #2
ArrchDK
A Fallenroot Satyr
 
ArrchDK's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 25
There is no such event that only triggers on killing blows. The addon would probably have to read the Battleground data and run based off of your number increasing. Not sure how well that would work, though.
  Reply With Quote
02-17-10, 07:27 PM   #3
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
I know you can track nearby killing blows of your own and your group by registering the COMBAT_LOG_EVENT_UNFILTERED event and then looking at the PARTY_KILL combat event and source guid/name.

However people outside of your party does not return a killing blow as far as I know, for that you'd have to check UNIT_DIED and last person to damage it but that would probably not even be true as events don't always fire the order you'd think.

You only stated "the player" and I guess that's you, yourself so then the above would suffice.


Code:
local test = CreateFrame("Frame")
test:SetScript("OnEvent", function(self, event, ...)
    local _, combatevent, _, sourcename, _, _, destname = ...
    if combatevent == "PARTY_KILL" then
        local playername = UnitName("player")
        if sourcename==playername then
            print("Whoops, I think I just killed "..destname)
        elseif UnitInParty(sourcename) or UnitInRaid(sourcename) then
            print("Seems "..sourcename.." just killed "..destname)
        end
    end
end)
test:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
__________________
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 : 02-17-10 at 07:37 PM.
  Reply With Quote
02-18-10, 12:59 AM   #4
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Yes, I only want to track my own killing blows. So your code should work. Shouldn't be to hard to add playSoundFile() and some way of showing an image in that code. Not entirely sure how to show the image.
Maybe create a bartexture or background and just scale/size it after the image at hand?
__________________

  Reply With Quote
02-18-10, 09:12 AM   #5
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by sacrife View Post
Yes, I only want to track my own killing blows. So your code should work. Shouldn't be to hard to add playSoundFile() and some way of showing an image in that code. Not entirely sure how to show the image.
Maybe create a bartexture or background and just scale/size it after the image at hand?
Why an image? I think text is way better in this case:

Code:
local msg = CreateFrame("MessageFrame", "KillingBlowMessageFrame", UIParent)
msg:SetPoint("LEFT", UIParent)
msg:SetPoint("RIGHT", UIParent)
msg:SetPoint("TOP", 0, -200) -- set vertical position here
msg:SetHeight(25)

msg:SetInsertMode("TOP")
msg:SetFrameStrata("HIGH")
msg:SetTimeVisible(1)
msg:SetFadeDuration(3)

msg:SetFont(STANDARD_TEXT_FONT, 23, "OUTLINE")
msg:SetFontColor(1, 1, 0)

local player = UnitGUID("player")
local tracker = CreateFrame("Frame")
tracker:SetScript("OnEvent", function(_, _, _, event, guid)
	if event == "PARTY_KILL" and guid==player then
		msg:AddMessage("KILLING BLOW!")
	end
end)
tracker:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
Is it OK with you v6o if I release this as an addon?
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
02-18-10, 09:45 AM   #6
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
The reason I wanted it as an image is because I wanted to have a funny addon I could use with my friends (which will be using my UI at cataclysm launch) to show an image of chuck norris giving a thumbs up or something when one of us get's a last hit on a mob/player. So we could get some sort of killing blow contest going on

I want the text aswell, just not for personal use only.
I would like it to go write if YOU got the killing to the party chat like this "I just got the killing blow of %UNIT% and that means I'm better than %PARTY1% and %PARTY2%

Ofc it would only work if Partymember1 and partymember2 would be my predefined nicknames

Oh and to make it more advanced, how bout it could record number of killing blows, so I could use a slash command to print current stats for the 3 of us. Like:
Me: 130
Party1: 120
Party2: 40

:P
__________________


Last edited by sacrife : 02-18-10 at 09:51 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Simple Killing blow checker.


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