View Single Post
04/21/14, 11:47 AM   #11
mikethecoder4
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 13
Originally Posted by BadVolt View Post
Looks like you didn't initialized your addon. You have to register an event that will fire OnInitialized(self).
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("KillCounter", EVENT_ADD_ON_LOADED, OnInitialized)

And make filter for OnInitialized function. You don't want to trigger this event each time any addon loads, don't you?
Lua Code:
  1. function OnInitialized(eventCode, addOnName)
  2.    If addOnName~="KillCounter" then return end
  3.    ...
  4. end

Or you initialised your addon from XML file (self parameter makes me think like that) and I'm wrong
Elso you have wrong params list in function OnKill. Event EVENT_UNIT_DEATH_STATE_CHANGED have 2 args: unitTag,isDead. So, you have to work with them.
Lua Code:
  1. function OnKill(unitTag, isDead)
  2.    If unitTag==GetUnitName("player") and isDead then
  3.    ...
  4.    end
  5. end
If nothing works, you can check EVENT_PLAYER_DEAD param. It can have some args, so may be interested to check them.. but to info on WIKI about it.
Hey there, thanks for the reply! Didnt know about the filtering! and yes, I call the OnInitialize function from my xml.

Like some people have said, the event has the eventCode varaible passed as well as the other two (args 1 and 2 in my function)

The event actually does WORK, but only in stonefalls (based on my testing so far) with my level 3 character on not in Cyrodil with my v1 character.

I will look into this EVENT_PLAYER_DEAD event, see if it helps.

Thanks for the advice!

Edit: Wiki doesn't seem to list the events for EVENT_PLAYER_DEAD. I'll have a look into zgoo once ESO patches to see if I can find them out, but until then, does anyone know what the arguments are?

Last edited by mikethecoder4 : 04/21/14 at 11:53 AM.