Thread Tools Display Modes
07/04/14, 02:01 AM   #1
simosf
Join Date: Jul 2014
Posts: 5
Event_combat_event

Hello to all,
i'm trying to make a very very simple addon for testing reasons, that simply shows me which mob is attacking me and what skill it uses.

For some reason the EVENT_COMBAT_EVENT is only showing always me as SOURCE and only shows the skills i'm using instead of the enemy mob as well. Anyone has any idea why it shows only my attacks and not the enemie's (NPC mob in my case)?

Thank you very much for your time.

Part of my code is this:

EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

local function MyEventOnHit( eventCode , result , isError , abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log )
lblCounter:SetText(sourceName..":"..abilityName)
end
  Reply With Quote
07/04/14, 02:17 AM   #2
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
I noticed that you are registering the event before you defined the handler. So right now your code is registering nil as a event handler - not your code.
Edit: Actually it is registering whatever happens to be in the global variable "MyEventOnHit". I just asumed it would be nil.

This would be the proper order:
Lua Code:
  1. --Declare the handler
  2. local function MyEventOnHit( eventCode , result , isError , abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log )
  3.     lblCounter:SetText(sourceName..":"..abilityName)
  4. end
  5.  
  6. --Register then handler with the event
  7. EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

Also, it could be that a second event firing directly after the NPC event is overwriting the label. I would use d and .. to output the data into chat.
Lua Code:
  1. --Declare the handler
  2. local function MyEventOnHit(...)
  3.     --takes any amount of parameters and feeds them to d()
  4.     d(...)
  5. end
  6.  
  7. EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

Last edited by zgrssd : 07/04/14 at 02:20 AM.
  Reply With Quote
07/04/14, 02:28 AM   #3
simosf
Join Date: Jul 2014
Posts: 5
Hello - thank you for your answer and your time.

I only copy/pasted part of the code - so it was not clear.
Yes my real code has first the local function declared and later on on the code i put the event.

The event is fired without any problems, as i can see at the label what i hit.

In order to avoid the 'overwrite label' scenario, i started fight with a mob - but i never attacked it, so it was only the mob attacking me. Still nothing showing his attacks. If I hit, i can see in my addon my name and my attack, but not when the mob attacks me. Any other idea?
  Reply With Quote
07/04/14, 02:59 AM   #4
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by simosf View Post
Hello - thank you for your answer and your time.

I only copy/pasted part of the code - so it was not clear.
Yes my real code has first the local function declared and later on on the code i put the event.

The event is fired without any problems, as i can see at the label what i hit.

In order to avoid the 'overwrite label' scenario, i started fight with a mob - but i never attacked it, so it was only the mob attacking me. Still nothing showing his attacks. If I hit, i can see in my addon my name and my attack, but not when the mob attacks me. Any other idea?
You asume that if you do not attack the event will not fire for you. It could very well be that the event fires for you directly after every attack the mob makes against you. I never used it so I am not sure.
But I do know that asumptions are the primary source of bugs.

Restructure it tou output in the chat. It should at least give you a hint at was is really happening.

And please give us your full code. I spend half of yesterday trying to figure out why my logic was not working, till I realised I had declared a second (lower tier) local variable. So my top level local that was fed to return was never even written too.
  Reply With Quote
07/04/14, 03:08 AM   #5
simosf
Join Date: Jul 2014
Posts: 5
I'm gratefull for your help (:

I'll change the code to post to chat and then if the problem still exists i'll post the full addon so you can see (is not that not big).

What do i need to add to show at chat ?
d(sourceName..":"..abilityName) ??
  Reply With Quote
07/04/14, 03:27 AM   #6
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by simosf View Post
I'm gratefull for your help (:

I'll change the code to post to chat and then if the problem still exists i'll post the full addon so you can see (is not that not big).

What do i need to add to show at chat ?
d(sourceName..":"..abilityName) ??
If you want to learn everything there is about an event, just feed all it's parameters to d():
Lua Code:
  1. local function MyEventOnHit(...)
  2.     d("MyEventOnHit: ", ...)
  3. end
  4.  
  5. EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

... is a placeholdeer for "everything that you get as pararameter". If you put ... in your parameter list, any amount and any types of parameters can be given to your function. You can then handle the ... parameter via select statements. Or just relay it too anotehr function directly.
d itself uses ... too, to take any amount of parameters.

If you have BugEater isntalled I would disable it for now. It can sometimes cause issues with the output of d()
  Reply With Quote
07/04/14, 05:08 AM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Unfortunately it is not possible to detect who is attacking you and which skill he uses, because there is no source/ability name for incoming damage.
A simple test to prove it:

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("test", EVENT_COMBAT_EVENT,
  2.    function(eventCode , result , isError , abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log)
  3.       if (sourceName ~= "" or targetName ~= "") and hitValue > 0 then
  4.          d(zo_strformat("<<1>> -> <<2>> / <<3>> (<<4>>)", sourceName, targetName, abilityName, hitValue))
  5.       end
  6.    end)
  Reply With Quote
07/04/14, 05:41 AM   #8
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Garkin View Post
Unfortunately it is not possible to detect who is attacking you and which skill he uses, because there is no source/ability name for incoming damage.
A simple test to prove it:

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("test", EVENT_COMBAT_EVENT,
  2.    function(eventCode , result , isError , abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log)
  3.       if (sourceName ~= "" or targetName ~= "") and hitValue > 0 then
  4.          d(zo_strformat("<<1>> -> <<2>> / <<3>> (<<4>>)", sourceName, targetName, abilityName, hitValue))
  5.       end
  6.    end)
Feared it.
FTC does some "damage received", "damage dealt" and "healing received" tracking. But they are propably doing this by watching the HP bar.

I know that the Death Recap API allows you to get the data the OP wants. But chances are that only is filled after you died:
http://forums.elderscrollsonline.com...h-notes-v1-1-2
  Reply With Quote
07/04/14, 08:22 AM   #9
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
Feared it.
FTC does some "damage received", "damage dealt" and "healing received" tracking. But they are propably doing this by watching the HP bar.
You still receive damage/healing received numbers, only source/ability names are empty. With damage dealt, you know the source, ability and target.
  Reply With Quote
07/04/14, 11:38 AM   #10
simosf
Join Date: Jul 2014
Posts: 5
So more or less- it's totally impossible to know what ability an encounter is using and when, am i correct?
  Reply With Quote
07/04/14, 12:27 PM   #11
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by simosf View Post
So more or less- it's totally impossible to know what ability an encounter is using and when, am i correct?
Yes, and I think somehow your question is one of the reasons they removed the information - so that players actually pay attention and react to what's happening (and learn how to deal with it), instead of just obeying what addons tell them to do.
  Reply With Quote
08/06/15, 11:36 AM   #12
Kreppel
 
Kreppel's Avatar
Join Date: Jul 2015
Posts: 1
Originally Posted by Garkin View Post
Unfortunately it is not possible to detect who is attacking you and which skill he uses, because there is no source/ability name for incoming damage.
Do i assume correctly that it is also impossible to figure out the damageType of incoming damage? I'm currently trying to distinguish between physical and magical damage, in order to figure out which shield absorbs the incoming damage... I always get DAMAGE_TYPE_GENERIC, and i fear that this is the end of it.

Are there any workarounds maybe? Or is a decent shied-addon simply not gonna happen?
  Reply With Quote
08/06/15, 11:40 AM   #13
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,577
This thread is from last year. You should look here for what we will get in the next major update.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Event_combat_event

Thread Tools
Display Modes

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