Tankbuster 1747 Posted November 27, 2015 The respawn eventhandler behaves oddly when using the BIS revive system When the the BIS revive is in use; it fires immediately the player is killed. If the player elects to respawn while incapacitated, it fires again when he actually respawns. If the player selects respawn from the escape menu, it doesn't fire as he dies, but does fire when he actually respawns. If BIS revive is not in use, it works as expected; ie, it only fires when the unit actually respawns, and not before. http://feedback.arma3.com/view.php?id=26677 Share this post Link to post Share on other sites
Tankbuster 1747 Posted November 27, 2015 The kludge workaround seem to be this; The first time the eh fires (when the player is killed) the player object is also found in the _bis_revive_units array. The second time (when the player does actually respawn), the player object is no longer in the bis_revive_units array. So it is possible to trap the actual respawn. Share this post Link to post Share on other sites
bull_a 44 Posted November 28, 2015 From what I can understand (I am sure to be corrected), the player dies twice when using the BIS Revive System. The Revive system is only compatible with the Endgame game mode, but can be used with some development, to work in all scenarios. This is the (very) basic flow for the revive system (as far as I can tell):1. Player takes damage and dies. 2. Revive Event Handler from BIS Revive System is initialized.3. If player can be revived, set unit in revive state (This uses the varaible 'BIS_revive_incappacitated' - may change due to updates). <-- you can use this variable to check a player is 'revive-able'4. If player bleeds out or is killed in the revive state, the player dies 5. Revive Event Handler from BIS Revive System is initialized.6. Player respawn as normalHope that helps,Bull Share this post Link to post Share on other sites
Larrow 2828 Posted November 28, 2015 How about something like... //Check at mission start REVIVE_ACTIVE = false; _respawnTemplates = getArray( missionConfigFile >> "respawnTemplates" ); _sideTemplates = getArray( missionConfigFile >> ( "respawnTemplates" + str side player )); _playersTemplates = _respawnTemplates + _sideTemplates; { if ( "revive" == _x ) then { REVIVE_ACTIVE = true; }; }forEach _playersTemplates; //Adding some kind of respawn EH if ( REVIVE_ACTIVE ) then { [ missionNamespace, "reviveRevived", { params[ "_unit", "_revivor" ]; if ( isNull _revivor ) then { _nul = [] spawn { sleep playerRespawnTime; hint "You respawned"; }; }else{ hint format[ "You were revived by %1", name _revivor ]; }; }] call BIS_fnc_addScriptedEventHandler; }else{ player addEventHandler [ "Respawn", { hint "You respawned"; }]; };Although it does not catch respawns from the menu Share this post Link to post Share on other sites
Tankbuster 1747 Posted November 28, 2015 Thank you both, very helpful. Share this post Link to post Share on other sites
Tankbuster 1747 Posted November 28, 2015 Works exactly as advertised, Larrow. Excellent. I didn't use that code that sees if revive is active as it's safe to assume it is in my mission, though it might be useful for other users. Also, it appears this EH is one of the ones that is respawn persistent, so you only need to add it once. Again, many many thanks. Share this post Link to post Share on other sites
Tankbuster 1747 Posted November 28, 2015 A followup question; I want to delete the old body of a respawned player immediately. _unit is undefined in that script, so I wrote this that runs on the client after he respawns. { if (getnumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 1) then {deleteVehicle _x;}; } foreach allDeadMen; But nothing happens. No errors. Share this post Link to post Share on other sites
Tankbuster 1747 Posted November 28, 2015 fixed by the addition of a respawn EH that deleted it's own object. Share this post Link to post Share on other sites