Thread Tools Display Modes
11/27/15, 07:47 PM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
[outdated] Improvements to player resurrection

Before I state my wish I try to describe the current state of the API.

Player resurrection has 2 stages. The active stage where a player has to press a key and shoots his weird beam at another player and the passive stage where the resurrection is pending and the receiving player has to react.

The API currently only has parts of this covered:
When I start resurrecting someone, EVENT_START_SOUL_GEM_RESURRECTION is fired. It does give me a duration, but not who I am resurrecting.
The information about the player can be collected by hooking into TryShowingResurrectLabel on the PLAYER_TO_PLAYER object.

Then we have EVENT_END_SOUL_GEM_RESURRECTION which is fired whenever the beam stops. This can be for a number of reasons, but the event does not provide us with any information about it. There is also no way I know of to get this reason via other means.

Once the resurrection got through the target player can either accept, decline or wait until the timeout occurs. The failure cases are covered by EVENT_RESURRECT_FAILURE which gives a good amount of details (targetChar, reason, targetDisplayName).
There are several reasons for it to fail:
  • RESURRECT_FAILURE_REASON_DECLINED -- player pressed decline or timeout occurred
  • RESURRECT_FAILURE_REASON_ALREADY_CONSIDERING -- when another player is faster than us
  • RESURRECT_FAILURE_REASON_NO_INSTANCE_REVIVE_COUNTERS -- in trials and arena when there is no resurrection left
  • RESURRECT_FAILURE_REASON_NO_SOUL_GEM -- when our gem disappears during resurrection (?)
  • RESURRECT_FAILURE_REASON_SOUL_GEM_IN_USE -- when we have a pending resurrection on another player

When the player accepts the resurrection we don't get any direct indication that it happened. Only thing we could potentially try is infer that it happened by looking at the soul gem count in EVENT_INVENTORY_SINGLE_SLOT_UPDATE. But that is error prone as the count could change for any reason.

On the receiving end we have no events when the player is getting resurrected, but we could potentially track it via IsUnitBeingResurrected("player") in an update handler. We also don't get any info when it gets interrupted. As soon as the resurrection succeeds we get EVENT_RESURRECT_REQUEST and can access the information about it via GetPendingResurrectInfo. Finally we get EVENT_RESURRECT_REQUEST_REMOVED when we press accept, decline or the timeout happens, but again have no information which of the 3 cases caused the event to fire. It's possible to hook into AcceptResurrect and DeclineResurrect to differentiate them though.

My wish for the wishlist is that we get events and functions that provide us with all the details for each stage on both ends. I would also like to see a new unit group for resurrections (e.g. resurrect1 ... n) that gives us access to players that are resurrecting us or that we are resurrecting. The unit would live from when the resurrection starts to when it is over.

Events:
  • EVENT_PLAYER_RESURRECTION_STARTED(*string* _unitTag_, *integer* _timeLeftMs_) -- fires when a player starts resurrecting us or we start to resurrect another player
  • EVENT_PLAYER_RESURRECTION_CANCELLED(*string* _unitTag_, *PlayerResurrectionCancelledReason* _reason_) -- fires when the resurrection was cancelled before it was over
  • EVENT_PLAYER_RESURRECTION_PENDING(*string* _unitTag_, *integer* _timeLeftToAcceptMs_) -- fires when the resurrection was successful and the receiving player has to react
  • EVENT_PLAYER_RESURRECTION_ACCEPTED(*string* _unitTag_) -- fires when the resurrection was accepted by the receiving player
  • EVENT_PLAYER_RESURRECTION_FAILED(*string* _unitTag_, *PlayerResurrectionFailedReason* _reason_) -- fires when the resurrection failed after it entered the pending stage

Functions:
More than one player can try to resurrect us, so we need to be able to access them all:
  • *integer* _numAttempts_ = GetNumResurrectionAttempts()
  • *string* _unitTag_, *integer* _timeLeftMs_ = GetResurrectionAttemptInfo(*luaindex* _index_)

