Thread Tools Display Modes
03/09/17, 04:22 PM   #1
patrick_smyth
AddOn Author - Click to view addons
Join Date: Oct 2016
Posts: 9
You only die twice if in group?

I wonder if someone can help me.

I am alpha testing a mod which (among other things) monitors EVENT_UNIT_DEATH_STATE_CHANGED.

The mod is only interested in triggers where the isDead argument is true and IsUnitPlayer(unitTag) is true.

When the player is solo and dies everything works as expected.

The problem comes when the player is in a group. In the group case it gets triggered twice when the player dies. When any other group member dies it works fine as it is only triggered once.

The double triggers come in quick succession, before the player has a chance to decide whether to spend a soul gem to revive or go to a wayshrine.

Does anyone know whether this is expected behaviour?

Am I missing something and the two invocations are different? They look identical to me

Could the number of death triggers be different in other circumstances?

Before I try to concoct a workaround I would like to know more.
  Reply With Quote
03/09/17, 08:40 PM   #2
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
I have no idea if it's expected or not. Have you tried passing just the function d to the the event manager? That will print out everything that it gets passed, if there's more than two variables. Other than that, you might need to add a timer to ignore the second one.
  Reply With Quote
03/10/17, 10:20 AM   #3
Solinur
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 78
You will get one event with the unittag = "player" and a second one with the unittag "group1" assuming that group1 is the player. Both will return true to IsUnitPlayer(unitTag) obviously. You can either just use unittag == "player" to select only for those events.

If you want to have a more elegent version you can try to use AddfilterForEvent:

Lua Code:
  1. EVENT_MANAGER:AddFilterForEvent([same as name as in your event declaration], EVENT_UNIT_DEATH_STATE_CHANGED,  REGISTER_FILTER_UNIT_TAG , "player")

Then the event will only fire if the unittag matches "player". But I guess you usually won't get flooded with death events to a point where perfomance is an issue

Btw: This happens with all events where a target might have more then one unittag, also the unittags "reticleover", "reticleoverplayer" and "reticleovertarget" can cause similar issues.

PS: more on AddFilterForEvent is here: http://wiki.esoui.com/AddFilterForEvent

Last edited by Solinur : 03/10/17 at 10:23 AM.
  Reply With Quote
03/10/17, 03:21 PM   #4
patrick_smyth
AddOn Author - Click to view addons
Join Date: Oct 2016
Posts: 9
Thank-you

Thank-you to Dolgubon and decay2.

I now have a much clearer picture of what is going on. I am going to test my new knowledge by modifying some code. Then more testing
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » You only die twice if in group?

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