ACE3/addons/respawn/functions/fnc_moveRallypoint.sqf

61 lines
1.6 KiB
Plaintext
Raw Normal View History

/*
2015-04-26 19:26:57 +00:00
Name: ACE_Respawn_fnc_moveRallypoint
2015-04-26 19:26:57 +00:00
Author(s):
commy2
2015-04-26 19:26:57 +00:00
Description:
Moves a rallypoint to the player's location
2015-04-26 19:26:57 +00:00
Parameters:
0: OBJECT - unit
1: OBJECT - side
2015-04-26 19:26:57 +00:00
Returns:
VOID
*/
#include "script_component.hpp"
2015-01-12 09:07:03 +00:00
2015-04-26 19:26:57 +00:00
PARAMS_2(_unit,_side);
private ["_rallypoint", "_position"];
// rallypoint names are defined in CfgVehicles.hpp
2015-01-12 09:07:03 +00:00
_rallypoint = [
objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
2015-07-01 06:27:06 +00:00
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find _side) + 1;
2015-01-13 14:28:03 +00:00
2015-07-01 06:27:06 +00:00
TRACE_3("moving rally",_unit, _rallypoint, (typeOf _rallypoint));
if (isNull _rallypoint) exitWith {};
2015-01-12 09:07:03 +00:00
_position = getPosATL _unit;
_position = _position findEmptyPosition [0, 2, typeOf _rallypoint];
if (count _position == 0) then {_position = getPosATL _unit};
2015-01-12 09:07:03 +00:00
_position set [2, 0];
2015-01-12 09:07:03 +00:00
2015-05-28 19:59:04 +00:00
[localize LSTRING(Deploy)] call EFUNC(common,displayTextStructured);
2015-01-12 09:07:03 +00:00
2015-04-11 17:36:38 +00:00
[{
_rallypoint = _this select 0;
_unit = _this select 1;
_position = _this select 2;
_rallypoint = _this select 3;
2015-01-12 09:07:03 +00:00
2015-01-13 14:28:03 +00:00
_rallypoint setPosATL _position;
_unit reveal _rallypoint;
2015-01-12 09:07:03 +00:00
_rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, date select 4], true];
2015-04-15 18:50:03 +00:00
["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent);
2015-01-12 09:07:03 +00:00
2015-05-28 19:59:04 +00:00
[localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured);
2015-04-11 17:36:38 +00:00
},
[_rallypoint, _unit, _position, _rallypoint], 5, 1] call EFUNC(common,waitAndExecute);