mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Triggers a unit into the Cardiac Arrest state from CMS. Will put the unit in an unconscious state and run a countdown timer until unit dies.
|
|
* Timer is a random value between 120 and 720 seconds.
|
|
*
|
|
* Arguments:
|
|
* 0: The unit that will be put in cardiac arrest state <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob] call ace_medical_fnc_setCardiacArrest
|
|
*
|
|
* Public: yes
|
|
*/
|
|
|
|
params ["_unit"];
|
|
|
|
if (_unit getVariable [QGVAR(inCardiacArrest),false]) exitWith {};
|
|
_unit setVariable [QGVAR(inCardiacArrest), true,true];
|
|
_unit setVariable [QGVAR(heartRate), 0];
|
|
|
|
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
|
|
|
|
[_unit, true] call FUNC(setUnconscious);
|
|
private _timeInCardiacArrest = 120 + round(random(600));
|
|
|
|
[{
|
|
params ["_args", "_idPFH"];
|
|
_args params ["_unit", "_startTime", "_timeInCardiacArrest"];
|
|
|
|
private _heartRate = _unit getVariable [QGVAR(heartRate), 80];
|
|
if (_heartRate > 0 || !alive _unit) exitWith {
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
_unit setVariable [QGVAR(inCardiacArrest), nil,true];
|
|
};
|
|
if (CBA_missionTime - _startTime >= _timeInCardiacArrest) exitWith {
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
_unit setVariable [QGVAR(inCardiacArrest), nil,true];
|
|
[_unit] call FUNC(setDead);
|
|
};
|
|
}, 1, [_unit, CBA_missionTime, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler;
|