ACE3/addons/dragging/functions/fnc_createClone.sqf

42 lines
1.1 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
2023-07-20 17:42:35 +00:00
* Author: BaerMitUmlaut, johnb43
* Creates a draggable / carryable clone of a dead unit.
*
* Arguments:
* 0: Dead unit <OBJECT>
*
* Return Value:
2023-07-20 17:42:35 +00:00
* Cloned unit <OBJECT>
*
* Example:
* [player] call ace_dragging_fnc_createClone;
*
* Public: No
*/
2023-07-20 17:42:35 +00:00
params ["_target"];
private _clone = QGVAR(clone) createVehicle [0, 0, 0];
2023-07-20 17:42:35 +00:00
// Clone loadout
_clone setUnitLoadout getUnitLoadout _target;
[_clone, _target call BIS_fnc_getUnitInsignia] call BIS_fnc_setUnitInsignia;
// Disable all damage
_clone allowDamage false;
2023-07-20 17:42:35 +00:00
_clone setVariable [QGVAR(original), _target, true];
// Turn on PhysX so that unit is not desync when moving with 'setPos' commands
[QEGVAR(common,awake), [_target, true]] call CBA_fnc_globalEvent;
// Move unit below terrain in order to hide it
_target setPosATL [0, 0, -10];
// Turn off PhysX
[QEGVAR(common,awake), [_target, false]] call CBA_fnc_globalEvent;
2023-07-20 17:42:35 +00:00
// Sets the facial expression
[[QGVAR(cloneCreated), [_target, _clone]] call CBA_fnc_globalEventJIP, _clone] call CBA_fnc_removeGlobalEventJIP;
_clone