ACE3/addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf

67 lines
1.8 KiB
Plaintext
Raw Normal View History

2017-12-22 14:09:06 +00:00
#include "script_component.hpp"
2017-12-22 19:26:25 +00:00
params ["_type", "_position", ["_group", grpNull], "_varName"];
private _player = player;
if (isNull _group) then {
_group = creategroup east;
};
private _target = _group createUnit [_type, [10,10,0], [], 0, "NONE"];
if (isNil "_varName") then {
_varName = _target call BIS_fnc_netId;
2017-12-22 08:39:01 +00:00
};
2017-12-22 19:26:25 +00:00
_target setPos _position;
_target setDir (_position getDir _player);
_target doWatch position _player;
_target addRating -10e10;
_target setUnitPos "UP";
_target setBehaviour "CARELESS";
_target setCombatMode "BLUE";
_target setSpeedMode "LIMITED";
_target disableAI "TARGET";
_target disableAI "AUTOTARGET";
_target allowFleeing 0;
2017-12-24 19:27:33 +00:00
_target setSpeaker "Base";
[{
params ["_target", "_time"];
if (speaker _target == "Base") exitWith {time > _time};
_target setSpeaker "Base";
false
}, {}, [_target, time + 1]] call CBA_fnc_waitUntilAndExecute;
2017-12-22 19:26:25 +00:00
_player reveal [_target, 4];
_target addVest vest _player;
_target addBackpack backpack _player;
_target addHeadgear headgear _player;
_target addGoggles goggles _player;
_target addWeapon primaryWeapon _player;
_target addWeapon secondaryWeapon _player;
_target addWeapon handgunWeapon _player;
_target setVehicleVarName _varName;
missionNamespace setvariable [_varName, _target];
_target switchMove "amovpercmstpslowwrfldnon";
_target setVariable ["origin", _position];
_target addEventHandler ["killed", {
params ["_target"];
private _position = _target getVariable ["origin", position _target];
private _varName = vehicleVarName _target;
[_target, true] spawn BIS_fnc_VREffectKilled;
[{isNull (_this select 0)}, {
(_this select 1) call FUNC(createTarget);
}, [_target, [typeOf _target, _position, group _target, _varName]]] call CBA_fnc_waitUntilAndExecute;
}];
_target call BIS_fnc_VRHitpart;
2017-12-22 14:09:06 +00:00
_target