2015-01-12 10:24:58 +00:00
|
|
|
/*
|
2015-09-26 14:26:41 +00:00
|
|
|
* Author: commy2
|
|
|
|
* Moves a rallypoint to the players location.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Side <SIDE>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_Player, side ACE_Player] call ace_respawn_fnc_moveRallypoint
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-12 10:24:58 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-12 09:07:03 +00:00
|
|
|
|
2015-09-26 14:26:41 +00:00
|
|
|
params ["_unit", "_side"];
|
2015-04-26 19:26:57 +00:00
|
|
|
|
|
|
|
private ["_rallypoint", "_position"];
|
2015-04-10 11:21:52 +00:00
|
|
|
|
|
|
|
_rallypoint = [
|
2015-09-26 14:26:41 +00:00
|
|
|
objNull,
|
|
|
|
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
|
|
|
|
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
|
|
|
|
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
|
2015-04-10 11:21:52 +00:00
|
|
|
] select ([west, east, independent] find _side) + 1;
|
2015-01-13 14:28:03 +00:00
|
|
|
|
2015-09-26 14:26:41 +00:00
|
|
|
TRACE_3("moving rally",_unit,_rallypoint,typeOf _rallypoint);
|
2015-07-01 06:27:06 +00:00
|
|
|
|
2015-04-10 11:21:52 +00:00
|
|
|
if (isNull _rallypoint) exitWith {};
|
2015-01-12 09:07:03 +00:00
|
|
|
|
2015-04-10 11:21:52 +00:00
|
|
|
_position = getPosATL _unit;
|
|
|
|
_position = _position findEmptyPosition [0, 2, typeOf _rallypoint];
|
2015-09-26 14:26:41 +00:00
|
|
|
|
|
|
|
if (_position isEqualTo []) then {_position = getPosATL _unit};
|
2015-01-12 09:07:03 +00:00
|
|
|
|
2015-04-10 11:21:52 +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
|
|
|
[{
|
2015-10-01 19:34:40 +00:00
|
|
|
params ["_rallypoint", "_unit", "_position"];
|
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
|
|
|
|
2015-10-01 19:28:00 +00:00
|
|
|
// fix leading zero
|
2015-10-01 19:34:40 +00:00
|
|
|
local _minutes = date select 4;
|
2015-10-01 19:28:00 +00:00
|
|
|
if (_minutes < 10) then {
|
|
|
|
_minutes = format ["0%1", _minutes];
|
|
|
|
};
|
|
|
|
|
|
|
|
_rallypoint setVariable [QGVAR(markerDate), format ["%1:%2", date select 3, _minutes], true];
|
2015-04-15 17:18:42 +00:00
|
|
|
|
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-09-26 14:26:41 +00:00
|
|
|
}, [_rallypoint, _unit, _position], 5] call EFUNC(common,waitAndExecute);
|