ACE3/addons/captives/functions/fnc_loadCaptive.sqf

37 lines
991 B
Plaintext
Raw Normal View History

/*
* Author: commy2
* Unit loads the target object into a vehicle.
2015-02-03 02:04:50 +00:00
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle <OBJECT>
*
* Return Value:
* Nothing
2015-02-03 02:04:50 +00:00
*
* Example:
* TODO
*
* Public: No
*/
2015-02-03 02:04:50 +00:00
#include "script_component.hpp"
2015-02-04 05:56:51 +00:00
PARAMS_3(_unit,_target,_vehicle);
if (isNull _target) then {
2015-02-04 05:13:44 +00:00
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter);
_target = _objects select 0;
};
if (isNull _vehicle) then {
2015-02-04 05:13:44 +00:00
_objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10];
_vehicle = _objects select 0;
};
2015-02-04 05:13:44 +00:00
if ((!isNil "_target") && {!isNil "_vehicle"}) then {
2015-02-04 06:35:51 +00:00
_unit setVariable ["ACE_isEscorting", false, true];
2015-02-04 05:56:51 +00:00
["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
};