2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2016-10-12 21:20:22 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Kills a local unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The unit <OBJECT>
|
|
|
|
* 1: Reason for death <STRING>
|
2021-11-15 15:31:56 +00:00
|
|
|
* 2: Killer <OBJECT>
|
2016-10-12 21:20:22 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2016-10-12 21:20:22 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2021-11-15 15:31:56 +00:00
|
|
|
params ["_unit", ["_reason", "#setDead"], ["_instigator", objNull]];
|
|
|
|
TRACE_3("setDead",_unit,_reason,_instigator);
|
2016-10-12 21:20:22 +00:00
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
// No heart rate or blood pressure to measure when dead
|
|
|
|
_unit setVariable [VAR_HEART_RATE, 0, true];
|
|
|
|
_unit setVariable [VAR_BLOOD_PRESS, [0, 0], true];
|
|
|
|
|
2019-09-05 20:56:14 +00:00
|
|
|
_unit setVariable [QEGVAR(medical,causeOfDeath), _reason, true];
|
2016-10-12 21:20:22 +00:00
|
|
|
|
2019-09-05 20:56:14 +00:00
|
|
|
// Send a local event before death
|
|
|
|
[QEGVAR(medical,death), [_unit]] call CBA_fnc_localEvent;
|
2016-10-12 21:20:22 +00:00
|
|
|
|
2019-09-05 20:56:14 +00:00
|
|
|
// Kill the unit without changing visual apperance
|
2021-11-15 15:31:56 +00:00
|
|
|
private _prevDamage = _unit getHitPointDamage "HitHead";
|
|
|
|
|
|
|
|
_unit setHitPointDamage ["HitHead", 1, true, _instigator];
|
|
|
|
|
|
|
|
_unit setHitPointDamage ["HitHead", _prevDamage];
|