We can give one resurrect at a time and we can also receive one at the same time, so we will need two different functions.
  • *string* _unitTag_, *integer* _timeLeftToAcceptMs_ = GetIncomingPendingResurrectInfo()
  • *string* _unitTag_, *integer* _timeLeftToAcceptMs_ = GetOutgoingPendingResurrectInfo()

PlayerResurrectionCancelledReason
  • PLAYER_RESURRECTION_CANCELLED_REASON_PLAYER
  • PLAYER_RESURRECTION_CANCELLED_REASON_INTERRUPTED
  • PLAYER_RESURRECTION_CANCELLED_REASON_RESPAWNED
  • PLAYER_RESURRECTION_CANCELLED_REASON_DISCONNECTED
  • PLAYER_RESURRECTION_CANCELLED_REASON_ALREADY_CONSIDERING
  • PLAYER_RESURRECTION_CANCELLED_REASON_NO_SOUL_GEM
  • PLAYER_RESURRECTION_CANCELLED_REASON_NO_INSTANCE_REVIVE_COUNTERS
  • PLAYER_RESURRECTION_CANCELLED_REASON_SOUL_GEM_IN_USE

PlayerResurrectionFailedReason
  • PLAYER_RESURRECTION_FAILED_REASON_DECLINED
  • PLAYER_RESURRECTION_FAILED_REASON_TIMEOUT
  • PLAYER_RESURRECTION_FAILED_REASON_RESPAWNED
  • PLAYER_RESURRECTION_FAILED_REASON_DISCONNECTED

This idealized version is probably not feasible any time soon, but at least an event that provides the missing information about accepted resurrections by other players would be good to have as it is something I would like to use in one of my addons.
 
11/30/15, 05:33 PM   #2
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
This probably won't happen in whole unless there's a reason to redo the resurrection code. But the event will now fire on the resurrection being accepted with a SUCCESS result.
 
11/30/15, 05:50 PM   #3
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
 
11/30/15, 06:26 PM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Originally Posted by ZOS_ChipHilseberg View Post
This probably won't happen in whole unless there's a reason to redo the resurrection code. But the event will now fire on the resurrection being accepted with a SUCCESS result.
That's great!
In the meantime I managed to get a partially working version by looking at soul gem decreases in the single slot update event.
It works in most situations, but has no way to know when a player is neither accepting or declining (e.g. resurrects at a keep, disconnects) or when the soul gem count changes for some other reason.

Two other things.
a) Does the EVENT_END_SOUL_GEM_RESURRECTION get sent from the server side? I noticed that the duration that is passed to the start event does not match the actual duration between start and end when the resurrection is a success.

Lua Code:
  1. RegisterForEvent(EVENT_START_SOUL_GEM_RESURRECTION, function(_, duration)
  2.   startTime = GetFrameTimeMilliseconds()
  3. end)
  4. RegisterForEvent(EVENT_END_SOUL_GEM_RESURRECTION, function(eventCode)
  5.   local now = GetFrameTimeMilliseconds()
  6.   local actualDuration = now - startTime
  7. end)
For example duration is 4000 and actual duration is something like 4753.

b) I almost always have a severe input lag or better said a freeze when I resurrect someone and complete the process. The game renders (no freeze), but I can neither look around with the mouse, nor move or use skills on the keyboard. It mostly happens when I try to resurrect someone in Cyrodiil near a large battle when I have around 10 fps. I also get the same when I weapon swap or even just randomly at times.
 
12/01/15, 08:38 AM   #5
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Another thing. Is it possible to pass to EVENT_END_SOUL_GEM_RESURRECTION if the resurrection is indeed pending? A boolean flag wasSuccess would be enough for my purpose.
 

ESOUI » Developer Discussions » Wish List » [outdated] Improvements to player resurrection


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