sreVbriefing.htmläR“briefing.sqfäRÑdescription.extäR©fhqtt.sqfäRiginit.sqfäRAmission.sqmäR#overview.htmläRäscripts\ammo.sqfäRˆ scripts\infotext.sqfäRÞscripts\Init_UPSMON.sqfäRvUscripts\UPSMON\actions\followme.sqfäR° scripts\UPSMON\common\MON_functions.sqfäRÚscripts\UPSMON\MON_artillery_add.sqfäR‰ scripts\UPSMON\MON_spawn.sqfäRùscripts\UPSMON\MON_surrended.sqfäR,scripts\upsmon changelog.txtäR@Jscripts\upsmon known problem and hints !R .txtäR)scripts\UPSMON.sqfäRm@ups.sqfäRd Debriefing

Endmission cheat is for pussies...


Cheaters fail at life.





Mission Accomplished


The AA sites at Chak Chak has been eliminated and the KSK leader has been rescued. Mission Accomplished!!





Mission Failed


The KSK leader has been slained in combat. Mission Failed!!





Mission Failed


The KSK leader has been taken to the execution area. He will shortly receive a public execution. Mission Failed!!


/* Briefing * The briefing can be defined by calling FHQ_TT_addBriefing. * The array is built like this. * The first element should be a filter (side, group, faction, or a piece of script). All units matching the * filter will see the briefing * This is followed by pairs of strings, a head line, and an actual text. * Briefings are added in the order in which they appear for any unit that matches * the last filter. */ [ {true}, ["Background", "A KSK officer and his squad were scouting Takistan to find until on whether or not it was safe to insert our troops into Chak Chak region for an assault. Unfortunately, their team has been ambushed by Takistani members and his squad were killed. Only the officer was alive and was captured. He is now a Takistani's hostage and is being transported to Chak Chak for execution. He manage to get some intel on some AA location that must be destroyed in order to safely insert our troops for the assault on Takistan. Unfortunately, he has been captured and US Army soldiers are inserted to ambush the convoy and free him. There will be two convoys heading towards Chak Chak. One will be a decoy and the other will contain the hostage."], ["Mission", "Ambush the convoy and rescue the hostage. Destroy 4 ZU-23s and 2 Shilkas in Chak Chak. If the hostage is at the execution area, it is all over."], ["Enemies", "Takistani Army transporting two convoy (one decoy and one convoy with the hostage). They will move in 5 minutes. Takistani militias patrolling Chak Chak."], ["To Hostage", "Don't you dare step foot outside that truck or else you'll get shot down dead on the street. Only step out once friendly forces have save you from enemy. Do not select weapons from briefing weapon selection menu. Don't try to jump into the driver seat either."], ["Hints", "Keep the trucks intach if you want a vehicle to use for transportation. They also have some satchels inside for you to use against the AA emplacements. Hope your hostages have good navigation skill. He has no map, compass, watch, GPS, etc to know which convoy he is being transported on. Hostage being carried in convoy is randomized between two convoys. You don't need to destroy all enemy vehicles. It is best to fall back once the hostage is secured. Your engineer may come in handy to repair vehicles. If you have no vehicles, you may search for civilian vehicles. Extra satchels can be found by the Shilkas in Chak Chak."], ["Credits", "Mission by Phantom Six. FHQ Task Tracker by Varanon. UPSMON by Monsada."] ] call FHQ_TT_addBriefing; [ {true}, // Filter ["task1", // Task name "Ambush the convoy and rescue the hostage. There are two convoys approaching. One of them contains the hostage and must be eliminated. The other is a decoy and can be left alone. You do not need to destroy the vehicles, only eliminate the infantries in the truck that holds the hostage. The convoys come from here and here.", // Task text in briefing "Ambush the convoy", // Task title in briefing "crossroads", // Waypoint text getmarkerpos "task1" // Optional: Position or object // Optional: Initial state ], ["task2", // Task name "Destroy enemy anti air emplacements which includes 4 ZU23 and 2 Shilkas. Unfortunately we do not know exactly where they are but the KSK Officer knows where they're at and he must be rescued first.", // Task text in briefing "Eliminate Anti Air", // Task title in briefing "Eliminate AA", // Waypoint text getmarkerpos "task2" // Optional: Position or object ] ] call FHQ_TT_addTasks;onLoadMission = "Truck Stop Road"; onLoadMissionTime = False; class Header { gameType = Coop; minPlayers = 1; maxPlayers = 10; playerCountMultipleOf =1; }; respawn = "GROUP"; respawnDelay = 5; class Params { class Rain0 { title = "Rain"; values[] = {0,1,2,3}; texts[] = {"None","Light","Moderate","Heavy"}; default = 0; }; class Fog1 { title = "Fog"; values[] = {0,1,2,3}; texts[] = {"None","Light","Moderate","Heavy"}; default = 1; }; class View2 { title="View Distance"; values[]={0,1,2,3,4}; texts[]={"100m","500m","1000m","2000m","5000m"}; default = 3; }; }; /* FHQ TaskTracker for the FHQ Multiplayer framework * * This scriptset is used to create briefings and tasks, and keep track of * task states. * * In general, briefings and tasks can be created for individual players, for * groups of players, and specific to the side or faction of the player. * * Unit filters: * Whenever a unit filter is asked for, there are several possibilities to * define what you need to assign to: * single object: A single player * group: All players of a group * side: All players of a side * faction (string): All players of a certain faction * code: The piece of code is called for every playable character. Return true if you want * the character to be selected, or false otherwise. The only parameter is the playable * object to be tested * * When calling a function that assigns briefings or tasks, a pool of all playable units is created. * The filter is tested against those units, and all units matching the filter will have the tasks/briefing * assigned to them. Subsequently, these units (that mached the filter) are removed from the pool. Further * filtering is done on the remaining units. * * This essentially means that you should define tasks/briefing entries from specific to general. For example, * assuming one player group is west (whith special tasks), and the rest of the players share another set of tasks, * you would first use the specific group as filter value, followed by west to assign the following tasks to all * remaining west players. * * Examples: * {(side _this) != west): All playable characters that are not BLUFOR * player: the player on the current client * group westMan1_1: All units in westMan1_1's group * east: All playable characters on the OPFOR side * "BIS_BAF": All playable british soliders * * * Briefing entries: * Briefing entries are defined as an array of two strings. The first string is the title as it * will appear in the middle colum when the "Notes" section is highlighted in the left colum. * The second string is a text that can contains links to markers, code, and some html formatting * and will be displayed on the right column when the title in the center column is highlited. * * * Task entries: * A single task entry is an array. The elements in the array are as follows: * String: task name * String: Task text (the text that will appear in the right colum) * String: Task title (it will appear in the center column when "Tasks" is highlited in the left column). * String: optional Waypoint title (Will appear on the waypoint marker in the player's main view). * Object or position: The destination for this task, either an object, or a position. * String: Optional initial state ("created" if nothing given) * * * Commonly used examples: * * 1. Assign a task as current task: * ["taskDestroy", "assigned"] call FHQ_TT_setTaskState; * * * 2. Check if a task is completed (Note, might be successful, failed or cancelled) * if (["taskInsert"] call FHQ_TT_isTaskCompleted) then {hint "yes";}; * * * 3. Check if a task is successful * if (["taskDestroy"] call FHQ_TT_isTaskSuccessful) then {hint "yay";}; * * * 4. Mark a task and select another task that is not completed yet. * ["taskDestroySecondary", "succeeded", "taskDestroyPrimary", "taskDestroySecondary", "taskExfiltrate"] * call FHQ_TT_markTaskAndNext; * * This example marks taskDestroySecondary as succesful, and then checks if taskDestroyPrimary is completed. * If not, it is set to assigned. If it is completed, it continues with the taskDestroySecondary and eventually * taskExfiltrate. * * * * * TODO: Add possibility to change waypoint position */ FHQ_TT_init = { FHQ_TT_supressTaskHints = true; /* Check for Arma 3 or 2 */ FHQ_TT_is_arma3 = false; if (isClass (configfile >> "CfgAddons" >> "PreloadAddons" >> "A3")) then { FHQ_TT_is_arma3 = true; }; if (isServer) then { // Global list of tasks kept on the server. Always contains full info: // [unit filter, description, state] FHQ_TT_TaskList = []; }; if (!isDedicated) then { // Local version of the client // I wonder, though, why this is necessary, since according to the documentation, // the effects of createSimpleTask are global // Anyway, [name, state, list of objects] FHQ_TT_ClientTaskList = []; if (isNil {player} || isNull player) then { FHQ_TT_isJIPPlayer = true; }; [] spawn { // Wait for join in progress waitUntil {!isNil {player}}; waitUntil {!isNull player}; // Wait until the task list is ready. waitUntil {!isNil "FHQ_TT_initialized"}; FHQ_TT_TaskList call FHQ_TT_UpdateTaskList; FHQ_TT_supressTaskHints = false; "FHQ_TT_TaskList" addPublicVariableEventHandler {(_this select 1) call FHQ_TT_UpdateTaskList}; }; }; }; FHQ_TT_filterUnits = { private ["_unitsArray", "_inputArray", "_outputArray"]; _unitsArray = _this select 1; _inputArray = _this select 0; _outputArray = []; switch (typename _inputArray) do { case "CODE": { // Filter all playable units by comparing them with the code {if (_x call _inputArray) then {_outputArray = _outputArray + [_x];};} forEach _unitsArray; }; case "GROUP": { // Filter out all objects not in group {if (_x in units _inputArray) then {_outputArray = _outputArray + [_x];};} forEach _unitsArray; }; case "OBJECT": { // Result is only the array containing the object _outputArray = [_inputArray]; }; case "SIDE": { // Filter out all objects not belonging to side {if (side _x == _inputArray) then {_outputArray = _outputArray + [_x];};} forEach _unitsArray; }; case "STRING": { // Filer out all objects not belonging to the faction {if (faction _x == _inputArray) then {_outputArray = _outputArray + [_x];};} forEach _unitsArray; }; }; _outputArray; }; /* FHQ_TT_addBriefingEntry: Add a briefing entry for the given entities * * This function adds a briefing entry for the given units. The units can be * supplied as either a player, a group, a side, a faction, or a piece of code. * All playable units will receive the given entries if they match the condition. * * [_units, _topic, _text] call FHQ_TT_addBriefingEntry; * [_units, _subject, _topic, _text] call FHQ_TT_addBriefingEntry; (NOT YET IMPLEMENTED) * * Parameters: * _units: A single unit, a group, side faction, or piece of code that will * be run on all playable units. * _topic: topic to add to * _text: text for this subject * _subject: Subject to file this under. A new subject is created if it does not exist yet. * (optional, not yet implemented) * */ FHQ_TT_addBriefingEntry = { private ["_units", "_subject", "_topic", "_text", "_unitsArray", "_unitPool"]; _units = _this select 0; _subject = "Diary"; _topic = _this select 1; _text = _this select 2; _unitPool = (if (isMultiplayer) then {playableUnits} else {switchableUnits}); _unitsArray = [_units, _unitPool] call FHQ_TT_filterUnits; {_x createDiaryRecord [_subject, [_topic, _text]]} forEach _unitsArray; }; /* Internally used to add topics to units in reversed order */ FHQ_TT_addBriefingEntries = { private ["_units", "_subject", "_topics", "_count", "_i", "_topic", "_text"]; _units = _this select 0; _subject = "Diary"; _topics = _this select 1; _count = count _topics; if (_count > 0) then { for [ {_i = _count - 1}, {_i >= 0}, {_i = _i - 1}] do { _topic = (_topics select _i) select 0; _text = (_topics select _i) select 1; {_x createDiaryRecord [_subject, [_topic, _text]]} forEach _units; }; }; }; /* FHQ_TT_addBriefing: Add a full briefing to the selected units. * * This functions receives an array as input. The elements of the input array * are interpreted as follows: * If the element is a two-element array consisting of two strings, the entry is * interpreted as a new briefing topic. * If the element is anything else, the following topics will only be presented to * the units matching the element. For example, if the element is a group, the following * entries are added to this group only. * If a new unit match is encountered, the units that have been assigned targets before * will be removed from the pool of units being considered for future topics. * * In other words, you can define briefings from bottom up. If you first define briefing topics * for a group of players, and then for a side, the side specific topics will not be added to the * group. This is meant to enable you to go from specific units up to general. * * In normal circumstances, you will most likely only define one briefing for a single group of * players, and thus passing only an array of string pairs. */ FHQ_TT_addBriefing = { private ["_unitPool", "_numEntries", "_currentUnits", "_currentTopicList", "_current"]; _unitPool = (if (isMultiplayer) then {playableUnits} else {switchableUnits}); _numEntries = count _this; _currentUnits = _unitPool; _currentTopicList = []; for "_i" from 0 to (_numEntries - 1) do { _current = _this select _i; if (typename _current == "ARRAY") then { // Parameter is an entry for the briefing, apply it to the _currentUnits pool // {_x createDiaryRecord ["Diary", [_current select 0, _current select 1]];} forEach _currentUnits; _currentTopicList = _currentTopicList + [[_current select 0, _current select 1]]; } else { // Parameter is a filter for the units. Remove the _currentUnits from the pool and select // units according to the filter. Note: not removing anything on _i = 0 if (_i != 0) then { _unitPool = _unitPool - _currentUnits; }; if (count _currentTopicList > 0) then { [_currentUnits, _currentTopicList] call FHQ_TT_addBriefingEntries; _currentTopicList = []; }; _currentUnits = [_current, _unitPool] call FHQ_TT_filterUnits; }; }; // Add any leftovers if (count _currentTopicList > 0) then { [_currentUnits, _currentTopicList] call FHQ_TT_addBriefingEntries; _currentTopicList = []; }; }; /* FHQ_TT_getTaskName * Internal */ FHQ_TT_getTaskName = { private ["_task", "_name"]; _task = (_this select 0) select 0; if (typename _task == "ARRAY") then { _name = _task select 0; } else { _name = _task; }; _name; }; /* FHQ_TT_createSimpleTask: * * Internal */ FHQ_TT_createSimpleTask = { private ["_currentUnits", "_currentTask", "_currentTaskState", "_taskObjects", "_taskName"]; _currentUnits = _this select 0; _currentTask = _this select 1; // [name|[name,parent], text, title, waypoint, object/position] _currentTaskState = _this select 2; _taskObjects = []; { private "_task"; if (typename (_currentTask select 0) == "ARRAY") then { private ["_parentTask"]; _taskName = (_currentTask select 0) select 0; _parentTask = (_currentTask select 0) select 1; _task = _x createSimpleTask [_taskName, _x getVariable format["FHQ_TT_taskname_%1", _parentTask]]; } else { _taskName = _currentTask select 0; _task = _x createSimpleTask [_currentTask select 0]; }; _task setSimpleTaskDescription [_currentTask select 1, _currentTask select 2, _currentTask select 3]; if (count _currentTask > 4) then { switch (typename (_currentTask select 4)) do { case "ARRAY": { _task setSimpleTaskDestination (_currentTask select 4); }; case "OBJECT": { _task setSimpleTaskTarget [_currentTask select 4, true]; }; }; }; _task setTaskState _currentTaskState; if (tolower(_currentTaskState) == "assigned") then { _x setCurrentTask _task; }; _x setVariable [format["FHQ_TT_taskname_%1", _taskName], _task, true]; _taskObjects = _taskObjects + [_task]; } forEach _currentUnits; _taskObjects; }; /* Internal */ FHQ_TT_addTaskEntries = { private ["_currentUnits", "_tasks", "_count", "_i", "_current", "_state"]; _currentUnits = _this select 0; _tasks = _this select 1; _count = count _tasks; if (_count > 0) then { if (FHQ_TT_is_arma3) then { for [ {_i = 0}, {_i < _count}, {_i = _i + 1}] do { _current = _tasks select _i; _state = "created"; // Optional state if (count _current >= 6) then { _state = _current select 5; }; // fifth element is either an object/position, or a string. In the latter case, // object/position was ommited but initial state given if (count _current >= 5) then { if (typename (_current select 4) == "STRING") then { _state = _current select 4; }; }; FHQ_TT_TaskList = FHQ_TT_TaskList + [[_currentUnits, _current, _state]]; }; } else { for [ {_i = _count - 1}, {_i >= 0}, {_i = _i - 1}] do { _current = _tasks select _i; _state = "created"; // Optional state if (count _current >= 6) then { _state = _current select 5; }; // fifth element is either an object/position, or a string. In the latter case, // object/position was ommited but initial state given if (count _current >= 5) then { if (typename (_current select 4) == "STRING") then { _state = _current select 4; }; }; FHQ_TT_TaskList = FHQ_TT_TaskList + [[_currentUnits, _current, _state]]; }; } }; }; /* FHQ_TT_addTasks: Add tasks to the mission * * write me * */ FHQ_TT_addTasks = { private ["_numEntries", "_unitPool", "_currentUnits", "_currentTaskList", "_current"]; if (!isServer) exitWith {}; _numEntries = count _this; if (_numEntries <= 0) exitWith {}; _unitPool = (if (isMultiplayer) then {playableUnits} else {switchableUnits}); _currentUnits = _unitPool; _currentTaskList = []; for "_i" from 0 to (_numEntries - 1) do { _current = _this select _i; if (typename _current == "ARRAY") then { _currentTaskList = _currentTaskList + [_current]; } else { // Parameter is a filter for the units. if (_i != 0) then { _unitPool = _unitPool - _currentUnits; }; if (count _currentTaskList > 0) then { [_currentUnits, _currentTaskList] call FHQ_TT_addTaskEntries; _currentTaskList = []; }; _currentUnits = [_current, _unitPool] call FHQ_TT_filterUnits; }; }; if (count _currentTaskList > 0) then { [_currentUnits, _currentTaskList] call FHQ_TT_addTaskEntries; }; // Send task list to clients publicVariable "FHQ_TT_TaskList"; if (!isDedicated) then { FHQ_TT_TaskList call FHQ_TT_UpdateTaskList; }; FHQ_TT_initialized = true; publicVariable "FHQ_TT_initialized"; }; FHQ_TT_hasTask = { private "_result"; _result = false; { if ((_x call FHQ_TT_getTaskName) == _this) exitWith {_result = true;}; } forEach FHQ_TT_ClientTaskList; _result; }; FHQ_TT_taskHint = { if (!FHQ_TT_is_arma3) then { /* Arma 2 */ private ["_desc", "_state", "_color", "_icon", "_text"]; _desc = _this select 0; _state = _this select 1; _color = [1, 1, 1, 1]; _icon = "taskNew"; _text = "New Task"; switch (tolower(_state)) do { case "created": { _color = [1, 1, 1, 1]; _icon = "taskNew"; _text = localize "str_taskNew"; }; case "assigned": { _color = [1, 1, 1, 1]; _icon = "taskCurrent"; _text = localize "str_taskSetCurrent"; }; case "succeeded": { _color = [0.600000,0.839215,0.466666,1]; _icon = "taskDone"; _text = localize "str_taskAccomplished"; }; case "canceled": { _color = [0.75,0.75,0.75,1]; _icon = "taskFailed"; _text = localize "str_taskCancelled"; }; case "cancelled": { _color = [0.75,0.75,0.75,1]; _icon = "taskFailed"; _text = localize "str_taskCancelled"; }; case "failed": { _color = [0.972549,0.121568,0,1]; _icon = "taskFailed"; _text = localize "str_taskFailed"; }; }; taskHint [format ["%1\n%2", _text, _desc], _color, _icon]; } else { /* Arma 3 */ private ["_notifyTemplate", "_desc", "_state"]; _desc = _this select 0; _state = _this select 1; switch (tolower _state) do { case "created": { _notifyTemplate = "TaskCreated"; }; case "assigned": { _notifyTemplate = "TaskAssigned"; }; case "succeeded": { _notifyTemplate = "TaskSucceeded"; }; case "canceled": { _notifyTemplate = "TaskCanceled"; }; case "cancelled": { _notifyTemplate = "TaskCanceled"; }; case "failed": { _notifyTemplate = "TaskFailed"; }; }; [_notifyTemplate, ["", _desc]] call BIS_fnc_showNotification; }; }; FHQ_TT_UpdateTaskList = { if (isDedicated) exitWith {}; private ["_count", "_i", "_tasks"]; _tasks = _this; _count = count _tasks; if (_count > 0) then { for [ {_i = 0}, {_i < _count}, {_i = _i + 1}] do { private ["_current", "_currentUnits", "_taskObjects", "_currentTask", "_currentTaskState", "_currentTaskName", "_currentTaskParent"]; _current = _tasks select _i; // [units, taskDesc, state] _currentTask = _current select 1; // [name|[name,parent], text, title, waypoint, object/position] _currentUnits = _current select 0; _currentTaskState = _current select 2; _currentTaskName = ""; _currentTaskParent = ""; if (typename (_currentTask select 0) == "ARRAY") then { _currentTaskName = (_currentTask select 0) select 0; _currentTaskParent = (_currentTask select 0) select 1; } else { _currentTaskName = _currentTask select 0; }; if (_currentTaskName call FHQ_TT_hasTask) then { private ["_localTask", "_x", "_task"]; _localTask = FHQ_TT_ClientTaskList select _i; // [name, state, objects] diag_log format["_localTask -> %1, _curent -> %2", _localTask select 1, _current select 2]; if ((_current select 2) != (_localTask select 1)) then { // Update the task _localTask set [1, _current select 2]; FHQ_TT_ClientTaskList set [_i, _localTask]; if (player in (_currentUnits)) then { [_currentTask select 2, _current select 2] call FHQ_TT_taskHint; }; { _task = _x; if (_current select 2 == "assigned") then { { if (_task in (simpletasks _x)) then { _x setCurrentTask _task; }; } forEach _currentUnits; }; _task setTaskState (_current select 2); } forEach (_localTask select 2); }; } else { _taskObjects = [_currentUnits, _currentTask, _currentTaskState] call FHQ_TT_createSimpleTask; FHQ_TT_ClientTaskList set [_i, [(_current select 1), _currentTaskState, _taskObjects]]; if (player in (_currentUnits) && !FHQ_TT_supressTaskHints) then { [_currentTask select 2, _currentTaskState] call FHQ_TT_taskHint; }; }; }; }; }; /* FHQ_TT_setTaskState: Set state of a specific task * * write me * * [_taskName, _state] call FHQ_TT_setTaskState; */ FHQ_TT_setTaskState = { if (!isServer) exitWith {}; private ["_count", "_taskName", "_newState", "_i", "_curTask"]; _count = count FHQ_TT_TaskList; _taskName = _this select 0; _newState = _this select 1; for [ {_i = 0}, {_i < _count}, {_i = _i + 1}] do { _curTask = FHQ_TT_TaskList select _i; diag_log format["_curTask = %1", _curTask]; //if (_taskName == ((_curTask select 1) select 0)) exitWith if (_taskName == ([_curTask select 1] call FHQ_TT_getTaskName)) exitWith { _curTask set [2, _newState]; FHQ_TT_TaskList set [_i, _curTask]; }; }; publicVariable "FHQ_TT_TaskList"; if (!isDedicated) then { FHQ_TT_TaskList call FHQ_TT_UpdateTaskList; }; }; /* FHQ_TT_getTaskState: Get state of a specific task * * write me * * _result = [_taskName] call FHQ_TT_getTaskState; */ FHQ_TT_getTaskState = { private ["_result", "_taskName"]; _result = ""; _taskName = _this select 0; { // if (((_x select 1) select 0) == _taskname) exitWith if (([_x select 1] call FHQ_TT_getTaskName) == _taskname) exitWith { _result = (_x select 2); }; } forEach FHQ_TT_TaskList; _result; }; /* FHQ_TT_isTaskCompleted: Check whether a task is canceled, successful or failed * * _result = [_taskName] call FHQ_TT_isTaskCompleted; */ FHQ_TT_isTaskCompleted = { private "_result"; _result = (tolower(_this call FHQ_TT_getTaskState) in ["succeeded", "canceled", "failed"]); _result; }; /* FHQ_TT_areTasksCompleted: Check for all tasks given whether they are cancelled, successful, or failed * _result = [_taskName1, _taskName2, ...] call FHQ_TT_areTasksCompleted */ FHQ_TT_areTasksCompleted = { private ["_result", "_x"]; _result = true; { if (!(tolower ([_x] call FHQ_TT_getTaskState) in ["succeeded", "canceled", "failed"])) exitWith { _result = false; }; } forEach _this; _result; }; /* FHQ_TT_isTaskSuccessful: Check whether a task is ended successfully * * _result = [_taskName] call FHQ_TT_isTaskSuccessful; */ FHQ_TT_isTaskSuccessful = { private "_result"; _result = (tolower(_this call FHQ_TT_getTaskState) == "succeeded"); _result; }; /* FHQ_TT_areTasksSuccessful: Check success for all tasks given * _result = [_taskName1, _taskName2, ...] call FHQ_TT_areTasksSuccessful */ FHQ_TT_areTasksSuccessful = { private ["_result", "_x"]; _result = true; { if (tolower ([_x] call FHQ_TT_getTaskState) != "succeeded") exitWith { _result = false; }; } forEach _this; _result; }; /* FHQ_TT_getAllTasksWithState: Get all tasks with a given state * * _taskList = [_state] call FHQ_TT_getAllTasksWithState; */ FHQ_TT_getAllTasksWithState = { private ["_result", "_taskState"]; _result = []; _taskState = _this select 0; { if ((_x select 2) == _taskState) then { _result = _result + [(_x select 1) select 0]; }; } forEach FHQ_TT_TaskList; _result; }; /* FHQ_TT_markTaskAndNext: Mark a task as completed, and look for the next * open task. * * ["taskName", "state", ("newTask1", "newTask2" ... )] call FHQ_TT_markTaskAndNext; */ FHQ_TT_markTaskAndNext = { private "_i"; [_this select 0, _this select 1] call FHQ_TT_setTaskState; for [ {_i = 2}, {_i < count _this}, {_i = _i + 1} ] do { if (!([_this select _i] call FHQ_TT_isTaskCompleted)) exitWith { [_this select _i, "assigned"] call FHQ_TT_setTaskState; }; }; }; /* ------------ End of file, calling init ------------ */ call FHQ_TT_init; "area0" setMarkerAlpha 0; call compile preProcessFileLineNumbers "fhqtt.sqf"; call compile preProcessFileLineNumbers "briefing.sqf"; execVM "ups.sqf"; switch (paramsArray select 0) do { case 0: { 0 setOvercast 0; 0 setRain 0; }; case 1: { 0 setOvercast 0.8; 0 setRain 0.3; }; case 2: { 0 setOvercast 0.9; 0 setRain 0.6; }; case 3: { 0 setOvercast 1; 0 setRain 1; }; }; switch (paramsArray select 1) do { case 0: { 0 setFog 0; }; case 1: { 0 setFog 0.3; }; case 2: { 0 setFog 0.6; }; case 3: { 0 setFog 1; }; }; viewparam = (paramsArray select 2); if (viewparam == 0) then {setViewDistance 100}; if (viewparam == 1) then {setViewDistance 500}; if (viewparam == 2) then {setViewDistance 1000}; if (viewparam == 3) then {setViewDistance 2000}; if (viewparam == 4) then {setViewDistance 5000};version=11; class Mission { addOns[]= { "takistan", "cacharacters_e", "ca_modules_functions", "CAWheeled_E", "catracked_e_m113", "cawheeled_e_v3s", "camisc3", "caweapons_e", "CATracked_E", "camisc_e", "ace_main", "ace_sys_wounds", "caweapons_e_ammoboxes", "ca_modules_silvie", "ace_sys_repair" }; addOnsAuto[]= { "cacharacters_e", "ca_modules_functions", "caweapons_e", "CATracked_E", "ace_main", "ace_sys_wounds", "CAWheeled_E", "catracked_e_m113", "cawheeled_e_v3s", "ca_modules_silvie", "ace_sys_repair", "camisc3", "camisc_e", "caweapons_e_ammoboxes", "takistan" }; randomSeed=4205779; class Intel { briefingName="ACE CO 10 Truck Stop Load"; briefingDescription="Eliminate the convoy containing the KSK Officer as hostage. The hostage must be alive. Once the convoy is eliminated and the hostage gives you intel on the location of the AA site at Chak Chak, eliminate the Takistani AA site."; startWeather=0.39999998; forecastWeather=0.39999998; year=2013; day=22; hour=8; minute=0; }; class Groups { items=42; class Item0 { side="WEST"; class Vehicles { items=9; class Item0 { position[]={3718.2285,677.81903,2727.9739}; special="NONE"; id=0; side="WEST"; vehicle="US_Soldier_SL_EP1"; player="PLAYER COMMANDER"; leader=1; rank="LIEUTENANT"; skill=1; text="p1"; description="US Army Squad Leader"; }; class Item1 { position[]={3719.3994,677.96204,2727.301}; special="NONE"; id=1; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; rank="SERGEANT"; skill=1; text="p2"; description="US Army Grenadier"; }; class Item2 { position[]={3717.0032,677.74872,2727.3374}; special="NONE"; id=2; side="WEST"; vehicle="US_Soldier_MG_EP1"; player="PLAY CDG"; rank="SERGEANT"; skill=1; text="p3"; description="US Army Machinegunner"; }; class Item3 { position[]={3720.3447,678.02625,2726.4978}; special="NONE"; id=3; side="WEST"; vehicle="US_Soldier_AT_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="p4"; description="US Army AT Gunner"; }; class Item4 { position[]={3715.8054,677.74249,2726.583}; special="NONE"; id=4; side="WEST"; vehicle="US_Soldier_GL_EP1"; player="PLAY CDG"; rank="SERGEANT"; skill=1; text="p5"; description="US Army Grenadier"; }; class Item5 { position[]={3721.3779,678.10266,2725.5847}; special="NONE"; id=5; side="WEST"; vehicle="US_Soldier_AR_EP1"; player="PLAY CDG"; rank="CORPORAL"; skill=1; text="p6"; description="US Army Automatic Rifleman"; }; class Item6 { position[]={3714.5894,677.75281,2725.8198}; special="NONE"; id=6; side="WEST"; vehicle="US_Soldier_Engineer_EP1"; player="PLAY CDG"; skill=1; text="p7"; description="US Army Engineer"; }; class Item7 { position[]={3722.6072,678.11707,2724.6101}; special="NONE"; id=7; side="WEST"; vehicle="US_Soldier_AAT_EP1"; player="PLAY CDG"; skill=1; text="p8"; description="US Army Rifleman (MAAWs ammo)"; }; class Item8 { position[]={3713.2686,677.76337,2724.9795}; special="NONE"; id=8; side="WEST"; vehicle="US_Soldier_Medic_EP1"; player="PLAY CDG"; skill=1; text="p9"; description="US Army Medic"; }; }; }; class Item1 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3761.95,659.47382,2705.1973}; id=9; side="LOGIC"; vehicle="FunctionsManager"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item2 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4652.5015,317.63293,710.38281}; azimut=181.59599; special="NONE"; id=11; side="EAST"; vehicle="ZU23_TK_INS_EP1"; leader=1; rank="SERGEANT"; skill=0.60000002; text="aa4"; }; }; }; class Item3 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4383.1626,332.60809,630.7785}; azimut=149.589; special="NONE"; id=12; side="EAST"; vehicle="ZU23_TK_INS_EP1"; leader=1; rank="SERGEANT"; skill=0.60000002; text="aa2"; }; }; }; class Item4 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4473.2432,341.85486,699.19141}; azimut=23.2833; special="NONE"; id=13; side="EAST"; vehicle="ZU23_TK_INS_EP1"; leader=1; rank="SERGEANT"; skill=0.60000002; text="aa3"; }; }; }; class Item5 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4287.4233,326.25357,651.55487}; azimut=28.3871; special="NONE"; id=14; side="EAST"; vehicle="ZU23_TK_INS_EP1"; leader=1; rank="SERGEANT"; skill=0.60000002; text="aa1"; }; }; }; class Item6 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4232.4722,323.84842,523.04852}; special="NONE"; id=15; side="EAST"; vehicle="ZSU_TK_EP1"; leader=1; rank="SERGEANT"; skill=0.47486293; fuel=0; text="shilka1"; }; }; }; class Item7 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4724.0874,317.61807,723.68695}; azimut=-25.9788; special="NONE"; id=16; side="EAST"; vehicle="ZSU_TK_EP1"; leader=1; rank="SERGEANT"; skill=0.47486293; fuel=0; text="shilka2"; }; }; }; class Item8 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4196.7183,324.02872,552.17358}; azimut=-95.788696; special="NONE"; id=18; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item9 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4199.311,324.03226,535.21497}; azimut=-95.788696; special="NONE"; id=20; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item10 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4741.6631,317.45007,741.78339}; azimut=65.99437; special="NONE"; id=22; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item11 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4733.8989,317.4921,757.08173}; azimut=65.99437; special="NONE"; id=24; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item12 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4429.3857,346.52734,856.90546}; azimut=13.676837; special="NONE"; id=26; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item13 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4412.5332,347.09512,860.11255}; azimut=13.676837; special="NONE"; id=28; side="EAST"; vehicle="DSHKM_TK_INS_EP1"; leader=1; skill=0.40253675; }; }; }; class Item14 { side="EAST"; class Vehicles { items=5; class Item0 { position[]={4393.6572,324.12125,578.81396}; special="NONE"; id=29; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; leader=1; rank="SERGEANT"; skill=0.50150913; init="nul=[this,""area0""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4391.6675,324.23602,577.73895}; special="NONE"; id=30; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; rank="CORPORAL"; skill=0.36446983; }; class Item2 { position[]={4393.103,323.97488,577.37732}; special="NONE"; id=31; side="EAST"; vehicle="TK_INS_Soldier_AR_EP1"; rank="CORPORAL"; skill=0.43679598; }; class Item3 { position[]={4394.4429,323.85556,577.45129}; special="NONE"; id=32; side="EAST"; vehicle="TK_INS_Soldier_AT_EP1"; skill=0.27311048; }; class Item4 { position[]={4395.5615,323.91364,578.22113}; special="NONE"; id=33; side="EAST"; vehicle="TK_INS_Bonesetter_EP1"; skill=0.2; }; }; }; class Item15 { side="EAST"; class Vehicles { items=5; class Item0 { position[]={4382.3477,340.76169,680.86401}; special="NONE"; id=34; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; leader=1; rank="SERGEANT"; skill=0.50150913; init="nul=[this,""area0""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4380.3579,340.32742,679.789}; special="NONE"; id=35; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; rank="CORPORAL"; skill=0.36446983; }; class Item2 { position[]={4381.7935,340.23483,679.42737}; special="NONE"; id=36; side="EAST"; vehicle="TK_INS_Soldier_AR_EP1"; rank="CORPORAL"; skill=0.43679598; }; class Item3 { position[]={4383.1333,340.29459,679.50134}; special="NONE"; id=37; side="EAST"; vehicle="TK_INS_Soldier_EP1"; skill=0.27311048; }; class Item4 { position[]={4384.252,340.5835,680.27118}; special="NONE"; id=38; side="EAST"; vehicle="TK_INS_Bonesetter_EP1"; skill=0.2; }; }; }; class Item16 { side="EAST"; class Vehicles { items=5; class Item0 { position[]={4434.2285,336.70419,641.30023}; special="NONE"; id=39; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; leader=1; rank="SERGEANT"; skill=0.50150913; init="nul=[this,""area0""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4432.2388,336.24561,640.22522}; special="NONE"; id=40; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; rank="CORPORAL"; skill=0.36446983; }; class Item2 { position[]={4433.6743,336.12277,639.86359}; special="NONE"; id=41; side="EAST"; vehicle="TK_INS_Soldier_AR_EP1"; rank="CORPORAL"; skill=0.43679598; }; class Item3 { position[]={4435.0142,336.17142,639.93756}; special="NONE"; id=42; side="EAST"; vehicle="TK_INS_Soldier_EP1"; skill=0.27311048; }; class Item4 { position[]={4436.1328,336.50479,640.7074}; special="NONE"; id=43; side="EAST"; vehicle="TK_INS_Bonesetter_EP1"; skill=0.2; }; }; }; class Item17 { side="EAST"; class Vehicles { items=5; class Item0 { position[]={4468.8105,341.38297,678.50116}; special="NONE"; id=44; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; leader=1; rank="SERGEANT"; skill=0.50150913; init="nul=[this,""area0""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4466.8208,341.53745,677.42615}; special="NONE"; id=45; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; rank="CORPORAL"; skill=0.36446983; }; class Item2 { position[]={4468.2563,341.2579,677.06451}; special="NONE"; id=46; side="EAST"; vehicle="TK_INS_Soldier_AR_EP1"; rank="CORPORAL"; skill=0.43679598; }; class Item3 { position[]={4469.5962,341.00073,677.13849}; special="NONE"; id=47; side="EAST"; vehicle="TK_INS_Soldier_AT_EP1"; skill=0.27311048; }; class Item4 { position[]={4470.7148,340.8642,677.90833}; special="NONE"; id=48; side="EAST"; vehicle="TK_INS_Bonesetter_EP1"; skill=0.2; }; }; }; class Item18 { side="EAST"; class Vehicles { items=5; class Item0 { position[]={4491.6631,319.54379,596.21436}; special="NONE"; id=49; side="EAST"; vehicle="TK_INS_Soldier_TL_EP1"; leader=1; rank="SERGEANT"; skill=0.50150913; init="nul=[this,""area0""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4489.6733,319.50232,595.13934}; special="NONE"; id=50; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; rank="CORPORAL"; skill=0.36446983; }; class Item2 { position[]={4491.1089,319.56558,594.77771}; special="NONE"; id=51; side="EAST"; vehicle="TK_INS_Soldier_AR_EP1"; rank="CORPORAL"; skill=0.43679598; }; class Item3 { position[]={4492.4487,319.61536,594.85168}; special="NONE"; id=52; side="EAST"; vehicle="TK_INS_Soldier_AT_EP1"; skill=0.27311048; }; class Item4 { position[]={4493.5674,319.59244,595.62152}; special="NONE"; id=53; side="EAST"; vehicle="TK_INS_Bonesetter_EP1"; skill=0.2; }; }; }; class Item19 { side="EAST"; class Vehicles { items=3; class Item0 { position[]={4427.4868,346.28088,849.18066}; special="NONE"; id=54; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; leader=1; rank="SERGEANT"; skill=0.53196275; init="nul=[this,""area0"",""nomove""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4425.9712,346.28842,848.2735}; special="NONE"; id=55; side="EAST"; vehicle="TK_INS_Soldier_4_EP1"; rank="CORPORAL"; skill=0.52434969; }; class Item2 { position[]={4428.1777,346.26401,847.58453}; special="NONE"; id=56; side="EAST"; vehicle="TK_INS_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.56622225; }; }; }; class Item20 { side="EAST"; class Vehicles { items=3; class Item0 { position[]={4724.6963,317.64532,730.07159}; azimut=28.785791; special="NONE"; id=57; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; leader=1; rank="SERGEANT"; skill=0.53196275; init="nul=[this,""area0"",""nomove""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4722.9316,317.65063,730.00641}; azimut=28.785791; special="NONE"; id=58; side="EAST"; vehicle="TK_INS_Soldier_4_EP1"; rank="CORPORAL"; skill=0.52434969; }; class Item2 { position[]={4724.5342,317.63751,728.33984}; azimut=28.785791; special="NONE"; id=59; side="EAST"; vehicle="TK_INS_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.56622225; }; }; }; class Item21 { side="EAST"; class Vehicles { items=3; class Item0 { position[]={4203.3818,324.00131,552.46185}; azimut=241.46576; special="NONE"; id=60; side="EAST"; vehicle="TK_INS_Soldier_2_EP1"; leader=1; rank="SERGEANT"; skill=0.53196275; init="nul=[this,""area0"",""nomove""] execVM ""scripts\upsmon.sqf"";"; }; class Item1 { position[]={4204.9038,323.99649,551.56525}; azimut=241.46576; special="NONE"; id=61; side="EAST"; vehicle="TK_INS_Soldier_4_EP1"; rank="CORPORAL"; skill=0.52434969; }; class Item2 { position[]={4204.4551,323.96744,553.83069}; azimut=241.46576; special="NONE"; id=62; side="EAST"; vehicle="TK_INS_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.56622225; }; }; }; class Item22 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3639.137,645.03766,2781.6514}; id=66; side="LOGIC"; vehicle="ACE_Required_Logic"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item23 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3691.8408,653.47461,2783.1721}; id=67; side="LOGIC"; vehicle="ACE_Wounds_Logic"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item24 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={3749.2908,223.11119,4344.7432}; special="NONE"; id=69; side="WEST"; vehicle="GER_Soldier_TL_EP1"; player="PLAY CDG"; leader=1; rank="CAPTAIN"; skill=1; text="p10"; init="this setCaptive true; removeAllWeapons this; removeAllItems this; removeBackpack this;"; description="KSK Hostage (must be alive)"; }; }; }; class Item25 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={3550.6902,256.74307,4039.7766}; azimut=180; special="NONE"; id=70; side="EAST"; vehicle="UAZ_MG_TK_EP1"; skill=0.60000002; text="c7"; }; class Item1 { position[]={3554.7573,256.6467,4040.6194}; special="CARGO"; id=99; side="EAST"; vehicle="TK_Soldier_AR_EP1"; leader=1; rank="SERGEANT"; skill=0.48247623; text="a48"; }; }; class Waypoints { items=2; class Item0 { position[]={3551.0623,257.44217,4035.9604}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.8477,360.54141,316.28964}; class Effects { }; showWP="NEVER"; }; }; }; class Item26 { side="EAST"; class Vehicles { items=12; class Item0 { position[]={3548.1968,254.17694,4054.1763}; azimut=180; special="NONE"; id=71; side="EAST"; vehicle="M113_TK_EP1"; skill=0.60000002; text="c8"; }; class Item1 { position[]={3554.2476,253.33754,4058.6799}; special="CARGO"; id=87; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="a51"; }; class Item2 { position[]={3557.2476,254.25185,4053.6799}; special="CARGO"; id=88; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="a52"; }; class Item3 { position[]={3559.2476,254.25734,4053.6799}; special="CARGO"; id=89; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a53"; }; class Item4 { position[]={3561.2476,254.24774,4053.6799}; special="CARGO"; id=90; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="a54"; }; class Item5 { position[]={3563.2476,254.24651,4053.6799}; special="CARGO"; id=91; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="a55"; }; class Item6 { position[]={3565.2476,254.2579,4053.6799}; special="CARGO"; id=92; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a56"; }; class Item7 { position[]={3567.2476,254.2547,4053.6799}; special="CARGO"; id=93; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="a57"; }; class Item8 { position[]={3569.2476,254.26582,4053.6799}; special="CARGO"; id=94; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="a58"; }; class Item9 { position[]={3571.2476,254.32022,4053.6799}; special="CARGO"; id=95; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="a59"; }; class Item10 { position[]={3573.6079,254.37625,4053.7957}; special="CARGO"; id=96; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="a60"; }; class Item11 { position[]={3575.2881,254.43524,4053.8484}; special="CARGO"; id=97; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="a61"; }; }; class Waypoints { items=2; class Item0 { position[]={3548.3296,254.8481,4050.321}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2094.5293,360.50699,317.02963}; class Effects { }; showWP="NEVER"; }; }; }; class Item27 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={3538.8521,239.55612,4136.0693}; azimut=180; special="NONE"; id=75; side="EAST"; vehicle="UAZ_AGS30_TK_EP1"; skill=0.60000002; text="c12"; }; class Item1 { position[]={3542.6594,239.54846,4137.1523}; special="CARGO"; id=98; side="EAST"; vehicle="TK_Soldier_AR_EP1"; leader=1; rank="SERGEANT"; skill=0.48247623; text="a1"; }; }; class Waypoints { items=2; class Item0 { position[]={3539.1548,240.37279,4131.1162}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2090.5745,360.71527,321.25522}; class Effects { }; showWP="NEVER"; }; }; }; class Item28 { side="EAST"; class Vehicles { items=12; class Item0 { position[]={3546.8369,242.00682,4123.334}; special="CARGO"; id=76; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="a2"; }; class Item1 { position[]={3549.8369,242.91864,4118.334}; special="CARGO"; id=77; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="a3"; }; class Item2 { position[]={3551.8369,242.93301,4118.334}; special="CARGO"; id=78; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a4"; }; class Item3 { position[]={3553.8369,242.94582,4118.334}; special="CARGO"; id=79; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="a5"; }; class Item4 { position[]={3555.8369,242.95862,4118.334}; special="CARGO"; id=80; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="a6"; }; class Item5 { position[]={3557.8369,242.96577,4118.334}; special="CARGO"; id=81; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a7"; }; class Item6 { position[]={3559.8369,242.96898,4118.334}; special="CARGO"; id=82; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="a8"; }; class Item7 { position[]={3561.8369,242.97218,4118.334}; special="CARGO"; id=83; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="a9"; }; class Item8 { position[]={3563.8369,242.98888,4118.334}; special="CARGO"; id=84; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="a10"; }; class Item9 { position[]={3566.1973,242.99486,4118.4492}; special="CARGO"; id=85; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="a11"; }; class Item10 { position[]={3567.8774,243.00426,4118.502}; special="CARGO"; id=86; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="a12"; }; class Item11 { position[]={3540.4839,242.27269,4120.7021}; azimut=180; special="NONE"; id=74; side="EAST"; vehicle="M113_TK_EP1"; skill=0.60000002; text="c11"; }; }; class Waypoints { items=2; class Item0 { position[]={3540.5212,242.95163,4116.8535}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.2925,360.61761,320.03354}; class Effects { }; showWP="NEVER"; }; }; }; class Item29 { side="EAST"; class Vehicles { items=14; class Item0 { position[]={3551.5398,249.98618,4077.0483}; special="CARGO"; id=100; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="a37"; }; class Item1 { position[]={3554.5398,250.81929,4072.0483}; special="CARGO"; id=101; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="a38"; }; class Item2 { position[]={3556.5398,250.75943,4072.0483}; special="CARGO"; id=102; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a39"; }; class Item3 { position[]={3558.5398,250.70503,4072.0483}; special="CARGO"; id=103; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="a40"; }; class Item4 { position[]={3560.5398,250.6335,4072.0483}; special="CARGO"; id=104; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="a41"; }; class Item5 { position[]={3562.5398,250.55368,4072.0483}; special="CARGO"; id=105; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a42"; }; class Item6 { position[]={3564.5398,250.48329,4072.0483}; special="CARGO"; id=106; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="a43"; }; class Item7 { position[]={3566.5398,250.3833,4072.0483}; special="CARGO"; id=107; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="a44"; }; class Item8 { position[]={3568.5398,250.2585,4072.0483}; special="CARGO"; id=108; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="a45"; }; class Item9 { position[]={3570.9001,250.15692,4072.1641}; special="CARGO"; id=109; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="a46"; }; class Item10 { position[]={3572.5803,250.17691,4072.2168}; special="CARGO"; id=110; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="a47"; }; class Item11 { position[]={3574.7161,250.28358,4072.1895}; special="CARGO"; id=111; side="EAST"; vehicle="TK_Soldier_Engineer_EP1"; skill=0.2; text="a49"; }; class Item12 { position[]={3577.4102,250.46336,4072.4663}; special="CARGO"; id=123; side="EAST"; vehicle="TK_Soldier_EP1"; skill=0.2; text="a50"; }; class Item13 { position[]={3544.9946,250.61372,4074.5225}; azimut=180; special="NONE"; id=72; side="EAST"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="c9"; init="this addMagazineCargo [""Pipebomb"", 5];"; }; }; class Waypoints { items=2; class Item0 { position[]={3545.2061,251.50035,4069.4717}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.3618,360.56995,316.96176}; class Effects { }; showWP="NEVER"; }; }; }; class Item30 { side="EAST"; class Vehicles { items=11; class Item0 { position[]={3551.832,247.16521,4093.3042}; special="CARGO"; id=112; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="a26"; init="this moveindriver car1;"; }; class Item1 { position[]={3554.832,247.95827,4088.3042}; special="CARGO"; id=113; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="a27"; init="this moveincargo car1;"; }; class Item2 { position[]={3556.832,247.92758,4088.3042}; special="CARGO"; id=114; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a28"; init="this moveincargo car1;"; }; class Item3 { position[]={3558.832,247.88919,4088.3042}; special="CARGO"; id=115; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="a29"; init="this moveincargo car1;"; }; class Item4 { position[]={3560.832,247.85078,4088.3042}; special="CARGO"; id=116; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="a30"; init="this moveincargo car1;"; }; class Item5 { position[]={3562.832,247.82193,4088.3042}; special="CARGO"; id=117; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a31"; init="this moveincargo car1;"; }; class Item6 { position[]={3564.832,247.78673,4088.3042}; special="CARGO"; id=118; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="a32"; init="this moveincargo car1;"; }; class Item7 { position[]={3566.832,247.75153,4088.3042}; special="CARGO"; id=119; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="a33"; init="this moveincargo car1;"; }; class Item8 { position[]={3568.832,247.72861,4088.3042}; special="CARGO"; id=120; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="a34"; init="this moveincargo car1;"; }; class Item9 { position[]={3571.1924,247.7652,4088.4199}; special="CARGO"; id=121; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="a35"; init="this moveincargo car1;"; }; class Item10 { position[]={3572.8726,247.79538,4088.4727}; special="CARGO"; id=122; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="a36"; init="this moveincargo car1;"; }; }; class Waypoints { items=2; class Item0 { position[]={3544.8149,248.59584,4085.5925}; combatMode="YELLOW"; speed="LIMITED"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.2393,360.60403,319.20615}; class Effects { }; showWP="NEVER"; }; }; }; class Item31 { side="EAST"; class Vehicles { items=14; class Item0 { position[]={3564.8296,244.64015,4108.9336}; special="CARGO"; id=124; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="a13"; }; class Item1 { position[]={3567.8296,245.50334,4103.9336}; special="CARGO"; id=125; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="a14"; }; class Item2 { position[]={3569.8296,245.57481,4103.9336}; special="CARGO"; id=126; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a15"; }; class Item3 { position[]={3571.8296,245.68822,4103.9336}; special="CARGO"; id=127; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="a16"; }; class Item4 { position[]={3573.8296,245.81941,4103.9336}; special="CARGO"; id=128; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="a17"; }; class Item5 { position[]={3575.8296,246.03824,4103.9336}; special="CARGO"; id=129; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="a18"; }; class Item6 { position[]={3577.8296,246.36008,4103.9336}; special="CARGO"; id=130; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="a19"; }; class Item7 { position[]={3579.8296,246.62247,4103.9336}; special="CARGO"; id=131; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="a20"; }; class Item8 { position[]={3581.8296,246.98686,4103.9336}; special="CARGO"; id=132; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="a21"; }; class Item9 { position[]={3584.1899,247.66039,4104.0488}; special="CARGO"; id=133; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="a22"; }; class Item10 { position[]={3585.8701,248.09488,4104.1016}; special="CARGO"; id=134; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="a23"; }; class Item11 { position[]={3588.0059,248.71359,4104.0742}; special="CARGO"; id=135; side="EAST"; vehicle="TK_Soldier_Engineer_EP1"; skill=0.2; text="a24"; }; class Item12 { position[]={3590.7,249.58798,4104.3516}; special="CARGO"; id=136; side="EAST"; vehicle="TK_Soldier_EP1"; skill=0.2; text="a25"; }; class Item13 { position[]={3541.9724,245.04308,4105.5352}; azimut=180; special="NONE"; id=73; side="EAST"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="c10"; init="this addMagazineCargo [""Pipebomb"", 5];"; }; }; class Waypoints { items=2; class Item0 { position[]={3541.9854,245.99939,4100.1465}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2091.2046,360.66202,319.89902}; class Effects { }; showWP="NEVER"; }; }; }; class Item32 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={5379.1367,318.56702,4245.7617}; azimut=180; special="NONE"; id=137; side="EAST"; vehicle="UAZ_MG_TK_EP1"; skill=0.60000002; text="c1"; }; class Item1 { position[]={5383.2041,318.31729,4246.6045}; special="CARGO"; id=166; side="EAST"; vehicle="TK_Soldier_AR_EP1"; leader=1; rank="SERGEANT"; skill=0.48247623; text="b61"; }; }; class Waypoints { items=2; class Item0 { position[]={5378.5732,320.36954,4240.3262}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.426,360.59045,318.91925}; class Effects { }; showWP="NEVER"; }; }; }; class Item33 { side="EAST"; class Vehicles { items=12; class Item0 { position[]={5377.916,313.59091,4260.957}; azimut=180; special="NONE"; id=138; side="EAST"; vehicle="M113_TK_EP1"; skill=0.60000002; text="c2"; }; class Item1 { position[]={5383.9668,312.1825,4265.46}; special="CARGO"; id=154; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="b50"; }; class Item2 { position[]={5386.9668,313.83514,4260.46}; special="CARGO"; id=155; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="b51"; }; class Item3 { position[]={5388.9668,313.88507,4260.46}; special="CARGO"; id=156; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b52"; }; class Item4 { position[]={5390.9668,313.93582,4260.46}; special="CARGO"; id=157; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="b53"; }; class Item5 { position[]={5392.9668,313.98383,4260.46}; special="CARGO"; id=158; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="b54"; }; class Item6 { position[]={5394.9668,314.06104,4260.46}; special="CARGO"; id=159; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b55"; }; class Item7 { position[]={5396.9668,314.15515,4260.46}; special="CARGO"; id=160; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="b56"; }; class Item8 { position[]={5398.9668,314.24796,4260.46}; special="CARGO"; id=161; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="b57"; }; class Item9 { position[]={5400.9668,314.36395,4260.46}; special="CARGO"; id=162; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="b58"; }; class Item10 { position[]={5403.3271,314.49438,4260.5762}; special="CARGO"; id=163; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="b59"; }; class Item11 { position[]={5405.0068,314.59821,4260.6289}; special="CARGO"; id=164; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="b60"; }; }; class Waypoints { items=2; class Item0 { position[]={5377.7217,314.80853,4257.1826}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.0989,360.59659,318.32892}; class Effects { }; showWP="NEVER"; }; }; }; class Item34 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={5370.4805,291.98004,4343.0088}; azimut=180; special="NONE"; id=142; side="EAST"; vehicle="UAZ_AGS30_TK_EP1"; skill=0.60000002; text="c6"; }; class Item1 { position[]={5374.2871,291.75934,4344.0918}; special="CARGO"; id=165; side="EAST"; vehicle="TK_Soldier_AR_EP1"; leader=1; rank="SERGEANT"; skill=0.48247623; text="b1"; }; }; class Waypoints { items=2; class Item0 { position[]={5370.5645,292.74356,4339.0205}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.5232,360.57278,317.8382}; class Effects { }; showWP="NEVER"; }; }; }; class Item35 { side="EAST"; class Vehicles { items=12; class Item0 { position[]={5378.4648,294.45502,4330.2734}; special="CARGO"; id=143; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="b2"; }; class Item1 { position[]={5381.4648,295.55054,4325.2734}; special="CARGO"; id=144; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="b3"; }; class Item2 { position[]={5383.4648,295.56335,4325.2734}; special="CARGO"; id=145; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b4"; }; class Item3 { position[]={5385.4648,295.57614,4325.2734}; special="CARGO"; id=146; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="b5"; }; class Item4 { position[]={5387.4648,295.58511,4325.2734}; special="CARGO"; id=147; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="b6"; }; class Item5 { position[]={5389.4648,295.61307,4325.2734}; special="CARGO"; id=148; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b7"; }; class Item6 { position[]={5391.4648,295.64188,4325.2734}; special="CARGO"; id=149; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="b8"; }; class Item7 { position[]={5393.4648,295.67065,4325.2734}; special="CARGO"; id=150; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="b9"; }; class Item8 { position[]={5395.4648,295.68588,4325.2734}; special="CARGO"; id=151; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="b10"; }; class Item9 { position[]={5397.8252,295.67621,4325.3887}; special="CARGO"; id=152; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="b11"; }; class Item10 { position[]={5399.5059,295.67657,4325.4414}; special="CARGO"; id=153; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="b12"; }; class Item11 { position[]={5372.1123,295.04712,4327.6416}; azimut=180; special="NONE"; id=141; side="EAST"; vehicle="M113_TK_EP1"; skill=0.60000002; text="c5"; }; }; class Waypoints { items=2; class Item0 { position[]={5372.4336,295.74429,4324.4014}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.1931,360.59579,318.61993}; class Effects { }; showWP="NEVER"; }; }; }; class Item36 { side="EAST"; class Vehicles { items=14; class Item0 { position[]={5383.168,306.38229,4283.9873}; special="CARGO"; id=167; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="b37"; }; class Item1 { position[]={5386.168,307.94595,4278.9873}; special="CARGO"; id=168; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="b38"; }; class Item2 { position[]={5388.168,307.98755,4278.9873}; special="CARGO"; id=169; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b39"; }; class Item3 { position[]={5390.168,308.03687,4278.9873}; special="CARGO"; id=170; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="b40"; }; class Item4 { position[]={5392.168,308.09128,4278.9873}; special="CARGO"; id=171; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="b41"; }; class Item5 { position[]={5394.168,308.15704,4278.9873}; special="CARGO"; id=172; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b42"; }; class Item6 { position[]={5396.168,308.26511,4278.9873}; special="CARGO"; id=173; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="b43"; }; class Item7 { position[]={5398.168,308.36429,4278.9873}; special="CARGO"; id=174; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="b44"; }; class Item8 { position[]={5400.168,308.46698,4278.9873}; special="CARGO"; id=175; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="b45"; }; class Item9 { position[]={5402.5283,308.60657,4279.1035}; special="CARGO"; id=176; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="b46"; }; class Item10 { position[]={5404.208,308.75021,4279.1563}; special="CARGO"; id=177; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="b47"; }; class Item11 { position[]={5406.3438,308.96335,4279.1289}; special="CARGO"; id=178; side="EAST"; vehicle="TK_Soldier_Engineer_EP1"; skill=0.2; text="b48"; }; class Item12 { position[]={5409.0381,309.23807,4279.4053}; special="CARGO"; id=190; side="EAST"; vehicle="TK_Soldier_EP1"; skill=0.2; text="b49"; }; class Item13 { position[]={5376.623,307.07443,4281.4619}; azimut=180; special="NONE"; id=139; side="EAST"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="c3"; init="this addMagazineCargo [""Pipebomb"", 5];"; }; }; class Waypoints { items=2; class Item0 { position[]={5376.6729,308.63617,4276.3984}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.5442,360.57816,318.39972}; class Effects { }; showWP="NEVER"; }; }; }; class Item37 { side="EAST"; class Vehicles { items=11; class Item0 { position[]={5383.46,301.79849,4300.2432}; special="CARGO"; id=179; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="b26"; init="this moveindriver car2;"; }; class Item1 { position[]={5386.46,303.23654,4295.2432}; special="CARGO"; id=180; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="b27"; init="this moveincargo car2;"; }; class Item2 { position[]={5388.46,303.29837,4295.2432}; special="CARGO"; id=181; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b28"; init="this moveincargo car2;"; }; class Item3 { position[]={5390.46,303.37515,4295.2432}; special="CARGO"; id=182; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="b29"; init="this moveincargo car2;"; }; class Item4 { position[]={5392.46,303.45163,4295.2432}; special="CARGO"; id=183; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="b30"; init="this moveincargo car2;"; }; class Item5 { position[]={5394.46,303.53772,4295.2432}; special="CARGO"; id=184; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b31"; init="this moveincargo car2;"; }; class Item6 { position[]={5396.46,303.64655,4295.2432}; special="CARGO"; id=185; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="b32"; init="this moveincargo car2;"; }; class Item7 { position[]={5398.46,303.75534,4295.2432}; special="CARGO"; id=186; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="b33"; init="this moveincargo car2;"; }; class Item8 { position[]={5400.46,303.86029,4295.2432}; special="CARGO"; id=187; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="b34"; init="this moveincargo car2;"; }; class Item9 { position[]={5402.8203,303.99728,4295.3594}; special="CARGO"; id=188; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="b35"; init="this moveincargo car2;"; }; class Item10 { position[]={5404.501,304.10336,4295.4121}; special="CARGO"; id=189; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="b36"; init="this moveincargo car2;"; }; }; class Waypoints { items=2; class Item0 { position[]={5374.3232,304.3168,4290.8008}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2092.4255,360.59116,318.95538}; class Effects { }; showWP="NEVER"; }; }; }; class Item38 { side="EAST"; class Vehicles { items=14; class Item0 { position[]={5396.458,298.35498,4315.873}; special="CARGO"; id=191; side="EAST"; vehicle="TK_Soldier_SL_EP1"; leader=1; rank="LIEUTENANT"; skill=0.59999996; text="b13"; }; class Item1 { position[]={5399.458,299.75067,4310.873}; special="CARGO"; id=192; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="SERGEANT"; skill=0.46666664; text="b14"; }; class Item2 { position[]={5401.458,299.77457,4310.873}; special="CARGO"; id=193; side="EAST"; vehicle="TK_Soldier_AT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b15"; }; class Item3 { position[]={5403.458,299.97827,4310.873}; special="CARGO"; id=194; side="EAST"; vehicle="TK_Soldier_GL_EP1"; rank="CORPORAL"; skill=0.33333331; text="b16"; }; class Item4 { position[]={5405.458,300.2023,4310.873}; special="CARGO"; id=195; side="EAST"; vehicle="TK_Soldier_MG_EP1"; rank="CORPORAL"; skill=0.33333331; text="b17"; }; class Item5 { position[]={5407.458,300.69485,4310.873}; special="CARGO"; id=196; side="EAST"; vehicle="TK_Soldier_LAT_EP1"; rank="CORPORAL"; skill=0.33333331; text="b18"; }; class Item6 { position[]={5409.458,301.31561,4310.873}; special="CARGO"; id=197; side="EAST"; vehicle="TK_Soldier_GL_EP1"; skill=0.2; text="b19"; }; class Item7 { position[]={5411.458,301.92361,4310.873}; special="CARGO"; id=198; side="EAST"; vehicle="TK_Soldier_AAT_EP1"; skill=0.2; text="b20"; }; class Item8 { position[]={5413.458,302.56842,4310.873}; special="CARGO"; id=199; side="EAST"; vehicle="TK_Soldier_AMG_EP1"; skill=0.2; text="b21"; }; class Item9 { position[]={5415.8184,303.35959,4310.9883}; special="CARGO"; id=200; side="EAST"; vehicle="TK_Soldier_AR_EP1"; skill=0.31498331; text="b22"; }; class Item10 { position[]={5417.498,303.92545,4311.041}; special="CARGO"; id=201; side="EAST"; vehicle="TK_Soldier_Medic_EP1"; skill=0.24646367; text="b23"; }; class Item11 { position[]={5419.6338,304.63824,4311.0137}; special="CARGO"; id=202; side="EAST"; vehicle="TK_Soldier_Engineer_EP1"; skill=0.2; text="b24"; }; class Item12 { position[]={5422.3281,305.51901,4311.291}; special="CARGO"; id=203; side="EAST"; vehicle="TK_Soldier_EP1"; skill=0.2; text="b25"; }; class Item13 { position[]={5373.6006,298.50192,4312.4746}; azimut=180; special="NONE"; id=140; side="EAST"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="c4"; init="this addMagazineCargo [""Pipebomb"", 5];"; }; }; class Waypoints { items=2; class Item0 { position[]={5373.5762,299.77261,4307.416}; combatMode="YELLOW"; speed="NORMAL"; combat="SAFE"; class Effects { }; timeoutMin=300; timeoutMid=300; timeoutMax=300; showWP="NEVER"; }; class Item1 { position[]={2091.9324,360.60132,318.10822}; class Effects { }; showWP="NEVER"; }; }; }; class Item39 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3717.9573,646.08966,2800.4927}; id=208; side="LOGIC"; vehicle="SilvieManager"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item40 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3689.1746,635.49243,2815.1152}; id=207; side="LOGIC"; vehicle="ace_sys_repair_tyres"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; class Item41 { side="LOGIC"; class Vehicles { items=1; class Item0 { position[]={3689.7571,646.71301,2794.7126}; id=206; side="LOGIC"; vehicle="ace_sys_repair_full"; leader=1; lock="UNLOCKED"; skill=0.60000002; }; }; }; }; class Vehicles { items=15; class Item0 { position[]={3732.5417,226.73802,4379.2886}; special="NONE"; id=10; side="EMPTY"; vehicle="HeliHEmpty"; skill=0.60000002; text="spawner"; markers[]= { "spawner" }; }; class Item1 { position[]={4196.3457,324.0293,552.15607}; azimut=81.182167; special="NONE"; id=17; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item2 { position[]={4198.9385,324.04449,535.19745}; azimut=81.182167; special="NONE"; id=19; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item3 { position[]={4742.0127,317.44336,741.91406}; azimut=242.96524; special="NONE"; id=21; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item4 { position[]={4734.2485,317.48257,757.21289}; azimut=242.96524; special="NONE"; id=23; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item5 { position[]={4429.4937,346.55521,857.263}; azimut=190.64766; special="NONE"; id=25; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item6 { position[]={4412.6411,347.11789,860.4696}; azimut=190.64766; special="NONE"; id=27; side="EMPTY"; vehicle="Land_fortified_nest_small_EP1"; skill=0.47486293; }; class Item7 { position[]={3757.2783,224.85822,4396.1885}; special="CARGO"; id=63; side="EMPTY"; vehicle="HeliHEmpty"; leader=1; skill=0.48247623; text="aorb"; }; class Item8 { position[]={3774.0742,668.25128,2742.7695}; id=64; side="EMPTY"; vehicle="HeliHEmpty"; skill=0.60000002; text="win1"; }; class Item9 { position[]={3773.2971,666.45581,2735.0029}; id=65; side="EMPTY"; vehicle="HeliHEmpty"; skill=0.60000002; text="win2"; }; class Item10 { position[]={3718.1187,677.39044,2730.3162}; id=68; side="EMPTY"; vehicle="USBasicWeapons_EP1"; skill=0.60000002; init="null = this execVM ""scripts\ammo.sqf"";"; }; class Item11 { position[]={3544.5256,247.94725,4089.2456}; azimut=180; special="NONE"; id=204; side="EMPTY"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="car1"; init="this addMagazineCargo [""Pipebomb"", 5]; "; }; class Item12 { position[]={5375.0342,302.62839,4296.7744}; azimut=180; special="NONE"; id=205; side="EMPTY"; vehicle="V3S_TK_EP1"; skill=0.60000002; text="car2"; init="this addMagazineCargo [""Pipebomb"", 5];"; }; class Item13 { position[]={4713.7036,317.63577,721.15326}; azimut=-118.3008; id=209; side="EMPTY"; vehicle="TKOrdnanceBox_EP1"; skill=0.60000002; }; class Item14 { position[]={4215.1343,323.90598,521.46832}; azimut=-95.653145; id=210; side="EMPTY"; vehicle="TKOrdnanceBox_EP1"; skill=0.60000002; }; }; class Markers { items=20; class Item0 { position[]={3718.177,677.26605,2731.0723}; name="start"; type="mil_start"; colorName="ColorBlue"; }; class Item1 { position[]={3855.5908,358.71249,3508.8311}; name="hostage1"; text="Hostage?"; type="mil_unknown"; colorName="ColorBlack"; }; class Item2 { position[]={5252.8579,496.01605,3677.47}; name="hostage2"; text="Hostage?"; type="mil_unknown"; colorName="ColorBlack"; }; class Item3 { position[]={3878.3191,396.71024,3395.5498}; name="arrow"; type="mil_arrow"; colorName="ColorRed"; angle=166.01845; }; class Item4 { position[]={3923.7947,443.91302,3259.1624}; name="arrow_1"; type="mil_arrow"; colorName="ColorRed"; angle=166.01845; }; class Item5 { position[]={4020.678,493.62506,3120.7979}; name="arrow_2"; type="mil_arrow"; colorName="ColorRed"; angle=132.58311; }; class Item6 { position[]={5163.7876,511.19241,3577.0427}; name="arrow_3"; type="mil_arrow"; colorName="ColorRed"; angle=196.47343; }; class Item7 { position[]={5119.6162,522.50525,3354.561}; name="arrow_4"; type="mil_arrow"; colorName="ColorRed"; angle=230.07657; }; class Item8 { position[]={4941.0747,533.37067,3249.7334}; name="arrow_4_1"; type="mil_arrow"; colorName="ColorRed"; angle=237.35393; }; class Item9 { position[]={3778.3555,221.57886,4378.5234}; name="spawner"; type="Empty"; }; class Item10 { position[]={4444.8711,342.47519,661.79956}; name="area0"; markerType="ELLIPSE"; type="Empty"; colorName="ColorRed"; a=300; b=215; }; class Item11 { position[]={4102.9321,552.96246,2871.1838}; name="task1"; text="task1"; type="Empty"; }; class Item12 { position[]={4450.6782,339.55591,653.16772}; name="task2"; text="task2"; type="Empty"; }; class Item13 { position[]={4232.7778,323.8559,522.54944}; name="shilka1"; text="shilka1"; type="Empty"; }; class Item14 { position[]={4724.4878,317.61496,723.4375}; name="shilka2"; text="shilka2"; type="Empty"; }; class Item15 { position[]={4287.4497,326.22879,650.68054}; name="AA1"; text="AA1"; type="Empty"; }; class Item16 { position[]={4383.1255,332.51926,630.03467}; name="AA2"; text="AA2"; type="Empty"; }; class Item17 { position[]={4473.6162,341.74988,697.65247}; name="AA3"; text="AA3"; type="Empty"; }; class Item18 { position[]={4652.6699,317.63321,710.14856}; name="AA4"; text="AA4"; type="Empty"; }; class Item19 { position[]={2085.1067,361.19144,331.23776}; name="execution"; text="execution area"; type="mil_warning"; colorName="ColorRed"; }; }; class Sensors { items=22; class Item0 { position[]={3759.4875,662.8125,2709.7876}; a=0; b=0; interruptable=1; type="END3"; age="UNKNOWN"; expCond="!alive p10"; expActiv="forceEnd;"; class Effects { }; }; class Item1 { position[]={3731.6033,226.93086,4380.0063}; a=10; b=10; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=10; expActiv="p10 moveInCargo car1;"; class Effects { }; }; class Item2 { position[]={3776.4797,221.54155,4379.2212}; a=10; b=10; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=10; expActiv="p10 moveInCargo car2; deleteVehicle aorb;"; class Effects { }; }; class Item3 { position[]={3749.3098,223.29018,4351.6348}; a=0; b=0; interruptable=1; age="UNKNOWN"; expCond="if (vehicle p10 != p10) then {} else {p10 setCaptive false};"; class Effects { }; }; class Item4 { position[]={3754.948,222.55853,4351.2451}; a=0; b=0; timeoutMin=2; timeoutMid=2; timeoutMax=2; interruptable=1; age="UNKNOWN"; expCond="true"; expActiv="removeAllWeapons p10; removeAllItems p10; removeBackpack p10;"; class Effects { }; }; class Item5 { position[]={3704.6409,274.90338,4083.2214}; a=0; b=0; interruptable=1; age="UNKNOWN"; expCond="(!alive a26 && !alive a27 && !alive a28 && !alive a29 && !alive a30 && !alive a31 && !alive a32 && !alive a33 && !alive a34 && !alive a35 && !alive a36 && alive aorb) OR (!alive b26 && !alive b27 && !alive b28 && !alive b29 && !alive b30 && !alive b31 && !alive b32 && !alive b33 && !alive b34 && !alive b35 && !alive b36 && !alive aorb)"; expActiv="[""task1"", ""succeeded""] call FHQ_TT_setTaskState; deleteVehicle win1; marker1 = createMarker [""Marker1"", getPos aa1]; ""Marker1"" setMarkerType ""destroy""; ""Marker1"" setMarkerColor ""ColorRed""; ""Marker1"" setMarkerText ""ZU23""; marker2 = createMarker [""Marker2"", getPos aa2]; ""Marker2"" setMarkerType ""destroy""; ""Marker2"" setMarkerColor ""ColorRed""; ""Marker2"" setMarkerText ""ZU23""; marker3 = createMarker [""Marker3"", getPos aa3]; ""Marker3"" setMarkerType ""destroy""; ""Marker3"" setMarkerColor ""ColorRed""; ""Marker3"" setMarkerText ""ZU23""; marker4 = createMarker [""Marker4"", getPos aa4]; ""Marker4"" setMarkerType ""destroy""; ""Marker4"" setMarkerColor ""ColorRed""; ""Marker4"" setMarkerText ""ZU23""; marker5 = createMarker [""Marker5"", getPos shilka1]; ""Marker5"" setMarkerType ""destroy""; ""Marker5"" setMarkerColor ""ColorRed""; ""Marker5"" setMarkerText ""Shilka""; marker6 = createMarker [""Marker6"", getPos shilka2]; ""Marker6"" setMarkerType ""destroy""; ""Marker6"" setMarkerColor ""ColorRed""; ""Marker6"" setMarkerText ""Shilka"";"; class Effects { }; }; class Item6 { position[]={3783.5925,663.58331,2738.1191}; a=0; b=0; timeoutMin=10; timeoutMid=10; timeoutMax=10; interruptable=1; type="END2"; age="UNKNOWN"; expCond="!alive win1 && !alive win2"; expActiv="forceEnd;"; class Effects { }; }; class Item7 { position[]={3784.1626,665.29181,2745.314}; a=0; b=0; interruptable=1; age="UNKNOWN"; expCond="!alive win1 && !alive win2"; class Effects { titleType="TEXT"; title="The hostage is alive and the AA site has been destroyed!! MISSION ACCOMPLISHED!!"; }; }; class Item8 { position[]={4606.543,340.91299,849.70856}; a=0; b=0; interruptable=1; age="UNKNOWN"; expCond="!alive aa1 && !alive aa2 && !alive aa3 && !alive aa4 && !alive shilka1 && !alive shilka2"; expActiv="[""task2"", ""succeeded""] call FHQ_TT_setTaskState; deleteVehicle win2; "; class Effects { }; }; class Item9 { position[]={2086.7939,360.94455,324.04126}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=137; expActiv="{deleteVehicle _X} forEach (crew c1)+[c1]; "; class Effects { }; }; class Item10 { position[]={2086.0649,360.9957,324.39832}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=138; expActiv="{deleteVehicle _X} forEach (crew c2)+[c2]; "; class Effects { }; }; class Item11 { position[]={2085.729,361.04028,325.65662}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=139; expActiv="{deleteVehicle _X} forEach (crew c3)+[c3]; "; class Effects { }; }; class Item12 { position[]={2085.3674,361.03275,324.12003}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=140; expActiv="{deleteVehicle _X} forEach (crew c4)+[c4]; "; class Effects { }; }; class Item13 { position[]={2084.9048,361.11407,326.88898}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=141; expActiv="{deleteVehicle _X} forEach (crew c5)+[c5]; "; class Effects { }; }; class Item14 { position[]={2089.9634,360.89752,329.5304}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=142; expActiv="{deleteVehicle _X} forEach (crew c6)+[c6]; "; class Effects { }; }; class Item15 { position[]={2083.0325,361.29462,330.29422}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=70; expActiv="{deleteVehicle _X} forEach (crew c7)+[c7]; "; class Effects { }; }; class Item16 { position[]={2086.0811,361.13168,331.13907}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=71; expActiv="{deleteVehicle _X} forEach (crew c8)+[c8]; "; class Effects { }; }; class Item17 { position[]={2087.0708,361.17163,334.95438}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=72; expActiv="{deleteVehicle _X} forEach (crew c9)+[c9]; "; class Effects { }; }; class Item18 { position[]={2086.4312,361.16223,333.02872}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=73; expActiv="{deleteVehicle _X} forEach (crew c10)+[c10]; "; class Effects { }; }; class Item19 { position[]={2087.093,361.23587,337.51474}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=74; expActiv="{deleteVehicle _X} forEach (crew c11)+[c11]; "; class Effects { }; }; class Item20 { position[]={2089.5715,360.98459,332.7095}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; age="UNKNOWN"; idVehicle=75; expActiv="{deleteVehicle _X} forEach (crew c12)+[c12]; "; class Effects { }; }; class Item21 { position[]={2106.5464,360.88757,345.92969}; a=100; b=100; activationBy="VEHICLE"; interruptable=1; type="END4"; age="UNKNOWN"; idVehicle=69; expActiv="forceEnd;"; class Effects { }; }; }; }; class Intro { addOns[]= { "takistan" }; addOnsAuto[]= { "takistan" }; randomSeed=6378556; class Intel { startWeather=0.40000001; forecastWeather=0.40000001; year=2009; day=28; hour=16; minute=20; }; }; class OutroWin { addOns[]= { "takistan" }; addOnsAuto[]= { "takistan" }; randomSeed=5734231; class Intel { startWeather=0.40000001; forecastWeather=0.40000001; year=2009; day=28; hour=16; minute=20; }; }; class OutroLoose { addOns[]= { "takistan" }; addOnsAuto[]= { "takistan" }; randomSeed=4967273; class Intel { startWeather=0.40000001; forecastWeather=0.40000001; year=2009; day=28; hour=16; minute=20; }; }; Overview

Eliminate the convoy containing the KSK Officer as hostage. The hostage must be alive. Once the convoy is eliminated and the hostage gives you intel on the location of the AA site at Chak Chak, eliminate the Takistani AA site.

by Phantom Six

clearmagazinecargo _this; clearweaponcargo _this; _this addWeaponCargo ["SCAR_L_CQC", 4]; _this addWeaponCargo ["SCAR_L_CQC_Holo", 2]; _this addWeaponCargo ["M9", 2]; _this addWeaponCargo ["Mk_48_DES_EP1", 1]; _this addWeaponCargo ["M14_EP1", 1]; _this addWeaponCargo ["SCAR_H_CQC_CCO", 2]; _this addWeaponCargo ["SCAR_H_STD_EGLM_Spect", 1]; _this addWeaponCargo ["SCAR_L_STD_Mk4CQT", 1]; _this addWeaponCargo ["M24_des_EP1", 1]; _this addWeaponCargo ["SCAR_H_LNG_Sniper", 1]; _this addWeaponCargo ["MAAWS", 1]; _this addWeaponCargo ["M136", 1]; _this addMagazineCargo ["20Rnd_762x51_DMR", 10]; _this addMagazineCargo ["30Rnd_556x45_Stanag", 50]; _this addMagazineCargo ["15Rnd_9x19_M9", 16]; _this addMagazineCargo ["HandGrenade_West", 20]; _this addMagazineCargo ["SmokeShell", 10]; _this addMagazineCargo ["SmokeShellRed", 5]; _this addMagazineCargo ["SmokeShellGreen", 5]; _this addMagazineCargo ["SmokeShellYellow", 5]; _this addMagazineCargo ["SmokeShellOrange", 5]; _this addMagazineCargo ["SmokeShellBlue", 5]; _this addMagazineCargo ["SmokeShellPurple", 5]; _this addMagazineCargo ["Pipebomb", 10]; _this addMagazineCargo ["100Rnd_762x51_M240", 5]; _this addMagazineCargo ["20Rnd_762x51_B_SCAR", 50]; _this addMagazineCargo ["1Rnd_HE_M203", 8]; _this addMagazineCargo ["5Rnd_762x51_M24", 10]; _this addMagazineCargo ["MAAWS_HEAT", 2]; _this addMagazineCargo ["MAAWS_HEDP", 2]; _this addMagazineCargo ["M136", 1]; _this addBackPackCargo ["US_Patrol_Pack_EP1", 2]; _this addMagazineCargo ["ACE_Bandage", 20]; _this addMagazineCargo ["ACE_Bodybag", 20]; _this addMagazineCargo ["ACE_Epinephrine", 20]; _this addMagazineCargo ["ACE_IV", 20]; _this addMagazineCargo ["ACE_LargeBandage", 20]; _this addMagazineCargo ["ACE_Medkit", 20]; _this addMagazineCargo ["ACE_Morphine", 20]; _this addMagazineCargo ["ACE_Plasma", 20]; _this addMagazineCargo ["ACE_Splint", 20]; _this addMagazineCargo ["ACE_Tourniquet", 20]; _this addWeaponCargo ["ACE_USP", 2]; _this addWeaponCargo ["ACE_Earplugs", 9]; _this addWeaponCargo ["ACE_MX2A", 2]; _this addWeaponCargo ["ACE_HuntIR_monitor", 2]; _this addWeaponCargo ["ACE_HK416_D10", 4]; _this addWeaponCargo ["ACE_HK416_D10_AIM", 2]; _this addWeaponCargo ["ACE_HK416_D10_COMPM3", 1]; _this addWeaponCargo ["ACE_HK416_D10_Holo", 1]; _this addWeaponCargo ["ACE_HK416_D10_M320", 2]; _this addWeaponCargo ["ACE_HK416_D14_ACOG_PVS14", 1]; _this addWeaponCargo ["ACE_HK416_D14", 2]; _this addWeaponCargo ["ACE_HK417_Eotech_4x", 1]; _this addWeaponCargo ["ACE_HK417_leupold", 1]; _this addWeaponCargo ["ACE_HK417_micro", 2]; _this addWeaponCargo ["ACE_HK417_shortdot", 1]; _this addWeaponCargo ["ACE_SOC_M4A1", 4]; _this addWeaponCargo ["ACE_SOC_M4A1_Aim", 2]; _this addWeaponCargo ["ACE_SOC_M4A1_Eotech", 1]; _this addWeaponCargo ["ACE_SOC_M4A1_Eotech_4x", 1]; _this addWeaponCargo ["ACE_SOC_M4A1_Shortdot", 1]; _this addWeaponCargo ["ACE_SOC_M4A1_TWS", 1]; _this addMagazineCargo ["ACE_12Rnd_45ACP_USP", 16]; _this addMagazineCargo ["ACE_Battery_Rangefinder", 9]; _this addMagazineCargo ["ACE_HuntIR_M203", 8]; _this addMagazineCargo ["ACE_1Rnd_HE_M203", 8]; _this addMagazineCargo ["ACE_30Rnd_556x45_T_Stanag", 50]; _this addMagazineCargo ["ACE_30Rnd_556x45_S_Stanag", 50]; _this addMagazineCargo ["ACE_20Rnd_762x51_B_HK417", 50]; _this addMagazineCargo ["ACE_20Rnd_762x51_S_HK417", 50]; _this addMagazineCargo ["ACE_20Rnd_762x51_T_HK417", 50];waitUntil{!(isNil "BIS_fnc_init")}; sleep 15; ["May 22, 2013", "8:00 AM"] call BIS_fnc_infoText; sleep 3; ["Truck Stop", "Road"] call BIS_fnc_infoText; sleep 3; ["Created by", "Phantom Six"] call BIS_fnc_infoText;// ========================================================================================================= // UPSMON - Urban Patrol Script Mon // Version: 5.0.7 // Author: Monsada (chs.monsada@gmail.com) // Comunidad Hispana de Simulación: // http://www.simulacion-esp.com // // Wiki: http://dev-heaven.net/projects/upsmon/wiki // Forum: http://forums.bistudio.com/showthread.php?t=91696 // Share your missions with upsmon: http://dev-heaven.net/projects/upsmon/boards/86 // --------------------------------------------------------------------------------------------------------- // Based on Urban Patrol Script // Version: 2.0.3 // Author: Kronzky (www.kronzky.info / kronzky@gmail.com) // --------------------------------------------------------------------------------------------------------- //Adding eventhandlers "KRON_UPS_EAST_SURRENDED" addPublicVariableEventHandler { if (_this select 1) then { nul=[east] execvm "scripts\UPSMON\MON_surrended.sqf";};}; "KRON_UPS_WEST_SURRENDED" addPublicVariableEventHandler { if (_this select 1) then { nul=[west] execvm "scripts\UPSMON\MON_surrended.sqf";};}; "KRON_UPS_GUER_SURRENDED" addPublicVariableEventHandler { if (_this select 1) then { nul=[resistance] execvm "scripts\UPSMON\MON_surrended.sqf";};}; "MON_LOCAL_EXEC" addPublicVariableEventHandler { if (local ((_this select 1)select 0)) then { call ( compile format[(_this select 1)select 1,(_this select 1)select 0] ); }; }; if (!isServer) exitWith {}; //1=Enable or 0=disable debug. in debug could see a mark positioning de leader and another mark of the destinity of movement, very useful for editing mision KRON_UPS_Debug = 0; //Time that lider wait until doing another movement, this time reduced dinamically under fire, and on new targets KRON_UPS_react = 60; //Min time to wait for doing another reaction KRON_UPS_minreact = 30; //Max waiting is the maximum time patrol groups will wait when arrived to target for doing another target. KRON_UPS_maxwaiting = 30; // how long AI units should be in alert mode after initially spotting an enemy KRON_UPS_alerttime = 90; // how far opfors should move away if they're under attack KRON_UPS_safedist = 300; // how close unit has to be to target to generate a new one target or to enter stealth mode KRON_UPS_closeenough = 300; // how close units have to be to each other to share information, over this, will lose target KRON_UPS_sharedist = 600; //If enabled IA comunicating between them with radio defined sharedist distance, KRON_UPS_comradio = 2; //Sides that are enemies of resistance KRON_UPS_Res_enemy = [east]; //Frequency for doin calculations for each squad. KRON_UPS_Cycle = 20; //Height that heli will fly this input will be randomiced in a 10% KRON_UPS_flyInHeight = 40; //Max distance to target for doing paradrop, will be randomiced between 0 and 100% of this value. KRON_UPS_paradropdist = 250; //Enables or disables AI to use static weapons KRON_UPS_useStatics = true; //Enables or disables AI to put mines if armored enemies near KRON_UPS_useMines = true; //Distance from destination for seraching vehicles KRON_UPS_searchVehicledist = 500; //Percentage of units to surrender. KRON_UPS_EAST_SURRENDER = 0; KRON_UPS_WEST_SURRENDER = 0; KRON_UPS_GUER_SURRENDER = 0; //Efective distance for doing perfect ambush (max distance is this x2) KRON_UPS_ambushdist = 50; //Enable it to send reinforcements, better done it in a trigger inside your mission. KRON_UPS_reinforcement = true; //Artillery support, better control if set in trigger KRON_UPS_ARTILLERY_EAST_FIRE = false; //set to true for doing east to fire KRON_UPS_ARTILLERY_WEST_FIRE = false; //set to true for doing west to fire KRON_UPS_ARTILLERY_GUER_FIRE = false; //set to true for doing resistance to fire //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Initialization of public Variables used in script, do not touch //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- KRON_UPS_flankAngle = 45; //Angulo de flanqueo KRON_UPS_INIT = 0; //Variable que indica que ha sido inicializado KRON_UPS_EAST_SURRENDED = false; KRON_UPS_WEST_SURRENDED = false; KRON_UPS_GUER_SURRENDED = false; KRON_AllWest=[]; //All west AI KRON_AllEast=[]; //All east AI KRON_AllRes=[]; //All resistance AI KRON_UPS_East_enemies = []; KRON_UPS_West_enemies = []; KRON_UPS_Guer_enemies = []; KRON_UPS_East_friends = []; KRON_UPS_West_friends = []; KRON_UPS_Guer_friends = []; KRON_targets0 =[];//objetivos west KRON_targets1 =[];//objetivos east KRON_targets2 =[];//resistence KRON_targetsPos =[];//Posiciones de destino actuales. KRON_NPCs = []; //Lideres de los grupos actuales KRON_UPS_Instances=0; KRON_UPS_Total=0; KRON_UPS_Exited=0; KRON_UPS_East_Total = 0; KRON_UPS_West_Total = 0; KRON_UPS_Guer_Total = 0; KRON_UPS_ARTILLERY_UNITS = []; KRON_UPS_ARTILLERY_WEST_TARGET = objnull; KRON_UPS_ARTILLERY_EAST_TARGET = objnull; KRON_UPS_ARTILLERY_GUER_TARGET = objnull; KRON_UPS_TEMPLATES = []; KRON_UPS_MG_WEAPONS = ["MG36","M249","M240","MK_48","PK","PKm","Pecheneg","M249 Para","M249 Para M145","M240G M145","M60"]; //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // ***************************************** SERVER INITIALIZATION ***************************************** if (isNil("KRON_UPS_INIT") || KRON_UPS_INIT == 0) then { //Init library function, Required Version: 5.0 of mon_functions call compile preprocessFileLineNumbers "scripts\UPSMON\common\MON_functions.sqf"; //scripts initialization UPSMON = compile preprocessFile "scripts\UPSMON.sqf"; UPSMON_surrended = compile preprocessFile "scripts\UPSMON\MON_surrended.sqf"; // declaración de variables privadas private["_obj","_trg","_l","_pos"]; // global functions KRON_randomPos = {private["_cx","_cy","_rx","_ry","_cd","_sd","_ad","_tx","_ty","_xout","_yout"];_cx=_this select 0; _cy=_this select 1; _rx=_this select 2; _ry=_this select 3; _cd=_this select 4; _sd=_this select 5; _ad=_this select 6; _tx=random (_rx*2)-_rx; _ty=random (_ry*2)-_ry; _xout=if (_ad!=0) then {_cx+ (_cd*_tx - _sd*_ty)} else {_cx+_tx}; _yout=if (_ad!=0) then {_cy+ (_sd*_tx + _cd*_ty)} else {_cy+_ty}; [_xout,_yout]}; KRON_PosInfo = {private["_pos","_lst","_bld","_bldpos"];_pos=_this select 0; _lst=_pos nearObjects ["House",12]; if (count _lst==0) then {_bld=0;_bldpos=0} else {_bld=_lst select 0; _bldpos=[_bld] call KRON_BldPos}; [_bld,_bldpos]}; KRON_PosInfo3 = {private["_pos","_lst","_bld","_bldpos"];_pos=_this select 0; _lst= nearestObjects [_pos, [], 3]; if (count _lst==0) then {_bld=objnull;_bldpos=0} else {_bld = nearestbuilding (_lst select 0); _bldpos=[_bld] call KRON_BldPos2}; [_bld,_bldpos]}; KRON_BldPos = {private ["_bld","_bldpos","_posZ","_maxZ"];_bld=_this select 0;_maxZ=0;_bi=0;_bldpos=0;while {_bi>=0} do {if (((_bld BuildingPos _bi) select 0)==0) then {_bi=-99} else {_bz=((_bld BuildingPos _bi) select 2); if (((_bz)>4) && ((_bz>_maxZ) || ((_bz==_maxZ) && (random 1>.8)))) then {_maxZ=_bz; _bldpos=_bi}};_bi=_bi+1};_bldpos}; KRON_BldPos2 = {private ["_bld","_bldpos"]; _bld=_this select 0; _bldpos = 1; while {format ["%1", _bld buildingPos _bldpos] != "[0,0,0]"} do {_bldpos = _bldpos + 1;}; _bldpos = _bldpos - 1; _bldpos;}; KRON_OnRoad = {private["_p","_w","_i","_lst"];_p=_this select 0; _w=_this select 1; _i=_this select 2; _lst=_p nearObjects ["House",12]; if ((count _lst==0) && (_w || !(surfaceIsWater _p))) then {_i=99}; (_i+1)}; KRON_getDirPos = {private["_a","_b","_from","_to","_return"]; _from = _this select 0; _to = _this select 1; _return = 0; _a = ((_to select 0) - (_from select 0)); _b = ((_to select 1) - (_from select 1)); if (_a != 0 || _b != 0) then {_return = _a atan2 _b}; if ( _return < 0 ) then { _return = _return + 360 }; _return}; //KRON_distancePosSqr = {round(((round((_this select 0) select 0)-round((_this select 1) select 0))^2 + (round((_this select 0) select 1)-round((_this select 1) select 1))^2)^0.5)}; //KRON_distancePosSqr = {((((_this select 0) select 0)-((_this select 1) select 0))^2 + (((_this select 0) select 1)-((_this select 1) select 1))^2)^0.5}; KRON_distancePosSqr = {round(((((_this select 0) select 0)-((_this select 1) select 0))^2 + (((_this select 0) select 1)-((_this select 1) select 1))^2)^0.5)}; KRON_relPos = {private["_p","_d","_a","_x","_y","_xout","_yout"];_p=_this select 0; _x=_p select 0; _y=_p select 1; _d=_this select 1; _a=_this select 2; _xout=_x + sin(_a)*_d; _yout=_y + cos(_a)*_d;[_xout,_yout,0]}; KRON_rotpoint = {private["_cp","_a","_tx","_ty","_cd","_sd","_cx","_cy","_xout","_yout"];_cp=_this select 0; _cx=_cp select 0; _cy=_cp select 1; _a=_this select 1; _cd=cos(_a*-1); _sd=sin(_a*-1); _tx=_this select 2; _ty=_this select 3; _xout=if (_a!=0) then {_cx+ (_cd*_tx - _sd*_ty)} else {_cx+_tx}; _yout=if (_a!=0) then {_cy+ (_sd*_tx + _cd*_ty)} else {_cy+_ty}; [_xout,_yout,0]}; KRON_stayInside = { private["_np","_nx","_ny","_cp","_cx","_cy","_rx","_ry","_d","_tp","_tx","_ty","_fx","_fy"]; _np=_this select 0; _nx=_np select 0; _ny=_np select 1; _cp=_this select 1; _cx=_cp select 0; _cy=_cp select 1; _rx=_this select 2; _ry=_this select 3; _d=_this select 4; _tp = [_cp,_d,(_nx-_cx),(_ny-_cy)] call KRON_rotpoint; _tx = _tp select 0; _fx=_tx; _ty = _tp select 1; _fy=_ty; if (_tx<(_cx-_rx)) then {_fx=_cx-_rx}; if (_tx>(_cx+_rx)) then {_fx=_cx+_rx}; if (_ty<(_cy-_ry)) then {_fy=_cy-_ry}; if (_ty>(_cy+_ry)) then {_fy=_cy+_ry}; if ((_fx!=_tx) || (_fy!=_ty)) then {_np = [_cp,_d*-1,(_fx-_cx),(_fy-_cy)] call KRON_rotpoint}; _np; }; // Misc KRON_UPSgetArg = {private["_cmd","_arg","_list","_a","_v"]; _cmd=_this select 0; _arg=_this select 1; _list=_this select 2; _a=-1; {_a=_a+1; _v=format["%1",_list select _a]; if (_v==_cmd) then {_arg=(_list select _a+1)}} foreach _list; _arg}; KRON_UPSsetArg = {private["_cmd","_arg","_list","_a","_v"]; _cmd=_this select 0; _arg=_this select 1; _list=_this select 2; _a=-1; { _a=_a+1; _v=format["%1",_list select _a]; if (_v==_cmd) then { _a=_a+1; _list set [_a,_arg]; }; } foreach _list; _list}; KRON_deleteDead = {private["_u","_s"];_u=_this select 0; _s= _this select 1; _u removeAllEventHandlers "killed"; sleep _s; deletevehicle _u}; // *********************************************************************************************************** // MAIN UPSMON SERVER FUNCTION // *********************************************************************************************************** MON_MAIN_server = { private["_obj","_trg","_l","_pos","_countWestSur","_countEastSur","_countResSur","_WestSur","_EastSur","_ResSur","_target","_targets","_targets0","_targets1","_targets2","_npc","_cycle" ,"_arti","_side","_range","_rounds","_area","_maxcadence","_mincadence","_bullet","_fire","_knownpos","_sharedenemy","_enemyside"]; _cycle = 20; //Time to do a call to commander _arti = objnull; _side = ""; _range = 0; _rounds = 0; _area = 0; _maxcadence = 0; _mincadence = 0; _bullet = ""; _fire = false; _target = objnull; _knownpos =[0,0,0]; _enemyside = []; _WestSur = KRON_UPS_WEST_SURRENDED; _EastSur = KRON_UPS_EAST_SURRENDED; _ResSur = KRON_UPS_GUER_SURRENDED; //Main loop while {true} do { _countWestSur = round ( KRON_UPS_West_Total * KRON_UPS_WEST_SURRENDER / 100); _countEastSur = round ( KRON_UPS_East_Total * KRON_UPS_EAST_SURRENDER / 100); _countResSur = round ( KRON_UPS_Guer_Total * KRON_UPS_GUER_SURRENDER / 100); //Checks for WEST surrender if (KRON_UPS_WEST_SURRENDER > 0 && !KRON_UPS_WEST_SURRENDED ) then { { if (!alive _x || !canmove _x) then {KRON_AllWest = KRON_AllWest-[_x]}; }foreach KRON_AllWest; if ( count KRON_AllWest <= _countWestSur ) then { KRON_UPS_WEST_SURRENDED = true; publicvariable "KRON_AllWest"; publicvariable "KRON_UPS_WEST_SURRENDED"; }; }; //Checks for EAST surrender if (KRON_UPS_EAST_SURRENDER > 0 && !KRON_UPS_EAST_SURRENDED ) then { { if (!alive _x || !canmove _x) then {KRON_AllEast = KRON_AllEast-[_x]}; }foreach KRON_AllEast; if ( count KRON_AllEast <= _countEastSur ) then { KRON_UPS_EAST_SURRENDED = true; publicvariable "KRON_AllEast"; publicvariable "KRON_UPS_EAST_SURRENDED"; }; }; //Checks for RESISTANCE surrender if (KRON_UPS_GUER_SURRENDER > 0 && !KRON_UPS_GUER_SURRENDED ) then { { if (!alive _x || !canmove _x) then {KRON_AllRes = KRON_AllRes-[_x]}; }foreach KRON_AllRes; if ( count KRON_AllRes <= _countResSur ) then { KRON_UPS_GUER_SURRENDED = true; publicvariable "KRON_AllRes"; publicvariable "KRON_UPS_GUER_SURRENDED"; }; }; //Exec surrended script if (KRON_UPS_WEST_SURRENDED && !_WestSur ) then { _WestSur = true; [west] spawn UPSMON_surrended; }; if (KRON_UPS_EAST_SURRENDED && !_EastSur ) then { _EastSur = true; [east] spawn UPSMON_surrended; }; if (KRON_UPS_GUER_SURRENDED && !_ResSur ) then { _ResSur = true; [Resistance] spawn UPSMON_surrended; }; sleep 0.5; _sharedenemy = 0; _targets0 = []; _targets1 = []; _targets2 = []; { if (!isnull _x && alive _x && !captive _x ) then { _npc = _x; _targets = []; switch (side _npc) do { //West targets case west: { _sharedenemy = 0; _enemyside = [east]; }; //East targets case east: { _sharedenemy = 1; _enemyside = [west]; }; //Resistance targets case resistance: { _sharedenemy = 2; _enemyside = KRON_UPS_Res_enemy; }; }; if (side _npc in KRON_UPS_Res_enemy) then { _enemyside = _enemyside + [resistance]; }; //Gets known targets on each leader for comunicating enemy position //Has better performance with targetsquery //_targets = _npc nearTargets KRON_UPS_sharedist; _targets = _npc targetsQuery ["","","","",""]; { //_target = _x select 4; //Neartargets _target = _x select 1;//Targetsquery if ( side _target in _enemyside ) then { //if (KRON_UPS_Debug>0) then {diag_log format["%1: %2 _enemyside=%3 _target=%4 %5 enemies=%6",_npc getVariable ("UPSMON_grpid"),_npc,_enemyside, typeof _target,side _target,_npc countEnemy _targets ]}; //if (KRON_UPS_Debug>0) then {player globalchat format["%1: %2 _enemyside=%3 _target=%4 %5 enemies=%6",_npc getVariable ("UPSMON_grpid"),_npc,_enemyside, typeof _target,side _target,_npc countEnemy _targets ]}; if (!isnull _target && alive _target && canmove _target && !captive _target && _npc knowsabout _target > 0.5 && ( _target iskindof "Land" || _target iskindof "Air" || _target iskindof "Ship" ) && !( _target iskindof "Animal") && ( _target emptyPositions "Gunner" == 0 && _target emptyPositions "Driver" == 0 || (!isnull (gunner _target) && canmove (gunner _target)) || (!isnull (driver _target) && canmove (driver _target))) ) then { //Saves last known position //_knownpos = _x select 0; //Neartargets _knownpos = _x select 4;//Targetsquery _target setvariable ["UPSMON_lastknownpos", _knownpos, false]; call (compile format ["_targets%1 = _targets%1 - [_target]",_sharedenemy]); call (compile format ["_targets%1 = _targets%1 + [_target]",_sharedenemy]); }; }; }foreach _targets; }; sleep 0.5; }foreach KRON_NPCs; //Share targets KRON_targets0 = _targets0; KRON_targets1 = _targets1; KRON_targets2 = _targets2; //Target debug console if (KRON_UPS_Debug>0) then {hintsilent parseText format["West(A=%1 C=%2 T=%3)
East(A=%4 C=%5 T=%6)
Res(A=%7 C=%8 T=%9)
" ,KRON_UPS_West_Total, count KRON_AllWest, count KRON_targets0 ,KRON_UPS_East_Total, count KRON_AllEast, count KRON_targets1 ,KRON_UPS_Guer_Total, count KRON_AllRes, count KRON_targets2 ]}; sleep 0.5; //Artillery module control { _arti = _x select 0; _rounds = _x select 1; _range = _x select 2; _area = _x select 3; _maxcadence = _x select 4; _mincadence = _x select 5; _bullet = _x select 6; if (!isnull (gunner _arti) && canmove (gunner _arti)) then { _side = side gunner _arti; _fire = call (compile format ["KRON_UPS_ARTILLERY_%1_FIRE",_side]); //If fire enabled gets a known target pos for doing fire if no friendly squads near. if (_fire) then { _target = call (compile format ["KRON_UPS_ARTILLERY_%1_TARGET",_side]); if (isnil "_target" ) then {_target = objnull;}; switch (_side) do { //West targets case west: { _targets = KRON_targets0; }; //East targets case east: { _targets = KRON_targets1; }; //Resistance targets case resistance: { _targets = KRON_targets2; }; }; //Check if has a target if (!(_target in _targets ) || isnull _target || !alive _target) then { _target = objnull; { _auxtarget = _x; _targetPos = _auxtarget getvariable ("UPSMON_lastknownpos"); if (!isnil "_targetPos") then { //If target in range check no friendly squad near if (alive _auxtarget && !(_auxtarget iskindof "Air") && (round([position _arti,_targetPos] call KRON_distancePosSqr)) <= _range) then { _target = _auxtarget; //Must check if no friendly squad near fire position { if (!isnull _x && _side == side _x) then { if ((round([position _x,_targetPos] call KRON_distancePosSqr)) < KRON_UPS_safedist) exitwith {_target = objnull;}; }; }foreach KRON_NPCs; }; }; //If target found exit if (!isnull _target) exitwith {}; }foreach _targets; }; //If target fires artillery if (!isnull _target) then { //Fix current target call (compile format ["KRON_UPS_ARTILLERY_%1_TARGET = _target",_side]); _targetPos = _target getvariable ("UPSMON_lastknownpos"); if (!isnil "_targetPos") then { [_targetPos,_rounds,_area,_maxcadence,_mincadence,_bullet] spawn MON_artillery_dofire; }; }; }; }; sleep 0.5; }foreach KRON_UPS_ARTILLERY_UNITS; //if (KRON_UPS_Debug>0) then {player globalchat format["Init_upsmon artillery=%1 %2",count KRON_UPS_ARTILLERY_UNITS]}; sleep _cycle; }; }; // *********************************************************************************************************** // INITIALIZATION OF UPSMON // *********************************************************************************************************** _l = allunits + vehicles; { if ((_x iskindof "AllVehicles") && (side _x != civilian)) then { _s = side _x; switch (_s) do { case west: { KRON_AllWest=KRON_AllWest+[_x]; }; case east: { KRON_AllEast=KRON_AllEast+[_x]; }; case resistance: { KRON_AllRes=KRON_AllRes+[_x]; }; }; }; } forEach _l; _l = nil; if (isNil("KRON_UPS_Debug")) then {KRON_UPS_Debug=0}; KRON_UPS_East_enemies = KRON_AllWest; KRON_UPS_West_enemies = KRON_AllEast; if (east in KRON_UPS_Res_enemy ) then { KRON_UPS_East_enemies = KRON_UPS_East_enemies+KRON_AllRes; KRON_UPS_Guer_enemies = KRON_AllEast; } else { KRON_UPS_East_friends = KRON_UPS_East_friends+KRON_AllRes; KRON_UPS_Guer_friends = KRON_AllEast; }; if (west in KRON_UPS_Res_enemy ) then { KRON_UPS_West_enemies = KRON_UPS_West_enemies+KRON_AllRes; KRON_UPS_Guer_enemies = KRON_UPS_Guer_enemies+KRON_AllWest; } else { KRON_UPS_West_friends = KRON_UPS_West_friends+KRON_AllRes; KRON_UPS_Guer_friends = KRON_UPS_Guer_friends+KRON_AllWest; }; KRON_UPS_West_Total = count KRON_AllWest; KRON_UPS_East_Total = count KRON_AllEast; KRON_UPS_Guer_Total = count KRON_AllRes; //Initialization done KRON_UPS_INIT=1; }; // --------------------------------------------------------------------------------------------------------- processInitCommands; //Executes de main process of server [] SPAWN MON_MAIN_server; diag_log "--------------------------------"; diag_log (format["UPSMON started"]); if(true) exitWith {}; // ========================================================================================================= // Script for action follow me when surrended, adds the soldier to player squad in a random choice. // Version: 1.0 // Author: Monsada (smirall@hotmail.com) // --------------------------------------------------------------------------------------------------------- private ["_obj","_caller","_id","_objtype","_rnd","_join","_direction"]; _npc = _this select 0; _caller = _this select 1; _id = _this select 2; _rnd = 0; _join=true; _npc switchmove ""; _direction = ((getpos _caller select 0) - (getpos _npc select 0)) atan2 ((getpos _caller select 1) - (getpos _npc select 1)); //If positive values are needed then use: if(_direction < 0) then {_direction = _direction + 360}; _npc setdir _direction; _npc dowatch _caller; _npc setSpeedMode "LIMITED"; _npc domove position _caller; sleep 0.5; _rnd = random 100; _npc setmimic "Sad"; if (_rnd <= 30 ) then { _npc globalchat "Ok"; }; if (_rnd > 30 && _rnd <= 50) then { _npc globalchat "Yes"; }; if (_rnd > 50 && _rnd <= 100) then { _join=false; _rnd = random 100; if (_rnd < 20) then { _npc setmimic "angry"; _npc switchmove "CtsPercMstpSnonWnonDnon_idle31rejpaniVnose"; _npc globalchat "Kiss my ass"; }; if (_rnd > 20 && _rnd <= 40) then { _npc setmimic "Agresive"; _npc switchmove "CtsPercMstpSnonWnonDnon_idle33rejpaniVzadku"; sleep 3; _npc globalchat "Que te den"; }; if (_rnd > 40 && _rnd <= 60) then { _npc setmimic "Agresive"; _npc switchmove "CtsPercMstpSnonWnonDnon_idle33rejpaniVzadku"; sleep 1; _npc globalchat "Fuck you"; }; if (_rnd > 60 && _rnd <= 80) then { _npc setmimic "Agresive"; _npc switchmove "CtsPercMstpSnonWnonDnon_idle32podrbaniNanose"; sleep 0.5; _npc globalchat "Follow your mother"; }; if (_rnd > 80 && _rnd <= 100) then { _npc setmimic "angry"; sleep 0.1; _npc switchmove "CtsPercMstpSnonWnonDnon_idle32podrbaniNanose"; _npc globalchat "Fuck you"; }; }; if (_join) then { // remove the action once it is activated _npc stop false; if (_npc == leader _npc) then { _npc globalchat "All follow that man"; { _x switchmove ""; [_x] joinSilent _caller; }foreach units _npc; } else { _npc removeAction _id; [_npc] joinSilent _caller; }; }; if (true) exitWith {}; // ========================================================================================================= // Biblioteca de funciones comunes // Version: 5.0.7 // Author: Monsada (smirall@hotmail.com) // http://www.simulacion-esp.com/ // Comunidad Hispana de Simulación // ========================================================================================================= MON_bugged_vehicles = ["BIS_alice_emptydoor","ACE_Grenade_Geometry"]; // --------------------------------------------------------------------------------------------------------- //Función que permite posicionar objetos a la altura definida //param1: objeto //param2: altura MON_subir = { if (!isserver) exitwith{}; private ["_object","_altura","_pos","_x","_y","_z","_bld","_bldpos"]; _object = _this select 0; _altura = _this select 1; _x = 0; _y = 0; _z = 0; _pos =0; _bld = objnull; _bldpos =0; _pos = getposasl _object; _x = _pos select 0; _y = ( _pos select 1 ); _z = ( _pos select 2 ) + _altura; _object setposasl [_x,_y ,_z]; }; //Retorna la dirección entre dos posiciones MON_getDirPos = {private["_a","_b","_from","_to","_return"]; _from = _this select 0; _to = _this select 1; _return = 0; _a = ((_to select 0) - (_from select 0)); _b = ((_to select 1) - (_from select 1)); if (_a != 0 || _b != 0) then {_return = _a atan2 _b}; if ( _return < 0 ) then { _return = _return + 360 }; _return}; // --------------------------------------------------------------------------------------------------------- //Función de borra unidades que han sido matadas //param1: objeto a borrar cuando muera //param2: tiempo a esperar antes de borrar el objeto MON_deleteDead = {private["_u","_s"];_u=_this select 0; _s= _this select 1; _u removeAllEventHandlers "killed"; sleep _s; deletevehicle _u}; MON_deleteDeadDist = {private["_u","_s","_dist","_OCercanos","_cicle","_deleted","_isplayer"]; _i = 0; _cicle = 10; _deleted = false; _isplayer = false; _u = _this select 0; _s = _this select 1; _dist = _this select 2; _u removeAllEventHandlers "killed"; sleep _s; while {!_deleted} do { _isplayer = false; //Buscamos objetos cercanos _OCercanos = nearestObjects [_u, ["Man"] , _dist]; //Validamos si alguno de los soldados cerca es un jugador y está vivo {if (isplayer _x && alive _x) exitwith {_isplayer = true;}}foreach _OCercanos; if (!_isplayer) then { deletevehicle _u; _deleted = true; }; sleep _cicle; }; }; // --------------------------------------------------------------------------------------------------------- //Función tomada de UPS, busca el comando en la lista y devuelve el siguiente elemento //param1: comando a buscar //param2: valor por defecto del comando //param3: array con los comandos //Retorna valor del comando encontrado o valor por defecto MON_getArg = {private["_cmd","_arg","_list","_a","_v"]; _cmd=_this select 0; _arg=_this select 1; _list=_this select 2; _a=-1; {_a=_a+1; _v=format["%1",_list select _a]; if (_v==_cmd) then {_arg=(_list select _a+1)}} foreach _list; _arg}; // --------------------------------------------------------------------------------------------------------- //Función que devuelve una posición en 3D a partir de otra, una dirección y una distancia //param1: posición //param2: dirección //param3: distancia //Retorna vector de posicion en 3D [0,0,0] MON_GetPos = { private ["_pos","_dir","_dist","_cosU","_cosT","_relTX","_sinU","_sinT","_relTY","_newPos","_newPosX","_newPosY", "_targetZ" ]; _pos = _this select 0; _dir = _this select 1; _dist = _this select 2; _targetX = _pos select 0; _targetY = _pos select 1; _targetZ = _pos select 2; //Calculamos posición _cosU = [_dir] call MON_GetCOS; _sinU = [_dir] call MON_GetSIN; _cosT = abs cos(_dir); _sinT = abs sin(_dir); _relTX = _sinT * _dist * _cosU; _relTY = _cosT * _dist * _sinU; _newPosX = _targetX + _relTX; _newPosY = _targetY + _relTY; _newPos = [_newPosX,_newPosY,_targetZ]; _newPos; }; // --------------------------------------------------------------------------------------------------------- //Función que devuelve una posición en 2D a partir de otra, una dirección y una distancia //param1: posición //param2: dirección //param3: distancia //Retorna vector de posicion en 2D [0,0] MON_GetPos2D = { private ["_pos","_dir","_dist","_cosU","_cosT","_relTX","_sinU","_sinT","_relTY","_newPos","_newPosX","_newPosY" ]; _pos = _this select 0; _dir = _this select 1; _dist = _this select 2; _targetX = _pos select 0; _targetY = _pos select 1; //Calculamos posición _cosU = [_dir] call MON_GetCOS; _sinU = [_dir] call MON_GetSIN; _cosT = abs cos(_dir); _sinT = abs sin(_dir); _relTX = _sinT * _dist * _cosU; _relTY = _cosT * _dist * _sinU; _newPosX = _targetX + _relTX; _newPosY = _targetY + _relTY; _newPos = [_newPosX,_newPosY]; _newPos; }; // --------------------------------------------------------------------------------------------------------- //Función que devuelve las posiciones que se pueden ocupar dentro de un edificio //param1: objeto location //Retorna numero de posiciones que tiene el edificio MON_BldPos = {private ["_bld","_bldpos"]; _bld=_this; _bldpos = 1; while {format ["%1", _bld buildingPos _bldpos] != "[0,0,0]"} do {_bldpos = _bldpos + 1;}; _bldpos = _bldpos - 1; _bldpos;}; // --------------------------------------------------------------------------------------------------------- //Función que devuelve la casa que hay más cerca del objeto param1 y las posiciones que se pueden ocupar dentro de ella. //param1: objeto //Retorna vector con [objeto location, posiciones que tiene] MON_PosInfo = { private["_obj","_bld","_bldpos"]; _obj=_this; _bld = nearestbuilding _obj; _bldpos= _bld call MON_BldPos; [_bld,_bldpos]; }; // --------------------------------------------------------------------------------------------------------- //Función que devuelve el valor negativo o positivo del seno en base a un angulo MON_GetSIN = { private["_dir","_sin","_cos"]; _dir=_this select 0; if (_dir<90) then { _sin=1; } else { if (_dir<180) then { _sin=-1; } else { if (_dir<270) then { _sin=-1; } else { _sin=1; }; }; }; _sin }; // --------------------------------------------------------------------------------------------------------- //Función que devuelve el valor negativo o positivo del coseno en base a un angulo MON_GetCOS = { private["_dir","_cos"]; _dir=_this select 0; if (_dir<90) then { _cos=1; } else { if (_dir<180) then { _cos=1; } else { if (_dir<270) then { _cos=-1; } else { _cos=-1; }; }; }; _cos }; //Función que busca vehiculos cercanos y hace entrar a las unidades del lider //Parámeters: [_grpid,_npc] // <- _grpid: id of group to assign to vehicle // <- _npc: lider // -> _getin: true if any getin MON_GetIn_NearestVehicles = { private["_vehicles","_npc","_units","_unitsIn","_grpid","_getin"]; _grpid = _this select 0; _npc = _this select 1; _vehicles=[[]]; _air=[[]]; _units = []; _unitsIn = []; _getin=false; if (leader _npc == _npc) then { _units = units _npc; } else { _units = _units + [_npc]; }; { if ( (_x!= vehicle _x && !((vehicle _x) iskindof "StaticWeapon" )) || !(_x iskindof "Man") || !alive _x || !canmove _x || !canstand _x) then {_units = _units-[_x];}; }foreach _units; _unitsIn = _units; //if (KRON_UPS_Debug>0) then {diag_log format["%1 _units=%2",_grpid, count _units]}; //First catch combat vehicles if ( (count _units) > 0) then { _air = [_npc,200] call MON_NearestsAirTransports; {if (_npc knowsabout (_x select 0) <= 0.5) then{ _air = _air - [_x]};}foreach _air; _units = [_grpid, _units, _air, false] call MON_selectvehicles; }; sleep 0.05; if ( (count _units) > 1) then { _vehicles = [_npc,200,true] call MON_NearestsLandCombat; {if (_npc knowsabout(_x select 0) <= 0.5) then{ _vehicles = _vehicles - [_x]};}foreach _vehicles; _units = [_grpid, _units, _vehicles, false] call MON_selectvehicles; }; sleep 0.05; if ( (count _units) > 0) then { _vehicles = [_npc,200] call MON_NearestsLandTransports; {if (_npc knowsabout (_x select 0) <= 0.5) then{ _vehicles = _vehicles - [_x]};}foreach _vehicles; _units = [_grpid, _units, _vehicles, false] call MON_selectvehicles; }; sleep 5; if ( (count _units) > 0 && (count _vehicles) > 0) then { sleep 1; _vehicles = _vehicles + _air; _units = [_grpid, _units, _vehicles, true] call MON_selectvehicles; }; sleep 0.05; _unitsIn = _unitsIn - _units; _unitsIn; }; //Función que busca vehiculos cercanos y hace entrar a las unidades del lider //Parámeters: [_grpid,_npc] // <- _grpid: id of group to assign to vehicle // <- _npc: lider // -> _getin: true if any getin MON_GetIn_NearestCombat = { private["_vehicles","_npc","_units","_unitsIn","_grpid","_getin","_dist","_all"]; _grpid = _this select 0; _npc = _this select 1; _dist = _this select 2; _all = _this select 3; _vehicles=[[]]; _units = []; _unitsIn = []; _getin=false; if (leader _npc == _npc) then { _units = units _npc; } else { _units = _units + [_npc]; }; { if ( (_x!= vehicle _x && !((vehicle _x) iskindof "StaticWeapon" )) || !(_x iskindof "Man") || !alive _x || !canmove _x || !canstand _x) then {_units = _units-[_x];}; }foreach _units; //If suficient units leader will not get in if (!all) then { if (count _units > 2 ) then {_units = _units - [leader _npc]}; }; _unitsIn = _units; //We need 2 units available if not any leave vehicle to another squad if ( (count _units) > 1) then { _vehicles = [_npc,_dist,_all] call MON_NearestsAirCombat; {if (_npc knowsabout (_x select 0) <= 0.5) then{ _vehicles = _vehicles - [_x]};}foreach _vehicles; _units = [_grpid, _units, _vehicles, false] call MON_selectvehicles; }; sleep 0.05; if ( (count _units) > 1) then { _vehicles = [_npc,_dist,_all] call MON_NearestsLandCombat; {if (_npc knowsabout(_x select 0) <= 0.5) then{ _vehicles = _vehicles - [_x]};}foreach _vehicles; _units = [_grpid, _units, _vehicles, false] call MON_selectvehicles; }; _unitsIn = _unitsIn - _units; _unitsIn; }; //Función que busca vehiculos cercanos y hace entrar a las unidades del lider //Parámeters: [_grpid,_npc] // <- _grpid: id of group to assign to vehicle // <- _npc: lider // -> _getin: true if any getin MON_GetIn_NearestBoat = { private["_vehicles","_npc","_units","_unitsIn","_grpid","_getin","_dist"]; _grpid = _this select 0; _npc = _this select 1; _dist = _this select 2; _vehicles=[[]]; _units = []; _unitsIn = []; _getin=false; if (leader _npc == _npc) then { _units = units _npc; } else { _units = _units + [_npc]; }; { if ( (_x!= vehicle _x && !((vehicle _x) iskindof "StaticWeapon" )) || !(_x iskindof "Man") || !alive _x || !canmove _x || !canstand _x) then {_units = _units-[_x];}; }foreach _units; _unitsIn = _units; //We need 2 units available if not any leave vehicle to another squad if ( (count _units) > 0) then { _vehicles = [_npc,_dist] call MON_Nearestsboats; {if (_npc knowsabout (_x select 0) <= 0.5) then{ _vehicles = _vehicles - [_x]};}foreach _vehicles; _units = [_grpid, _units, _vehicles, false] call MON_selectvehicles; }; if ( (count _units) > 1 && (count _vehicles) > 0) then { sleep 1; _units = [_grpid, _units, _vehicles, true] call MON_selectvehicles; }; _unitsIn = _unitsIn - _units; _unitsIn; }; //Función que busca staticos cercanos y hace entrar a las unidades del lider //Parámeters: [_grpid,_npc] // <- _grpid: id of group to assign to vehicle // <- _npc: lider // -> _getin: true if any getin MON_GetIn_NearestStatic = { private["_vehicles","_npc","_units","_unitsIn","_grpid","_getin","_count"]; _grpid = _this select 0; _npc = _this select 1; _count = 0; _distance = 100; if ((count _this) > 2) then {_distance = _this select 2;}; _vehicles=[]; _units = []; _unitsIn = []; _getin=false; //Buscamos staticos cerca _vehicles = [_npc,_distance] call MON_NearestsStaticWeapons; if ( count _vehicles == 0) exitwith {_unitsIn;}; if (leader _npc == _npc) then { _units = (units _npc) - [_npc]; } else { _units = _units + [_npc]; }; //Solo tomamos las unidades vivas y que no estén en vehiculo { if ( (_x iskindof "Man") && _x == vehicle _x && alive _x && canmove _x && canstand _x) then { _unitsIn = _unitsIn + [_x]; }; }foreach _units; //Intentamos tomar solo las que estén disponibles _units = []; { if (unitready _x) then { _units = _units + [_x]; }; }foreach _unitsin; //Si hay unidades disponibles las usamos if (count _units > 0) then { _unitsIn = _units; }; //if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: Found %2 estatic weapons %3 men available",_grpid,count _vehicles, count _unitsIn]}; _units = _unitsIn; if ( count _unitsIn > 0) then { _units = [_grpid, _units, _vehicles, true] call MON_selectvehicles; }; _unitsIn = _unitsIn - _units; _unitsIn; }; //Function to assign units to vehicles //Parámeters: [_grpid,_unitsin,_vehicle] // <- _grpid: id of group to assign to vehicle // <- _units: array of units to getin // <- _vehicles: array of vehicles to use // -> _untis: array of units getin MON_selectvehicles = { private["_vehicles","_emptypositions","_units","_unitsIn","_i","_grpid","_vehgrpid","_unit","_wp","_any","_index","_cargo"]; _grpid = _this select 0; _units = _this select 1; _vehicles = _this select 2; _any = _this select 3; //meter en cualquier vehiculo _wp = []; _vehicle = []; _unitsIn = []; _emptypositions = 0; _i = 0; _vehgrpid = 0; _unit = objnull; _index = 0; _cargo = []; { if ((count _units) == 0 ) exitwith {}; _vehicle = _x select 0 ; _emptypositions = _x select 1; _unitsIn = []; _i = 0; _vehgrpid = _vehicle getvariable ("UPSMON_grpid"); _cargo = _vehicle getvariable ("UPSMON_cargo"); if ( isNil("_vehgrpid") ) then {_vehgrpid = 0;}; if ( isNil("_cargo") ) then {_cargo = [];}; //Asignamos el vehiculo a a la escuadra si contiene las posiciones justas if (_vehgrpid == 0) then { _vehicle setVariable ["UPSMON_grpid", _grpid, false]; _vehicle setVariable ["UPSMON_cargo", _units, false]; _vehgrpid = _grpid; }; { if (!alive _x || !canmove _x) then {_cargo = _cargo - [_x]; }; }foreach _cargo; _emptypositions = _emptypositions - (count _cargo - count ( crew _vehicle) ); //ahora buscamos en cualquier vehiculo if ( _vehgrpid == _grpid || (_emptypositions > 0 && _any)) then { while {_i < _emptypositions && _i < count _units} do { _unit = _units select _i; _unitsIn = _unitsIn + [_unit]; _i = _i + 1; }; { _units = _units - [_x]; }foreach _unitsIn; if ( (count _unitsIn) > 0) then { //Asignamos el vehiculo a a la escuadra si contiene las posiciones justas if (_vehgrpid == _grpid) then { _vehicle setVariable ["UPSMON_cargo", _units, false]; }; //Metemos las unidades en el vehiculo [_grpid,_unitsIn,_vehicle] spawn MON_UnitsGetIn; if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: Get in %2 %3 units of %4 available",_grpid,typeof _vehicle,count _unitsIn,_emptypositions]}; //if (KRON_UPS_Debug>0) then {diag_log format["%1 getin %2 id=%7 any=%8 unitsin=%9 quedan=%6 emptypositions=%3 cargo=%4 crew=%5",_grpid, typeof _vehicle, _emptypositions, count _cargo,count (crew _vehicle),count _units,_vehgrpid,_any, count _unitsIn]}; }; }; _index = _index + 1; sleep 0.05; } foreach _vehicles; _units; }; //Funcion que mete la tropa en el vehiculo //Parámeters: [_grpid,_unitsin,_vehicle] // <- _grpid: id of group to assign to vehicle // <- _unitsin: array of units to getin // <- _vehicle MON_UnitsGetIn = { private["_grpid","_vehicle","_npc","_driver","_gunner", "_unitsin", "_units" , "_Commandercount","_Drivercount","_Gunnercount","_cargo", "_Cargocount","_emptypositions","_Commander","_vehgrpid","_cargo"]; _grpid = _this select 0; _unitsin = _this select 1; _vehicle = _this select 2; _units = _unitsin; _driver = objnull; _gunner = objnull; _Commander = objnull; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; _cargo = []; _Cargocount = (_vehicle) emptyPositions "Cargo"; _Gunnercount = (_vehicle) emptyPositions "Gunner"; _Commandercount = (_vehicle) emptyPositions "Commander"; _Drivercount = (_vehicle) emptyPositions "Driver"; //Obtenemos el identificador del vehiculo _vehgrpid = _vehicle getvariable ("UPSMON_grpid"); _cargo = _vehicle getvariable ("UPSMON_cargo"); if ( isNil("_vehgrpid") ) then {_vehgrpid = 0;}; if ( isNil("_cargo") ) then {_cargo = [];}; _cargo = _cargo - _unitsin; //Para evitar duplicados _cargo = _cargo + _unitsin; //Añadimos a la carga _vehicle setVariable ["UPSMON_cargo", _cargo, false]; //Hablitamos a la IA para entrar en el vehiculo { [_x,0] call MON_dostop; if ("StaticWeapon" countType [vehicle (_x)]>0) then { _x spawn MON_doGetOut; }; unassignVehicle _x; _x spawn MON_Allowgetin; }foreach _units; //Asignamos al lider como comandante o carga { if ( _vehgrpid == _grpid && _x == leader _x && _Commandercount > 0 ) exitwith { _Commandercount = 0; _Commander = _x; _Commander assignAsCommander _vehicle; _units = _units - [_x]; [_x] orderGetIn true; }; if ( _x == leader _x && _Cargocount > 0 ) exitwith { _x assignAsCargo _vehicle; _units = _units - [_x]; _Cargocount = _Cargocount - 1; [_x] orderGetIn true; }; }foreach _units; //if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: _vehgrpid %2 ,_Gunnercount %3, %4",_grpid,_vehgrpid,_Gunnercount,count _units]}; //Si el vehiculo pertenece al grupo asignamos posiciones de piloto, sinó solo de carga if ( _vehgrpid == _grpid ) then { //Asignamos el conductor if ( _Drivercount > 0 && count (_units) > 0 ) then { _driver = _units select (count _units - 1); [_driver,_vehicle,0] spawn MON_assignasdriver; _units = _units - [_driver]; }; //Asignamos el artillero if ( _Gunnercount > 0 && count (_units) > 0 ) then { _gunner = [_vehicle,_units] call MON_getNearestSoldier; [_gunner,_vehicle] spawn MON_assignasgunner; _units = _units - [_gunner]; }; }; //if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: _vehgrpid=%2 units=%4",_grpid,_vehgrpid,_cargocount,count _units]}; //Movemos el resto como carga if ( _Cargocount > 0 && count (_units) > 0 ) then { { _x assignAsCargo _vehicle; [_x] orderGetIn true; sleep 0.05; } forEach _units; }; { [_x] spawn MON_avoidDissembark; } forEach (_unitsin - [_driver]) - [_gunner]; }; MON_getNearestSoldier = { private["_units","_obj","_near"]; _obj = _this select 0; _units = _this select 1; _near = objnull; { if (isnull _near) then { _near = _x; } else { if ( _x distance _obj < _near distance _obj ) then {_near = _x;}; }; }foreach _units; _near; }; MON_avoidDissembark = { private["_npc","_vehicle","_timeout"]; _npc = _this select 0; _vehicle = vehicle _npc ; _timeout = 120; _timeout = time + _timeout; while {_npc == vehicle _npc && alive _npc && canmove _npc && time < _timeout} do { sleep 1; }; if (!alive _npc || !canmove _npc || time >= _timeout || driver vehicle _npc == _npc) exitwith{}; _npc stop true; while {_npc != vehicle _npc && alive _npc && canmove _npc} do {sleep 1;}; if (!alive _npc || !canmove _npc) exitwith{}; _npc stop false; //sleep 0.5; if (!isnull (assignedVehicle player)) then { [_npc] ordergetin true; [_npc] spawn MON_avoidDissembark; }; }; //Función que devuelve un vehiculo de transporte cercano //Parámeters: [_npc] // <- _npc: object for position search // -> _vehicle: vehicle MON_NearestLandTransport = { private["_vehicle","_npc","_transportSoldier","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount"]; _npc = _this; _OCercanos = []; _transportSoldier = 0; _vehicle = objnull; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Car","TANK","Truck","Motorcycle"] , 150]; { _Cargocount = (_x) emptyPositions "Cargo"; _Gunnercount = (_x) emptyPositions "Gunner"; _Commandercount = (_x) emptyPositions "Commander"; _Drivercount = (_x) emptyPositions "Driver"; _transportSoldier = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && canMove _x && _transportSoldier >= count (units _npc) && !(typeof _x in MON_bugged_vehicles) && (_drivercount > 0 || side _npc == side _x )) exitwith {_vehicle = _x;}; }foreach _OCercanos; _vehicle; }; //Función que devuelve un array con los vehiculos terrestres más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_NearestsLandTransports = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance"]; _npc = _this select 0; _distance = _this select 1; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Car","TANK","Truck","Motorcycle"] , _distance]; { _Cargocount = (_x) emptyPositions "Cargo"; _Gunnercount = (_x) emptyPositions "Gunner"; _Commandercount = (_x) emptyPositions "Commander"; _Drivercount = (_x) emptyPositions "Driver"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && _emptypositions > 0 && canMove _x && !(typeof _x in MON_bugged_vehicles) && (_drivercount > 0 || side _npc == side _x )) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función que devuelve un array con los vehiculos terrestres más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_NearestsLandCombat = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance","_all"]; _npc = _this select 0; _distance = _this select 1; _all = _this select 2; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Car","TANK","Truck","Motorcycle"] , _distance]; { if (_all) then { _Cargocount = (_x) emptyPositions "Cargo"; }; _Gunnercount = (_x) emptyPositions "Gunner"; _Drivercount = (_x) emptyPositions "Driver"; _Commandercount = (_x) emptyPositions "Commander"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && _Gunnercount > 0 && canMove _x && !(typeof _x in MON_bugged_vehicles) && (_drivercount > 0 || side _npc == side _x )) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función que devuelve un array con los vehiculos aereos más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_NearestsAirTransports = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance"]; _npc = _this select 0; _distance = _this select 1; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Helicopter"] , _distance]; { _Cargocount = (_x) emptyPositions "Cargo"; _Gunnercount = (_x) emptyPositions "Gunner"; _Commandercount = (_x) emptyPositions "Commander"; _Drivercount = (_x) emptyPositions "Driver"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && _emptypositions > 0 && canMove _x && !(typeof _x in MON_bugged_vehicles) && (_drivercount > 0 || side _npc == side _x )) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función que devuelve un array con los vehiculos aereos más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_NearestsAirCombat = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance","_all"]; _npc = _this select 0; _distance = _this select 1; _all = _this select 2; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Helicopter"] , _distance]; { if (_all) then { _Cargocount = (_x) emptyPositions "Cargo"; }; _Gunnercount = (_x) emptyPositions "Gunner"; _Drivercount = (_x) emptyPositions "Driver"; _Commandercount = (_x) emptyPositions "Commander"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && _Gunnercount > 0 && canMove _x && !(typeof _x in MON_bugged_vehicles) && (_drivercount > 0 || side _npc == side _x )) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función que devuelve un array con los vehiculos staticos más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_NearestsStaticWeapons = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance"]; _npc = _this select 0; _distance = _this select 1; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["StaticWeapon"] , _distance]; { _Gunnercount = (_x) emptyPositions "Gunner"; _emptypositions = _Gunnercount; if (!locked _x && alive _x && _emptypositions > 0 && !(typeof _x in MON_bugged_vehicles) ) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función que devuelve un array con los vehiculos marinos más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_Nearestsboats = { private["_vehicles","_npc","_emptypositions","_OCercanos","_driver", "_Commandercount","_Drivercount","_Gunnercount","_Cargocount","_distance"]; _npc = _this select 0; _distance = _this select 1; _OCercanos = []; _emptypositions = 0; _vehicles = []; _Cargocount = 0; _Gunnercount = 0; _Commandercount = 0; _Drivercount = 0; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Ship"] , _distance]; { _Cargocount = (_x) emptyPositions "Cargo"; _Gunnercount = (_x) emptyPositions "Gunner"; _Commandercount = (_x) emptyPositions "Commander"; _Drivercount = (_x) emptyPositions "Driver"; _emptypositions = _Cargocount + _Gunnercount + _Commandercount + _Drivercount; if (!locked _x && _emptypositions > 0 && canMove _x && (_drivercount > 0 || side _npc == side _x )) then { _vehicles = _vehicles + [[_x,_emptypositions]];}; }foreach _OCercanos; _vehicles; }; //Función para retardar la toma del volante, así no se va el vehiculo y da tiempo a subir MON_assignasdriver = { private["_vehicle","_driver","_wait"]; _driver = _this select 0; _vehicle = _this select 1; _wait = _this select 2; [_driver,_wait] spawn MON_dostop; unassignVehicle _driver; _driver assignasdriver _vehicle; [_driver] orderGetIn true; //if (KRON_UPS_Debug>0) then {player sidechat format["%1: assigning to driver of %2 ",_driver, typeof _vehicle]}; }; MON_assignasgunner = { private["_vehicle","_gunner","_dist"]; _gunner = _this select 0; _vehicle = _this select 1; _dist=0; _gunner assignasgunner _vehicle; [_gunner] orderGetIn true; waituntil { _gunner != vehicle _gunner || !alive _gunner || !canmove _gunner ||!alive _vehicle || !canfire _vehicle}; if ( alive _gunner && alive _vehicle && canmove _gunner && canfire _vehicle) then { _dist = _gunner distance _vehicle; if (_dist < 3) then { _gunner moveInTurret [_vehicle, [0,0]] ; }; }; }; //Allow getin MON_Allowgetin = { //Hablitamos a la IA para entrar en el vehiculo [_this] allowGetIn true; }; //Función que ordena al soldado salir si se encuentra en un vehiculo y a la distancia indicada //Parámeters: [_heli,_targetPos,_atdist] // <- _npc: unit in vehicle // <- _targetPos: position for exiting(if no waypoint used) // <- _atdist: distance for doing paradrop or landing // -> _getout: true if getout MON_GetOutDist = { private["_vehicle","_npc","_target","_atdist","_getout","_dogetout","_driver","_commander","_targetpos","_dist","_vehpos","_vehicles"]; _npc = _this select 0; _targetpos = _this select 1; _atdist = _this select 2; _getout = false; _dogetout = []; _vehicles = []; sleep 0.05; if (!alive _npc) exitwith{}; _vehicle = vehicle _npc; _vehpos = getpos _vehicle; _dist = round([_vehpos,_targetpos] call KRON_distancePosSqr); //if (KRON_UPS_Debug>0) then {player sidechat format["%1: Getoutdist dist=%2 atdist=%3 ",typeof _vehicle,_dist, _atdist]}; if ( _vehicle != _npc || !(_npc iskindof "Man")) then { if ( (_dist) <= _atdist ) then { { if (( vehicle _x != _x || !(_x iskindof "Man")) && !((vehicle _x) in _vehicles)) then { _vehicles = _vehicles + [vehicle _x]; }; }foreach units _npc; { _vehicle = _x; _dogetout = crew _vehicle; _driver = driver _vehicle; _gunner = gunner _vehicle; //Si hay artillero no sacarenos ni al piloto ni al artillero ni al comandante if ( alive _gunner && canmove _gunner ) then { _dogetout = _dogetout - [_gunner] - [_driver]; }; if ( count _dogetout > 0 ) then { _getout = true; //Paramos el vehiculo y esperamos 5 segundos [_vehicle,10] spawn MON_doStop; //if (KRON_UPS_Debug>0) then {player sidechat format["%1: Getoutdist dist=%2 atdist=%3 ",typeof _vehicle,_dist, _atdist]}; { _x spawn MON_GetOut; sleep 0.5; }foreach _dogetout; //Quitamos el id al vehiculo para que pueda ser reutilizado _vehicle setVariable ["UPSMON_grpid", 0, false]; _vehicle setVariable ["UPSMON_cargo", [], false]; [_npc,_vehicle, _driver] spawn MON_checkleaveVehicle; }; } foreach _vehicles; }; }; _dogetout; }; //Evalua si han salido todas las unidades para abandonar el vehiculo MON_checkleaveVehicle={ _npc = _this select 0; _vehicle = _this select 1; _driver = _this select 2; _in = false; //Damos tiempo a que todas las unidades salgan sleep 10; { if (_x != vehicle _x) then {_in = true}; }foreach units _npc; if (!_in) then { _driver enableAI "MOVE"; sleep 1; _driver stop false; sleep 1; _driver leaveVehicle _vehicle; sleep 1; }; }; //Function for order a unit to exit if no gunner //Parámeters: [_npc] // <- _npc: MON_GetOut = { private["_vehicle","_npc","_getout" ,"_gunner"]; _npc = _this; _vehicle = vehicle (_npc); _gunner = objnull; _gunner = gunner _vehicle; sleep 0.05; if (!alive _npc) exitwith{}; //Si no hay artillero abandonamos el vehiculo if ( isnull _gunner || !alive _gunner || !canmove _gunner || (_gunner != _npc && driver _vehicle != _npc && commander _vehicle != _npc) ) then { [_npc] allowGetIn false; unassignVehicle _npc; _npc spawn MON_doGetOut; }; }; //Function for order a unit to exit //Parámeters: [_npc] // <- _npc: MON_doGetOut = { private["_vehicle","_npc","_getout" ,"_gunner","_groupOne","_timeout","_dir"]; _npc = _this; _vehicle = vehicle (_npc); sleep 0.05; if (_vehicle != _npc) then { //Wait until vehicle is stopped waituntil {!alive _npc || !canmove _npc || !alive _vehicle || ((velocity _vehicle select 0) <= 0 && (velocity _vehicle select 1) <= 0 ) || ( _vehicle iskindof "Air" && ((position _vehicle) select 2) <= 1)}; if (!alive _npc || !canmove _npc) exitwith{}; unassignVehicle _npc; _npc action ["getOut", _vehicle]; doGetOut _npc; [_npc] spawn MON_cancelstop; waituntil {!alive _npc || !canmove _npc || vehicle _npc == _npc}; }; if (!alive _npc || !canmove _npc) exitwith{}; if (leader _npc != _npc) then { //Moves out with dispersion of 45º _dir = getDir _npc; _dir = _dir + 45 - (random 90); [_npc,25,_dir] spawn MON_domove; //if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 Moving away from %2 %3º",_npc, typeof _vehicle,_dir];}; }; }; //Function for exiting of heli //Parámeters: [_heli,_targetPos,_atdist] // <- _heli: // <- _targetPos: position for exiting(if no waypoint used) // <- _atdist: distance for doing paradrop or landing MON_doParadrop = { private["_heli","_npc","_getout" ,"_gunner","_targetpos","_helipos","_dist","_index","_grp","_wp","_targetPosWp","_targetP","_units","_crew","_timeout","_firstTime","_NearestEnemy"]; _heli = _this select 0; _targetPos = [0,0]; _atdist = 250; _flyingheigh = 90; _landonBeh = ["CARELESS","SAFE"]; _timeout=0; _firstTime = true; //Gets optional parameters if ((count _this) > 1) then {_targetPos = _this select 1;}; if ((count _this) > 2) then {_atdist = _this select 2;}; if ((count _this) > 3) then {_flyingheigh = _this select 3;}; _helipos = [0,0]; _targetposWp = [0,0]; _gunner = objnull; _gunner = gunner _heli; _dist = 1000000; _index = 0; _grp = GRPNULL; _wp = []; _units =[]; _crew =[]; if (_flyingheigh < 90) then {_flyingheigh = 90}; waituntil {count crew _heli > 0 || !alive _heli || !canmove _heli}; _grp = group ((crew _heli) select 0); _npc = leader ((crew _heli) select 0); _units = units _npc; if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 do paradrop at dist %2 ",typeof _heli, _atdist];}; while { (_dist >= _atdist || _dist < 10) && alive _heli && canmove _heli && count crew _heli > 0} do { _heli flyInHeight _flyingheigh; //Take last waypoint _index = (count waypoints _grp) - 1; _wp = [_grp,_index]; _targetPosWp = waypointPosition _wp; if (format ["%1", _targetPosWp] == "[0,0,0]") then {_targetPosWp = _targetPos}; _helipos = position _heli; _dist = round([_helipos,_targetPosWp] call KRON_distancePosSqr); if (_firstTime) then { _firstTime = false; if (_dist <= _atdist ) then { _targetPosWp = _targetPos; _dist = round([_helipos,_targetPosWp] call KRON_distancePosSqr); }; }; //if (KRON_UPS_Debug>0 ) then {hintsilent format["flying heigh=%1 dist=%2 jump at=%3",(position _heli) select 2,_dist,_atdist];}; sleep 1; }; if (!alive _heli || count crew _heli == 0 || (count (assignedCargo _heli) == 0 && !isnull (gunner _heli))) exitwith{}; _crew = crew _heli; _NearestEnemy = _heli findnearestenemy _heli; //Jump if (((position _heli) select 2) >= 55 && !surfaceIsWater position _heli && (!(toupper (behaviour _npc) IN _landonBeh) || !isnull _NearestEnemy || random 100 <= 50)) then { //moving hely for avoiding stuck [_heli,1000] spawn MON_domove; sleep 3; if (KRON_UPS_Debug>0 ) then {_heli globalchat format["doing paradrop high %1 dist=%2",(position _heli) select 2,_dist,_atdist];}; //Do paradrop { if( (assignedVehicleRole _x) select 0 == "Cargo")then { unassignVehicle _x; _x action ["EJECT", _heli] ; _x stop false; [_x] spawn MON_ACE_Watersurvival; }; sleep 0.5; } forEach crew _heli - [gunner _heli] - [driver _heli]; //Clear Hely vars _heli setVariable ["UPSMON_grpid", 0, false]; _heli setVariable ["UPSMON_cargo", [], false]; //Waits until all units are down _timeout = time + 60; { waituntil {(_x == vehicle _x ) || !alive _x || !canmove _x || isnull _x || time > _timeout}; //Fix bug of ACE that sometimes AI gets in stand animation //_x switchMove "AmovPercMsprSlowWrflDf_AmovPpneMstpSrasWrflDnon_2"; }foreach (_crew - [driver _heli]) - [gunner _heli]; //if (KRON_UPS_Debug>0) then {player globalchat format["%1 after paradrop",_npc]}; if (alive _npc && canmove _npc) then { _npc move _targetPosWp; }else{ {if (alive _x && canmove _x) exitwith { _x move _targetPosWp;}}foreach _crew; }; //If only pilot land heli if (count crew _heli <=1) then { [_heli] spawn MON_landHely; }; } else { //land if ( !surfaceIsWater _helipos && ((random 100)<20 || !canmove _heli || (!isnull _NearestEnemy && (toupper (behaviour _npc) IN _landonBeh) && random 100 <= 50))) then { [_heli] spawn MON_landHely; } else { If (alive _heli && canmove _heli && count crew _heli > 0) then { if (KRON_UPS_Debug>0 ) then {_heli globalchat format["%1 failed paradrop, trying another time",typeof _heli];}; //Try another time _heli flyInHeight _flyingheigh; sleep 3; [_heli, _targetPos, _atdist*1.5,_flyingheigh] spawn MON_doParadrop; }; }; }; //if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 exit do paradrop %2 ",_npc, _atdist];}; }; //Lands hely MON_landHely = { private["_heli","_npc","_crew","_NearestEnemy","_timeout","_landing","_targetpos"]; _heli = _this select 0; _crew =[]; _targetpos=[0,0]; _timeout = 0; _landing = false; sleep 0.05; if (!alive _heli || !canmove _heli ) exitwith{}; _crew = crew _heli; _npc = leader (_crew select 0); //Checks hely is already landing _landing = _heli getVariable "UPSMON_landing"; if (isnil ("_landing")) then {_landing=false;}; if (_landing) exitwith {}; //Orders to land heli _heli land "LAND"; if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 is trying to land, altitude=%2 %3",typeof _heli,(position _heli) select 2,behaviour _npc];}; //Puts a mark for knowing hely is landing _heli setVariable ["UPSMON_landing", true, false]; //Waits for land position waituntil {!alive _heli || toUpper(landResult _heli) != "NOTREADY" }; if (alive _heli && (toUpper(landResult _heli) == "NOTFOUND")) exitwith { if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 no landing zone, doing paradrop",typeof _heli];}; _heli setVariable ["UPSMON_landing", false, false]; [_heli] spawn MON_doparadrop; }; //1rt try-Waits until velocity and heigh are good for getting out _timeout = 30 + time; waituntil {!alive _heli || time > _timeout || ((velocity _heli select 2) <= 1 && ((position _heli) select 2) <= 2)}; //2nd try-Waits until velocity and heigh are good for getting out if (((position _heli) select 2) > 2 && ((position _heli) select 2) < 50 && !surfaceiswater position _heli) then { _heli land "LAND"; _timeout = 30 + time; if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 trying another time to land",typeof _heli,(position _heli) select 2,behaviour _npc];}; waituntil {!alive _heli || time > _timeout || ((position _heli) select 2) > 30 || ((velocity _heli select 2) <= 1 && ((position _heli) select 2) <= 2)}; }; //Chechs if alive before continuing if (!alive _heli) exitwith {}; if (((position _heli) select 2) >= 3) exitwith { if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 landing timeout, doing paradrop",typeof _heli];}; _heli setVariable ["UPSMON_landing", false, false]; //[_heli,1000] spawn MON_domove; sleep 5; [_heli] spawn MON_doparadrop; }; //dogetout each soldier { _x spawn MON_doGetOut; sleep 0.2; }forEach crew _heli; _timeout = 30 + time; //Waits until all getout of heli { waituntil {vehicle _x == _x || !canmove _x || !alive _x || movetofailed _x || time > _timeout }; }forEach _crew; // If leader alive sets combat mode if (alive _npc && canmove _npc) then { //Gets nearest known enemy for putting in combat mode _NearestEnemy = _npc findNearestEnemy _npc; if (!isnull _NearestEnemy ) then { _npc setBehaviour "AWARE"; _groupOne = group _npc; _groupOne setFormation "DIAMOND"; }; //Moves to current target Position _grpid = _npc getvariable "UPSMON_grpid"; if !(isnil "_grpid") then { _targetpos =(KRON_targetsPos select _grpid); _npc move _targetpos; if (KRON_UPS_Debug>0 ) then { player globalchat format["%1 landed",_grpid,count KRON_targetsPos];}; }; }; //Quitamos el id al vehiculo para que pueda ser reutilizado _heli setVariable ["UPSMON_grpid", 0, false]; _heli setVariable ["UPSMON_cargo", [], false]; _heli setVariable ["UPSMON_landing", false, false]; }; //Controls that heli not stoped flying MON_HeliStuckcontrol = { private["_heli","_landing","_stuckcontrol","_dir1","_targetPos","_lastpos"]; _heli = _this select 0; _landing = false; _stuckcontrol = false; _targetPos=[0,0,0]; _dir1 = 0; sleep 0.05; if ( !alive _heli || !canmove _heli ) exitwith{}; //Checks stuckcontrol not active _stuckcontrol = _heli getVariable "UPSMON_stuckcontrol"; if (isnil ("_stuckcontrol")) then {_stuckcontrol=false}; if (_stuckcontrol) exitwith {}; _heli setVariable ["UPSMON_stuckcontrol", true, false]; if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 stuck control begins",typeof _heli];}; //Stuck loop control while { alive _heli } do { sleep 5; if ((velocity _heli select 0) <= 3 && (velocity _heli select 1) <= 3 && (velocity _heli select 2) <= 3 && ((position _heli) select 2) >= 30) then { _landing = _heli getVariable "UPSMON_landing"; if (isnil ("_landing")) then {_landing=false;}; if (!_landing) then { //moving hely for avoiding stuck [_heli,1000] spawn MON_domove; if (KRON_UPS_Debug>0 ) then {player GLOBALCHAT format["%1 stucked at %2m altitude, moving",typeof _heli,(position _heli) select 2];}; sleep 30; }; }; }; //if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 exits from stuck control",typeof _heli];}; _heli setVariable ["UPSMON_stuckcontrol", false, false]; }; //Function that checks is gunner is alive, if not moves a cargo MON_Gunnercontrol = { private["_vehicle","_gunnercontrol","_hasgunner","_crew","_crew2"]; _vehicle = _this select 0; _targetPos=[0,0,0]; _dir1 = 0; _gunnercontrol = false; _hasgunner = (_vehicle) emptyPositions "Gunner" > 0 || !isnull gunner _vehicle; _crew = []; _crew2 = []; //Without driver and gunner sleep 0.05; if ( !alive _vehicle || !canmove _vehicle ) exitwith{}; //Checks stuckcontrol not active _gunnercontrol = _vehicle getVariable "UPSMON_gunnercontrol"; if (isnil ("_gunnercontrol")) then {_gunnercontrol=false}; if (_gunnercontrol) exitwith {}; _vehicle setVariable ["UPSMON_gunnercontrol", true, false]; _crew = crew _vehicle; //gunner and driver loop control while { alive _vehicle && canmove _vehicle && count _crew > 0} do { _crew = crew _vehicle; { if (!canmove _x || !alive _x) then {_crew = _crew -[_x];}; }foreach _crew; //Driver control if ((isnull (driver _vehicle) || !alive (driver _vehicle) || !canmove (driver _vehicle)) && count _crew > 0) then { _crew2 = _crew - [gunner _vehicle]; if (count _crew2 > 0) then { (_crew2 select (count _crew2 - 1)) spawn MON_movetodriver; }; }; //Gunner control if ( _hasgunner && (isnull (gunner _vehicle) || !alive (gunner _vehicle) || !canmove (gunner _vehicle)) && count _crew > 1) then { _crew2 = _crew - [driver _vehicle]; if (count _crew2 > 0) then { (_crew2 select (count _crew2 - 1)) spawn MON_movetogunner; }else{ (_crew select 0) spawn MON_movetogunner; }; }; sleep 20; //if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 crew=%2",typeof _vehicle, count _crew];}; }; //if (KRON_UPS_Debug>0 ) then {player globalchat format["%1 exits from gunner control",typeof _vehicle];}; _vehicle setVariable ["UPSMON_gunnercontrol", false, false]; }; //Mueve a todo el grupo adelante MON_move = { private["_npc","_dir1","_targetPos","_dist"]; _npc = _this select 0; _dist = _this select 1; sleep 0.05; if (!alive _npc || !canmove _npc ) exitwith{}; _dir1 = getDir _npc; _targetPos = [position _npc,_dir1, _dist] call MON_GetPos2D; _npc move _targetPos; }; //Mueve al soldado adelante MON_domove = { private["_npc","_dir1","_targetPos","_dist"]; _npc = _this select 0; _dist = _this select 1; if ((count _this) > 2) then {_dir1 = _this select 2;} else{_dir1 = getDir _npc;}; sleep 0.05; if (!alive _npc || !canmove _npc ) exitwith{}; _targetPos = [position _npc,_dir1, _dist] call MON_GetPos2D; //If position water and not boat not go if (surfaceIsWater _targetPos && !(_npc iskindof "boat" || _npc iskindof "air") ) exitwith {}; _npc domove _targetPos; }; //Función que detiene al soldado y lo hace esperar x segundos MON_doStop = { private["_sleep","_npc"]; _npc = _this select 0; _sleep = _this select 1; sleep 0.05; if (!alive _npc || !canmove _npc ) exitwith{}; if ( _sleep == 0 ) then {_sleep = 0.001}; //Restauramos valores por defecto de movimiento //_npc disableAI "MOVE"; dostop _npc ; sleep _sleep; [_npc] spawn MON_cancelstop; }; //Función que detiene al soldado y lo hace esperar x segundos MON_cancelstop = { private["_npc"]; _npc = _this select 0; _npc stop false; }; //Realiza la animación de esquivar granada MON_evadeGrenade = { if (!alive _this || (vehicle _this) != _this || !canmove _this) exitwith{}; _this playmovenow "AmovPercMstpSlowWrflDnon_ActsPpneMstpSlowWrflDr_GrenadeEscape"; sleep 8; if (!alive _this || (vehicle _this) != _this || !canmove _this) exitwith{}; _this switchmove "AmovPpneMstpSrasWrflDnon_AmovPpneMevaSlowWrflDr"; //croqueta _this playmovenow "AmovPpneMstpSrasWrflDnon"; //prone }; //Realiza la animación de la croqueta MON_animCroqueta = { if (!alive _this || (vehicle _this) != _this || !canmove _this || !(_this iskindof "Man")) exitwith{}; if ((random 1)<=.50) then { _x switchmove "AmovPpneMstpSrasWrflDnon_AmovPpneMevaSlowWrflDl"; //croqueta } else { _x switchmove "AmovPpneMstpSrasWrflDnon_AmovPpneMevaSlowWrflDr"; //croqueta }; }; //Lanza una granada MON_throw_grenade = { private["_target","_npc"]; _npc = _this select 0; _target = _this select 1; sleep 0.5; if (!alive _npc || (vehicle _npc) != _npc || !canmove _npc) exitwith{}; _npc addMagazine "SmokeShell"; [_npc,_target] spawn MON_dowatch; _npc selectWeapon "throw"; sleep .1; _npc fire ["SmokeShellMuzzle","SmokeShellMuzzle","SmokeShell"]; sleep 4; }; //Establece el tipo de posición MON_setUnitPos = { private["_pos","_npc"]; _npc = _this select 0; _pos = _this select 1; sleep 0.5; if (!alive _npc || !canmove _npc || _npc != vehicle _npc || !(_npc iskindof "Man")) exitwith{}; _npc setUnitPos _pos; sleep 1; }; //Establece el tipo de posición MON_setUnitPosTime = { private["_pos","_npc"]; _npc = _this select 0; _pos = _this select 1; _time = _this select 2; if (!alive _npc || !canmove _npc) exitwith{}; _npc setUnitPos _pos; sleep _time; _npc setUnitPos "AUTO"; sleep 1; }; // Función para mirar en una dirección MON_dowatch = { private["_target","_npc"]; _npc = _this select 0; _target = _this select 1; if (!alive _npc) exitwith{}; _npc dowatch _target; sleep 1; }; //Función que mueve al soldado a la posición de conductor //Parámeters: [_npc,_vehicle] // <- _npc: unit to move to driver pos // <- _vehicle MON_movetoDriver = { private["_vehicle","_npc"]; _npc = _this ; _vehicle = vehicle _npc; //Si está muerto if (vehicle _npc == _npc || !alive _npc || !canmove _npc || !(_npc iskindof "Man")) exitwith{}; if (isnull(driver _vehicle) || !alive(driver _vehicle) || !canmove(driver _vehicle)) then { //if (KRON_UPS_Debug>0) then {player sidechat format["%1: Moving to driver of %2 ",_npc,typeof _vehicle]}; _npc action ["getOut", _vehicle]; doGetOut _npc; WaitUntil {vehicle _npc==_npc || !alive _npc || !canmove _npc}; //Si está muerto if (!alive _npc || !canmove _npc) exitwith{}; unassignVehicle _npc; _npc assignasdriver _vehicle; _npc moveindriver _vehicle; }; }; //Función que mueve al soldado a la posición de conductor //Parámeters: [_npc,_vehicle] // <- _npc: unit to move to driver pos // <- _vehicle MON_movetogunner = { private["_vehicle","_npc"]; _npc = _this ; _vehicle = vehicle _npc; sleep 0.05; //Si está muerto if (vehicle _npc == _npc || !alive _npc || !canmove _npc || !(_npc iskindof "Man")) exitwith{}; if (isnull(gunner _vehicle) || !alive(gunner _vehicle) || !canmove(gunner _vehicle)) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1: Moving to gunner of %2 ",_npc,typeof _vehicle]}; _npc action ["getOut", _vehicle]; doGetOut _npc; WaitUntil {vehicle _npc==_npc || !alive _npc || !canmove _npc}; //Si está muerto if (!alive _npc || !canmove _npc) exitwith{}; unassignVehicle _npc; _npc assignasgunner _vehicle; _npc moveingunner _vehicle; }; }; //Función que retorna array de arrays con edificios y sus plantas //Parámeters: [_object,(_distance,_minfloors)] // <- _object: soldier to get near buildings // <- _distance: distance to search buildings (optional, 25 by default) // <- _minfloors: min floors of building (optional) if not especified min floors is 2 // -> [_bld,_bldpos] MON_GetNearestBuildings = { private ["_object","_altura","_pos","_bld","_bldpos","_posinfo","_minfloors","_OCercanos","_distance","_blds"]; _distance = 25; _minfloors = 2; _altura = 0; _blds = []; _object = _this select 0; if ((count _this) > 1) then {_distance = _this select 1;}; if ((count _this) > 2) then {_minfloors = _this select 2;}; _pos =0; _bld = objnull; _bldpos =0; _posinfo=[]; //La altura mínima es 2 porque hay muchos edificios q devuelven 2 de altura pero no se puede entrar en ellos. if ( minfloors == 0 ) then { minfloors = 2; }; // _posinfo: [0,0]=no house near, [obj,0]=house near, but no roof positions, [obj,pos]=house near, with roof pos //_posinfo= _object call MON_PosInfo; _OCercanos = nearestObjects [_object, ["house","building"] , _distance]; { _bldpos = _x call MON_BldPos; if ( _bldpos >= _minfloors && damage _x <= 0 ) then { _blds = _blds + [[_x,_bldpos]];}; //player sidechat format["%1 cerca de edificio con %2 plantas %5",typeof _object,_bldpos]; }foreach _OCercanos; _blds; }; //Function to move al units of squad to near buildings //Parámeters: [_npc,(_patrol,_minfloors)] // <- _npc: lider // <- _distance: distance to search buildings (optional, 25 by default) // <- _patrol: wheter must patrol or not MON_moveNearestBuildings = { private ["_npc","_altura","_pos","_bld","_bldpos","_posinfo","_blds","_distance","_cntobjs1","_bldunitin","_blddist","_patrol","_wait","_all"]; _distance = 30; _altura = 0; _patrol = false; _wait=60; _all = false; _npc = _this select 0; if ((count _this) > 1) then {_distance = _this select 1;}; if ((count _this) > 2) then {_patrol = _this select 2;}; if ((count _this) > 3) then {_wait = _this select 3;}; if ((count _this) > 4) then {_all = _this select 4;}; _pos =0; _bld = objnull; _bldpos =0; _cntobjs1=0; _bldunitsin=[]; _units=[]; _blds=[]; //If all soldiers move leader too if (_all) then { _units = (units _npc); }else{ _units = (units _npc) - [_npc]; }; sleep 0.05; { if (_x iskindof "Man" && unitReady _x && _x == vehicle _x && canmove _x && alive _x && canstand _x) then {_bldunitsin = _bldunitsin + [_x]} }foreach _units; if (count _bldunitsin == 0) exitwith {}; //Obtenemos los edificios cercanos al lider _blds = [_npc,_distance] call MON_GetNearestBuildings; if (count _blds==0) exitwith {}; //Movemos a la unidades a los edificios cercanos. [_bldunitsin, _blds, _patrol,_wait,_all] spawn MON_moveBuildings; }; //Function to move al units of squad to near buildings //Parámeters: [_npc,(_patrol,_minfloors)] // <- _units: array of units // <- _blds: array of buildingsinfo [_bld,pos] // <- _patrol: wheter must patrol or not // -> _bldunitsin: array of units moved to builidings MON_moveBuildings = { private ["_npc","_altura","_pos","_bld","_bldpos","_posinfo","_blds","_cntobjs1","_bldunitin","_blddist","_i","_patrol","_wait","_all","_minpos","_blds2"]; _patrol = false; _wait = 60; _minpos = 2; _all = false; _units = _this select 0; _blds = _this select 1; if ((count _this) > 2) then {_patrol = _this select 2;}; if ((count _this) > 3) then {_wait = _this select 3;}; if ((count _this) > 4) then {_all = _this select 4;}; if ((count _this) > 5) then {_minpos = _this select 5;}; _altura = 0; _pos =0; _bld = objnull; _bldpos =0; _cntobjs1=0; _bldunitsin=[]; _movein=[]; _blds2 =[]; //if (KRON_UPS_Debug>0) then {player globalchat format["MON_moveBuildings _units=%1 _blds=%2",count _units, count _blds]; }; //if (KRON_UPS_Debug>0) then {diag_log format["MON_moveBuildings _units=%1 _blds=%2",count _units, count _blds];}; { _bld = _x select 0; _bldpos = _x select 1; if ( _bldpos >= _minpos ) then { _cntobjs1 = 1; _movein = []; _i = 0; if (_patrol) then { if (_bldpos >= 8) then { _cntobjs1 = 2 }; } else { if (_bldpos >= 8) then { _cntobjs1 = round(random 3) + 1;}; }; //Buscamos una unidad cercana para recorrerlo { if (_x iskindof "Man" && unitReady _x && canmove _x && alive _x && vehicle _x == _x && _i < _cntobjs1) then{ _movein = _movein + [_x]; _i = _i + 1; }; } foreach _units; //if (KRON_UPS_Debug>0) then {player globalchat format["_units=%3 _bldunitsin %4 _movein=%1",_movein, typeof _bld, count _units, count _bldunitsin];} //if (KRON_UPS_Debug>0) then {diag_log format["_units=%3 _bldunitsin %4 _movein=%1 %2 %5",_movein, typeof _bld, count _units, count _bldunitsin,_x];}; if (count _movein > 0) then { _bldunitsin = _bldunitsin + _movein; _units = _units - _bldunitsin; if (_patrol) then { { [_x,_bld,_bldpos] spawn MON_patrolBuilding; }foreach _movein; } else { { _altura = floor(random(_bldpos)); if (_altura<2) then {_altura = _minpos}; [_x,_bld,_altura,_wait] spawn MON_movetoBuilding; }foreach _movein; }; }; }; if (count _units == 0) exitwith {}; }foreach _blds; //If need to enter all units in building and rest try with a superior lvl if ( _all && count _units > 0 ) then { _blds2 = []; _minpos = _minpos + 3; { if ( (_x select 1) >= _minpos) then { _blds2 = _blds2 + [_x]; }; }foreach _blds; //if (KRON_UPS_Debug>0) then {player globalchat format["MON_moveBuildings exit _units=%1 _blds=%2",count _units, count _blds2]; }; //if (KRON_UPS_Debug>0) then {diag_log format["MON_moveBuildings exit _units=%1 _blds=%2",count _units, count _blds2];}; if (count _blds2 > 0 ) then { [_units, _blds2, _patrol,_wait,_all,_minpos] call MON_moveBuildings; }; _bldunitsin = _bldunitsin + _units; }; _bldunitsin; }; //Function to move a unit to a position in a building //Parámeters: [_npc,(_patrol,_minfloors)] // <- _npc: soldier // <- _bld: building // <- _altura: building // <- _wait: time to wait in position MON_movetoBuilding = { private ["_npc","_altura","_bld","_wait","_dist","_retry","_soldiers"]; _wait = 60; _timeout = 120; _dist = 0; _retry = false; _npc = _this select 0; _bld = _this select 1; _altura = _this select 2; if ((count _this) > 3) then {_wait = _this select 3;}; //Si está en un vehiculo ignoramos la orden if (vehicle _npc != _npc || !alive _npc || !canmove _npc) exitwith{}; //Si ya está en un edificio ignoramos la orden _inbuilding = _npc getvariable ("UPSMON_inbuilding"); if ( isNil("_inbuilding") ) then {_inbuilding = false;}; if (_inbuilding) exitwith{}; _npc domove (_bld buildingPos _altura); _npc setVariable ["UPSMON_inbuilding", _inbuilding, false]; _npc setvariable ["UPSMON_buildingpos", nil, false]; _timeout = time + _timeout; //if (KRON_UPS_Debug>0) then {player globalchat format["%4|_bld=%1 | %2 | %3",typeof _bld, _npc, typeof _npc ,_altura];}; //if (KRON_UPS_Debug>0) then {diag_log format["%4|_bld=%1 | %2 | %3",typeof _bld, _npc, typeof _npc ,_altura];}; waitUntil {moveToCompleted _npc || moveToFailed _npc || !alive _npc || !canmove _npc || _timeout < time}; if (moveToCompleted _npc && alive _npc && canmove _npc) then { _dist = [position _npc,_bld buildingPos _altura] call KRON_distancePosSqr; _soldiers = [_npc,1] call MON_nearestSoldiers; //If more soldiers in same floor see to keep or goout. if (count _soldiers > 0) then { { if (!isnil{_x getvariable ("UPSMON_buildingpos")}) exitwith {_retry = true}; }foreach _soldiers; }; if (!_retry && _dist <= 2) then { _npc setvariable ["UPSMON_buildingpos", _altura, false]; sleep 0.1; [_npc,_wait] spawn MON_dostop; }; }; if (!alive _npc || !canmove _npc) exitwith{}; _npc setVariable ["UPSMON_inbuilding", false, false]; //Down one position. if (_retry ) then { _altura = _altura + 1; _bldpos = _bld call MON_BldPos; if (_altura <= _bldpos) then { [_npc,_bld,_altura] spawn MON_movetoBuilding; }; }; }; //Función para mover a una unidad al edificio más cercano //Parámeters: [_npc,_bld,(_BldPos)] // <- _npc: soldier to move // <- _bld:building to patrol // <- _BldPos: positions of builiding (optional) MON_patrolBuilding = { private ["_npc","_bld","_bldpos","_posinfo","_minfloors","_OCercanos","_distance","_timeout","_pos","_inbuilding","_rnd","_NearestEnemy","_patrolto","_time"]; _bldpos = 0; _pos = 0; _timeout = 0; _i = 1; _inbuilding = false; _rnd = 0; _patrolto = 0; _NearestEnemy = objnull; _time = 0; _npc = _this select 0; _bld = _this select 1; if ((count _this) > 2) then {_bldpos = _this select 2;} else {_bldpos = _x call MON_BldPos;}; if (_i > _bldpos) then {_i = _bldpos}; _patrolto = round ( 10 + random (_bldpos) ); if (_patrolto > _bldpos) then {_patrolto = _bldpos}; //Si ya está muerto o no se puede mover se ignora if (!(_npc iskindof "Man") || !alive _npc || !canmove _npc) exitwith{}; //Si ya está en un edificio ignoramos la orden _inbuilding = _npc getvariable ("UPSMON_inbuilding"); if ( isNil("_inbuilding") ) then {_inbuilding = false;}; //Asignamos el vehiculo a a la escuadra si contiene las posiciones justas if (!_inbuilding) then { _inbuilding = true; _npc setVariable ["UPSMON_inbuilding", _inbuilding, false]; [_npc,"Middle"] spawn MON_setUnitPos; _timeout = time + 60; //player sidechat format["%1 patrol building %2 from %3 to %4",typeof _npc, typeof _bld,_i, _patrolto]; while { _i <= _patrolto && alive _npc && canmove _npc} do{ _npc domove (_bld buildingPos _i); _time = time + 30; waitUntil {moveToCompleted _npc or moveToFailed _npc or !alive _npc or _time < time}; if (moveToCompleted _npc) then { _timeout = time + 60; _i = _i + 1; } else { if (moveToFailed _npc || !canmove _npc || !alive _npc || _timeout < time) then { //player sidechat format["%1 Cancelando patrulla en %2",_npc, typeof _bld]; _i = _patrolto + 1; }; }; sleep 0.05; }; //Si está en un vehiculo ignoramos la orden if (!alive _npc || !canmove _npc) exitwith{}; //Volvemos con el lider _npc domove (position leader _npc); //Marcamos que ya hemos finalizado sleep 60; //Damos tiempo para salir del edificio _npc setVariable ["UPSMON_inbuilding", false, false]; }; }; //Function to put a mine //Parámeters: [_npc,(_position)] // <- _npc: leader // <- _position:location for mine (optional) MON_CreateMine = { private ["_npc","_rnd","_soldier","_mine","_dir","_position"]; _soldier = _this select 0; if ((count _this) > 1) then {_position = _this select 1;} else {_position = [0,0];}; _mine = objnull; _rnd = 0; _dir = 0; _npc = leader _soldier; if (_soldier == _npc ) then { _rnd = round (random ( count ((units _npc)))); _soldier = (units _npc) select _rnd; }; //leader only control not work //Si está en un vehiculo ignoramos la orden if (!(_x iskindof "Man" ) || _soldier == _npc || _soldier!=vehicle _soldier || !alive _soldier || !canmove _soldier) exitwith {false}; //Animación para montar el arma if ((count _this) > 1) then { [_soldier,_position] spawn MON_doCreateMine; }else{ [_soldier] spawn MON_doCreateMine; }; true; }; MON_doCreateMine = { private ["_npc","_rnd","_soldier","_mine","_dir","_position"]; _position = [0,0]; _soldier = _this select 0; if ((count _this) > 1) then {_position = _this select 1;}; //If not is Man or dead exit if (!(_x iskindof "Man" ) || _soldier!=vehicle _soldier || !alive _soldier || !canmove _soldier) exitwith {false}; _soldier stop false; [_soldier,"AUTO"] spawn MON_setUnitPos; if ((count _this) > 1) then { _soldier domove _position; waituntil {unitReady _soldier || moveToCompleted _soldier || moveToFailed _soldier || !alive _soldier || !canmove _soldier}; }; if (moveToFailed _soldier || !alive _soldier || _soldier != vehicle _soldier || !canmove _soldier) exitwith {false}; //Crouche _soldier playMovenow "ainvpknlmstpslaywrfldnon_1"; sleep 1; if (!alive _soldier || !canmove _soldier) exitwith{}; _dir = getdir _soldier; _position = [position _soldier,_dir, 0.5] call MON_GetPos2D; _mine = createMine ["MineMine", _position , [], 0]; //Prepare mine _soldier playMoveNow "AinvPknlMstpSlayWrflDnon_medic"; sleep 5; //Return to formation _soldier domove position ( leader _soldier ); }; //Function to surrender AI soldier //Parámeters: [_npc] // <- _npc: soldier to surrender MON_surrender = { private ["_npc","_vehicle"]; _npc = _this select 0; if (!alive _npc || !canmove _npc) exitwith {}; _npc addrating -1000; _npc setcaptive true; sleep 0.5; _vehicle = vehicle _npc; if ( _npc != _vehicle || !(_npc iskindof "Man" )) then { _vehicle setcaptive true; if ( "Air" countType [_vehicle]>0) then { //Si acaba de entrar en el heli se define punto de aterrizaje if (_npc == driver _vehicle ) then { [_vehicle] call MON_landHely; }; } else { _npc spawn MON_doGetOut; }; //Esperamos a que esté parado waituntil {_npc == vehicle _npc || !alive _npc}; }; if (!alive _npc || !canmove _npc) exitwith {}; _npc setcaptive true; _npc stop true; [_npc,"UP"] call MON_setUnitPos; removeAllWeapons _npc; sleep 1; _npc playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; }; //Returns leader if was dead MON_getleader = { private ["_npc","_members"]; _npc = _this select 0; _members = _this select 1; sleep 0.05; if (!alive _npc ) then { //takes commder a soldier not in vehicle { if (alive _x && canmove _x && _x == vehicle _x && !isplayer _x) exitwith { _npc = _x; }; }foreach _members; //if no soldier out of vehicle takes any if (!alive _npc ) then { { if (alive _x && canmove _x) exitwith {_npc = _x;}; }foreach _members; }; //If not alive or already leader or is player exits if (isPlayer _npc || !alive _npc || !canmove _npc ) then { { if (alive _x && !isPlayer _x) exitwith {_npc = [_npc, _members] call MON_getleader;}; }foreach _members; _npc; }; if (leader _npc == _npc) exitwith {_npc}; //Set new _npc as leader group _npc selectLeader _npc; }; _npc; }; MON_ACE_Watersurvival = { private ["_lb","_pos","_ejector","_in","_grpid","_rnd"]; _in =[]; _rnd = 0; _ejector = _this select 0; //if (KRON_UPS_Debug>0) then {player globalchat format["MON_ACE_Watersurvival %1",typeof _ejector]}; waitUntil { !canmove _ejector || !alive _ejector || isnull (_ejector) || ((getPos vehicle _ejector) select 2 < 1) }; if ( !surfaceIsWater (getpos _ejector) || !canmove _ejector || !alive _ejector || isnull (_ejector) ) exitWith {}; //Miramos de entrar en un barco cercano _grpid = _ejector getvariable "UPSMON_grpid"; if (isnil "_grpid") then {_grpid = 0}; _in = [_grpid,_ejector,30] call MON_GetIn_NearestBoat; //If no boat near creates a zodiac if (count _in <= 0) then { if (!(isNil "ace_main")) then { _lb = "ACE_Lifeboat_US" createVehicle getposASL _ejector; }else{ _lb = "Zodiac" createVehicle getposASL _ejector; }; _pos = getposASL _ejector; _pos set [0, ((_pos select 0) + 2)]; _pos set [1, ((_pos select 1) + 2)]; //_pos set [2, 0]; _lb setPos _pos; //Moves in boat if !(isPlayer _ejector) then { [_ejector,_lb,0] call MON_assignasdriver; }; }; //Wait until reached eart waitUntil { !canmove _ejector || !alive _ejector || isnull (_ejector) || !surfaceIsWater (position _ejector) }; if (KRON_UPS_Debug>0) then {player globalchat format["Exit from boat%1",typeof _lb]}; _ejector spawn MON_dogetout; }; //Function to do artillery //Parámeters: [_position,(_rounds,_area,_cadence,_mincadence)] // <- _position: center of fire create artillery // <- _rounds: rounds of fire // <- _area: Dispersion area // <- _maxcadence: Cadence of fire, is random between min // <- _mincadence: Minimum cadence // <- _bullet: class of bullet to fire, default ARTY_Sh_81_HE MON_artillery_dofire = { if (!isserver) exitWith {}; private ["_smoke1","_i","_area","_position","_maxcadence","_mincadence","_sleep","_rounds"]; _area = 150; _maxcadence = 10; _mincadence = 5; _sleep = 0; _rounds = 5; _bullet = "ARTY_Sh_81_HE"; _position =[]; //_bullet = "ARTY_Sh_105_HE"; //_bullet = "ARTY_Sh_122_HE"; _position = _this select 0; if ((count _this) > 1) then {_rounds = _this select 1;}; if ((count _this) > 2) then {_area = _this select 2;}; if ((count _this) > 3) then {_maxcadence = _this select 3;}; if ((count _this) > 4) then {_mincadence = _this select 4;}; if ((count _this) > 5) then {_bullet = _this select 5;}; _area2 = _area * 2; if (KRON_UPS_Debug>0) then {player globalchat format["artillery doing fire on %1",_position]}; for [{_i=0}, {_i<_rounds}, {_i=_i+1}] do { _sleep = random _maxcadence; if (_sleep < _mincadence) then {_sleep = _mincadence}; sleep _sleep; _smoke1 = _bullet createVehicle [(_position select 0)+ random _area2 - _area, (_position select 1)+ random _area2 - _area, (_position select 2)+ 20]; }; }; //Función que devuelve un array con los vehiculos terrestres más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_deadbodies = { private["_vehicles","_npc","_bodies","_OCercanos","_distance","_side"]; _npc = _this select 0; _distance = _this select 1; //_side = _this select 2; _OCercanos = []; _bodies = []; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Man"] , _distance]; { if (_npc knowsabout _x >0.5 && (!canmove _x || !alive _x)) then { _bodies = _bodies + [_x];}; }foreach _OCercanos; _bodies; }; //Función que devuelve un array con los vehiculos terrestres más cercanos //Parámeters: [_npc,_distance] // <- _npc: object for position search // <- _distance: max distance from npc // -> _vehicles: array of vehicles MON_nearestSoldiers = { private["_vehicles","_npc","_soldiers","_OCercanos","_distance","_side"]; _npc = _this select 0; _distance = _this select 1; if (isnull _npc) exitwith {}; _OCercanos = []; _soldiers = []; //Buscamos objetos cercanos _OCercanos = nearestObjects [_npc, ["Man"] , _distance]; _OCercanos = _OCercanos - [_npc]; { if ( alive _x && canmove _x ) then { _soldiers = _soldiers + [_x];}; }foreach _OCercanos; _soldiers; }; /* ===================================================================================================== MON_spawn.sqf Author: Monsada (chs.monsada@gmail.com) Comunidad Hispana de Simulación: http://www.simulacion-esp.com ===================================================================================================== Parámeters: [_artillery,(_range,_rounds,_area,_cadence,_mincadence)] execvm "scripts\UPSMON\MON_artillery_add.sqf"; <- _artillery object to attach artillery script, must be an object with gunner. <- ( _rounds ) rounds to fire each time, default 1 <- ( _range ) range of artillery, default 800 <- ( _area ) Dispersion area, 150m by default <- ( _maxcadence ) Cadence of fire, is random between min, default 10s <- ( _mincadence ) Minimum cadence, default 5s <- ( _bullet ) Class of bullet to fire, default ARTY_Sh_81_HE ===================================================================================================== 1. Place a static weapon on map. 2. Exec module in int of static weapon nul=[this] execVM "scripts\UPSMON\MON_artillery_add.sqf"; 1. Be sure static weapon has a gunner or place a "fortify" squad near, this will make squad to take static weapon. 2. Create a trigger in your mission for setting when to fire. Set side artillery variable to true: KRON_UPS_ARTILLERY_EAST_FIRE = true; This sample will do east artilleries to fire on known enemies position, when you want to stop fire set to false. For more info: http://dev-heaven.net/projects/upsmon/wiki/Artillery_module =====================================================================================================*/ if (!isserver) exitWith {}; //Waits until UPSMON is init waitUntil {!isNil("KRON_UPS_INIT")}; waitUntil {KRON_UPS_INIT==1}; private ["_artillery","_smoke1","_i","_area","_position","_maxcadence","_mincadence","_sleep","_rounds"]; _range = 800; _area = 150; _maxcadence = 10; _mincadence = 5; _sleep = 0; _rounds = 1; _bullet = "ARTY_Sh_81_HE"; _vector =[]; _artillery = _this select 0; //if (KRON_UPS_Debug>0) then {player globalchat format["MON_artillery_add before %1 %2 %3",isnull _artillery,alive _artillery]}; if (isnull _artillery || !alive _artillery) exitwith{}; if ((count _this) > 1) then {_rounds = _this select 1;}; if ((count _this) > 2) then {_range = _this select 2;}; if ((count _this) > 3) then {_area = _this select 3;}; if ((count _this) > 4) then {_maxcadence = _this select 4;}; if ((count _this) > 5) then {_mincadence = _this select 5;}; if ((count _this) > 6) then {_bullet = _this select 6;}; //Add artillery to array of artilleries _vector = [_artillery,_rounds,_range,_area,_maxcadence,_mincadence,_bullet]; if (isnil "KRON_UPS_ARTILLERY_UNITS" ) then {KRON_UPS_ARTILLERY_UNITS = []}; KRON_UPS_ARTILLERY_UNITS = KRON_UPS_ARTILLERY_UNITS + [_vector]; if (true) exitwith{}; /* ===================================================================================================== MON_spawn.sqf Author: Monsada (chs.monsada@gmail.com) Comunidad Hispana de Simulación: http://www.simulacion-esp.com ===================================================================================================== Parámeters: [Param1,Param2,Param3,[Param4]] EXECVM "SCRIPTS\UPSMON\MON_SPAWN.SQF"; <- Param1 Id of the template to copy. <- Param2 Position to create new squad. <- Param3 Nº of squads to create <- Param4 Array of parameters of UPSMON, first must be name of marc to patrol ===================================================================================================== Function that allows to spawn UPSMON squads. 1- create a squad in editor. Exec UPSMON and set TEMPLATE id, this will save members of squad, not equipement. nul = [this,"town","TEMPLATE:",1] execVM "scripts\upsmon.sqf"; 2- Exec MON_spawn on trigger or where you want telling the copy of the template to create and the position. nul = [1,[0,0,0],3,[mark, upsmon optional params]] EXECVM "SCRIPTS\UPSMON\MON_SPAWN.SQF"; =====================================================================================================*/ if (!isserver) exitWith {}; //Waits until UPSMON is init waitUntil {!isNil("KRON_UPS_INIT")}; waitUntil {KRON_UPS_INIT==1}; private ["_template","_position","_params","_copies","_membertypes","_unittype","_side","_UCthis","_initstr","_grp","_lead","_newunit","_i","_newpos","_vehicle","_initlstr"]; //Parameter reading _template = _this select 0; _position = _this select 1; _copies = _this select 2; _params = _this select 3; //Initialization _membertypes = []; _side = ""; _UCthis = []; _initstr = ""; _initlstr = ""; _grp = grpnull; _lead = objnull; _newunit = objnull; _newpos=[]; _vehicle=[]; //Gets parameters of UPSMON for [{_i=0},{_i0) then {player globalchat format["Spawning %3 copies of template %1",_template,_position,_copies,count KRON_UPS_TEMPLATES]}; //if (KRON_UPS_Debug>0) then {diag_log format["Spawning %3 copies of template %1 on %2 templates %4",_template,_position,_copies,count KRON_UPS_TEMPLATES]}; //Search if any template { if ((_x select 0) == _template) then { _side = _x select 1; _membertypes = _x select 2; _vehicletypes = _x select 3; //Gets leader type _unittype= _membertypes select 0; //if (KRON_UPS_Debug>0) then {player globalchat format["template %1:%2 ",_template,_membertypes]}; for [{_i=1},{_i<=_copies},{_i=_i+1}] do { // make the clones civilians // use random Civilian models for single unit groups if ((_unittype=="Civilian") && (count _members==1)) then {_rnd=1+round(random 20); if (_rnd>1) then {_unittype=format["Civilian%1",_rnd]}}; _grp=createGroup _side; _lead = _grp createUnit [_unittype, _position, [], 0, "form"]; _lead setVehicleInit _initlstr; [_lead] join _grp; _grp selectLeader _lead; sleep 1; // copy team members (skip the leader) _c=0; { _c=_c+1; if (_c>1) then { _newpos = _position findEmptyPosition [10, 200]; sleep .4; if (count _newpos <= 0) then {_newpos = _position}; _newunit = _grp createUnit [_x, _newpos, [],0,"form"]; _newunit setVehicleInit _initstr; [_newunit] join _grp; }; } foreach _membertypes; { _newpos = _position findEmptyPosition [10, 200]; sleep .4; if (count _newpos <= 0) then {_newpos = _position}; _newunit = _x createvehicle (_newpos); } foreach _vehicletypes; //Set new parameters _params = [_lead] + _UCthis; //Exec UPSMON script _params SPAWN UPSMON; processInitCommands; }; }; }foreach KRON_UPS_TEMPLATES; if (true) exitwith{}; // ========================================================================================================= // Script for adding the action of follow player. // Version: 1.0 // Author: Monsada (smirall@hotmail.com) // --------------------------------------------------------------------------------------------------------- private ["_side","_soldiers"]; _side = _this select 0; _soldiers = switch (_side) do { case west: {KRON_AllWest}; case east: {KRON_AllEast}; case resistance: {KRON_AllRes}; }; { if ( leader _x == _x ) then { _x addaction ["Order your men to follow me", "scripts\UPSMON\actions\followme.sqf", [], 1, false]; } else { _x addaction ["Follow me", "scripts\UPSMON\actions\followme.sqf", [], 1, false]; }; }foreach _soldiers; if (true) exitWith {}; [EN] === 5.1.0 ==================================================================================== Added: Modified: - Solved bug: parameter "random" does not work with vehicles. (r: by Lenestar) - Fix small bug with "ambush". Sometimes AI do not react to nearest target. - Small changes to the default numbers in Init_UPSMON.sqf === 5.0.9 ==================================================================================== Added: - "noveh" - the group will not search for vehicles (untill in fight and only for combat vehicles). (code improved by: Nordin) - Counter of civilians killed by players (array): KILLED_CIV_COUNTER [Total, by West, by East, by Resistance, the Killer] (works with civilians placed in editor or spawned by UPSMON) - When player kills a civilian display globalchat info WHO (Player) did it. In "Init_UPSMON.sqf" R_WHO_IS_CIV_KILLER_INFO = 1, Set O to disable this feature. - Add UPSMON version info in DEBUG display. Modified: - CBA is NOT required any more ! - Turning off ACE Wounds is now optional. (see Init_UPSMON.sqf to set it ON or OFF) - Solved bug: Self wounds or friendly fire is treated as damages made by the enemy forces. (NOTE: If the killer is not recognize, AI will use smoke) - Solved bug: MON_HeliStuckcontrol runs too often as bad speed read. - Improved: Combat behaviour (now in close distance AI often in COMBAT mode) - Improved: Stuck control for vehicles and units. - Improved: Respawn for vehicles (multiple times vehicle respawn allowed) - First parameter coud be Unit or Group. (Make sure when the script starts such GROUP's leader or the UNIT is present 100%). - Improved Artillery module (code improved by: shay_gman) http://dev-heaven.net/projects/upsmon/wiki/Artillery_module - Change: armor vehicles using limited speed no matter range when placed directly from editor with default crew. Now the speed depends on the distance to the new targetpos (r.by Demonized) - Fixed small code bugs: ex: {exit=true;}; should be: {_exit=true;}; - Solved bug: Respawn for vehicles not working. (r.by Demonized) - Solved bug 99%: reinforcement AI after getting out of the combat vehicle, often the vehicle did not move. (r.by seba1976) Misc: - HMMWV_M998A2_SOV_DES_EP1 added to bugged vehicles for Vanilia players. http://dev-heaven.net/issues/18314 ============================================================================================ === 5.0.8 ================================================================================ Added: CBA is now required !!! UPSMON switches off "ACE wounds system for AI". "nosmoke" - the group will not use the smoke at all. "onroad" - targetpos will be generated only on roads (unless unit in fight). Civilians do not take vehicles or static weapons (no more stealing). Modified: New targetpos depend on the type of the unit (air, water, land) - (water unit only on water etc) Detection of new target/(generate new target) is longer just a bit. (R_knowsAboutEnemy) AI use smokes when s/o hit or KIA. (R_USE_SMOKE_wounded, R_USE_SMOKE_killed). Solved bug: AI reinforcement have problem to get into helicopters. Solved bug: group "nowp" have problem to generate target when no other groups around Solved bug: AI do not paradrop around positions of the enemy. (stuck) Solved bug: Helicopters paradrop and fly too low. =============================================================================================== // ----------------------------------------------------------------------------- //Version: 5.0.6 // ----------------------------------------------------------------------------- // Added: // Parameter "RESPAWN" for alowing respawn UPSMON squads when all are dead // "aware","combat","stealth" and "careless" added as a parameter so you can define default behaviour of squad // Added AI stuff for water // AI aware if find dead bodies // Added fixed positions for reinforcement squads, those squads that have a reinforcement ID can be set reinforcement position by seting KRON_UPS_reinforcement"x"_pos = position; sample // reinforcement: http://dev-heaven.net/projects/upsmon/wiki/Reinforcement // Added Artillery module: http://dev-heaven.net/projects/upsmon/wiki/Artillery_module // Added spawn module: http://dev-heaven.net/projects/upsmon/wiki/MON_spawn // Modified: // Solved bug in SPAWNED that not refreshed correctly army counters // If in walk mode and safe will land hely. // When Hely in squad column formation can not be used, last member assigned as driver // Detected bug with VEE formation, some times AI don't change vehaviour, changed to wedge // Folder estructure modified to gather upsmon scripts this will no affect already missions. // Improved AI response under Supress fire in combat situation // Avoid hurt soldiers than can not stand to get in vehicles and buildings // Avoid to patrol in damaged buildings // avoid bugged clases such as "BIS_alice_emptydoor"; // AI try to get in combat vehicles // Performance optimization. // Realistic reaction of squads depending on distance to target // ----------------------------------------------------------------------------- //Version: 5.0.5 // ----------------------------------------------------------------------------- // Added // Parameter "AMBUSH:",3000 you can set max time to wait for ambush // Modified: // Ambush squads exits if called for reinforcement so you can force exit creating a especific reinforcement group for this ex: setting "reinforcement:",100 // you can force exit ambush setting KRON_UPS_reinforcement100 = true // you can put 0 seconds for putting mines and go away if combined with "move" for example // Solved bug that sets reinforcement to false on init of scritp // Improved getout and landheli algoritm // Improved target debug console A=all units C=current alive units T=targets knonw by this side // Improved movement with vehicles, now they go in safe until near known enemies // adjusted flanking algorithm // ----------------------------------------------------------------------------- //Version: 5.0.4 // Added // Implemented: It also would be great if they use smoke-grenades when ai is under fire by targets they dont see well. One example: I lay on a moutain with my squad and shoot with sniperrifles from the hill down at the ai in a village. The ai should throw smoke and try to get cover. That would be great. // Feature #9559: parameter "spawned" = use only with squads created in runtime, this feature will add squad to UPSMON correctly. // Feature #9558 parameter "nowp" = No waypoints will be created for this squad, so this squad will comunicate enemies but will not be moved, so you can do what you want with them using waypoints. // Feature #9503 parameter "ambush" = Ambush squad will not move until in combat, will wait for incoming enemies stealth and ambush when near or discovered. // Parameter "RFLOCK", if especified when reinforcement is called, target position is locked until reached reinforcement point // Added surrended client control so now is no necesary create any trigger in mission to launch surrended.sqf // Added stuck control to avoid that helis stopping flying // New target sistem control based in last known positions instead of real position of targets // Modified: // Bug #9666 fixed:AI Cheats with UPSMON - Groups always Flank Real Position instead of last known // Bug #9662 fixed: Reinforcement Group returning home, does not get out of Vehicles (if used) // Bug #9639 fixed: Reinforcement Group can get stuck if Transportvehicle back to Patrolmarker gets destroyed// // Set DIAMOND formation when exiting vehicle // bug with NOSLOW solved. // solved other bugs such as no patrol without enemies. // --------------------------------------------------------------------------------------------------------- //Version: 5.0.3 // Added // KRON_UPS_searchVehicledist = 800 // KRON_UPS_EAST_SURRENDER, KRON_UPS_WEST_SURRENDER,KRON_UPS_GUER_SURRENDER // Set percentaje of forces for surrender. // Main control for all squads, doing comon proceses and saving performance. // sample followme.sqf script for enabling AI surrended to join your squad, must // be executed in each client when KRON_UPS_EAST_SURRENDED or KRON_UPS_WEST_SURRENDED // or KRON_UPS_GUER_SURRENDED // Modified: // Fixed Bug with resistance forces detected as enemies when not parametriced as enemy // Fixed bug check if dead leader before moving. // Fixed bug, "alive" not always returns someone is dead instanctly so controlled with canmove. // Fixed bug, error _vehicle object expected. // Controled not doing paradroop on water. //------------------------------------------------------------------------------------------------------------- //Version: 5.0.2 // Added // KRON_UPS_useStatics, enables AI to use Static weapons. // KRON_UPS_useMines, enables AI to put mines when enemy armored vehicles near // Now vehicles can be used for patrol, not only with target. // Modified: // Fixed Bug that do not sent reinforcement if parameter "reinforcement" // Fixed bug with random 1 ocasiolly has been returned more than 1. // Fixed bug that eventually do not change dead leader //------------------------------------------------------------------------------------------------------------- //Version: 5.0.1 // Added // Mulitiple reinforcement reinforcement:x, now you can put an id of reinforcement for calling only this groups later: // nul=[this,"town", "move","reinforcement:",1, "delete:",600] execVM "scripts\upsmon.sqf"; // nul=[this,"town", "move","reinforcement:",2, "delete:",600] execVM "scripts\upsmon.sqf"; // Modified: // Fixed fortify squads don't get defence positions until known enemys // Fortify squads leave fortify status when called for reinforcement // --------------------------------------------------------------------------------------------------------- //Version: 5.0.0 // Added // KRON_UPS_flyInHeight: Height that heli will fly this input will be randomiced in a 10% // KRON_UPS_paradropdist: Max distance to target for doing paradrop, will be randomiced between 0 and 100% of this value. // parameter "fortify" makes leader order to take positions on nearly buildings at distance 100 meters near leader, // squads with fortify will ignore "MOVE" rol. // Modified: // Fixed bug that eventually stoped hely when paradrops done. // --------------------------------------------------------------------------------------------------------- //Version: 4.2.6 // Added // // Modified: // Fixed bug that leaves a soldier in front of vehicle afte geting out. // Fixed bug that allowed AI to disenbark from heli before arriving objective. //------------------------------------------------------------------------------------------------------------- //Version: 4.2.5 // Added // Air transport // Paratroop air transported units // Improved comunications // Modificaciones: // Updated for an action radio of 1000 meters or avove. // Added some translations to english //------------------------------------------------------------------------------------------------------------- //Version: 4.2.2 // Added // Se ha añadido ataque frontal // Formaciones de combate en función de la situación // La IA puede entrar en los edificios a tomar posiciones de defensa y en ataque puede patrullarlos en busca de enemigos o posiciones de fuego. // Modificaciones: // Mejorado el sistema para localizar, asignar y entrar en vehiculos,. // Optimizado el rendimiento. Se ha mejorado para que se pueda ejecutar cada 20s. // Modificada la parametrización, sharedist incrementado, react reducido, cycle aumentado. // Modificada la actitud e la IA en combate, se ha dado más especialización en función de la situación. // Corregido bug que al enviar refuerzos hacía que dejaran de patrullar si no tenian ningún target // Posiciones de flanqueo más dinámicas. // Las escuadras con rol "NOMOVE" tienden a asegurar la posición y a hacer mayor uso de los edificios del entorno. //------------------------------------------------------------------------------------------------------------- //Version: 4.1.3 // // Modificaciones: // corregidos los problemas al entrar en vehiculos, que hacía que casi siempre alguno se quedara fuera // Optimizado el rendimiento. // Modificada la actitud e la IA en combate, se ha dado más especialización en función de la situación. // //------------------------------------------------------------------------------------------------------------- //Version: 4.1.2 // // Modificaciones: // KRON_UPS_Maxwaiting pasa a ser una variable excluvia para patrullas, indica el tiempo máximo a esperar // para llegar al destino y buscar otro //------------------------------------------------------------------------------------------------------------- //Version: 4.1.0 // Added // Habilitado búsqueda y uso de vehículos de transporte, cuando la IA está lejos del objetivo busca vehiculos con capacidad cerca, ahora ya puedes definir tu base con vehiculos, que si la IA los necesita los coge. // // Modificaciones: // Adaptadas ciertas partes de código para ser usadas en modo multihilo, mejorando los resultados y el rendimiento en general. //------------------------------------------------------------------------------------------------------------- //Version: 4.0.0 // Added // Control de movimiento de la IA, ahora gestionan mejor los tiempos, hacen coverturas de movimiento, avanzan con más precaución cuando están cerca del enemigo. // Añadidas algunas animaciones para darle pinceladas de dramatismo a los movimientos de la IA // // Modificaciones: // Modificación control de detección de movimientos de otros grupos ahora no requiere la lectura de objetos, con lo que mejora el rendimiento. // Adaptado sistema de scripts para poder controlar los grupos de IA y añadir mejoras que requieran la interacción de los grupos. //------------------------------------------------------------------------------- //Version: 3.0.8 // Modificaciones: // Corregido el bug de los buildings, se ha vuelto a implementar el uso de edificios // Mejorada la velocidad de iniciación del script. //------------------------------------------------------------------------------------------------------------- //Version: 3.0.7 // Added // // Modificaciones: // Corregido bud que en dedicado fijaba el objetivo siempre en lugar de los flancos //------------------------------------------------------------------------------------------------------------- //Version: 3.0.6 // Added // // Modificaciones // Corregidos bugs varios, entre ellos uno que ralentizaba la acción de los grupos // Set de parámetros modificados para un comportamiento más óptimo y realista // deshabilitado KRON_UPS_intowndist por comportamientos extraños con algunos objetos builiding // Ahora la IA selecciona los caminos con más cobertura, a ser posible //------------------------------------------------------------------------------------------------------------- //Version: 3.0.5 // Added // // Modificaciones // Corregido bug que evitaba enviar los refuerzos // La distancia de comunicación de objetivos aumenta en función del rol, los nomove * 1.5 // //------------------------------------------------------------------------------------------------------------- //Version: 3.0.4 // Added // Añadidos parámetros para asignar enemigos y aliados a la resistencia // Añadido control anti snipers, si la IA se ve atacada y no sabe de donde se mueve de sitio // Modificaciones // Se ajusta el ángulo de flanqueo en función de la distancia al objetivo // //------------------------------------------------------------------------------------------------------------- // // Modified: Monsada (SMM) 03.11.2009 //Version: 3.0.3 // Added // Multiple targets, now IA can have multiple open targets // La IA ahora usa tamien los edificios para buscar enemigos, protegerse dentro o atacar desde allí. // Modificaciones // La IA pierde el objetivo si lo pierde de vista y está a más de la distancia KRON_UPS_sharedist // //------------------------------------------------------------------------------------------------------------- //Version: 3.0.2 // Added // Se ha añadido la opción de Refuerzos, ahora se pueden definir unas unidades de refuerzos alejados de la zona que se enviarán al detectar enemigos enemigos // si KRON_UPS_reinforcement es true, se puede usar un marcador a modo de alarma para alimentar esta variable cuando se desee. // Las unidades tendrán una predisposición a mantener la posición si tienen el rol NOMOVE // Modificaciones // Se ha corregido la formula par definir los puntos de flanqueo tx = sin x * dist * (signo cos x). // Las unidades con rol NOMOVE tienden a mantener la posición cuanto más alejados estén del enemigo // Se ha mejorado el rendimiento. // //------------------------------------------------------------------------------------------------------------- //Version: 3.0.1 // Added // Sistema de combate urbano. La Ia ajusta el flanjeo y sus movimientos al tipo de superficie. // Modificaciones // Ahora los pelotones verifican la presencia de aliados para determinar otras rutas de flanqueo. // Se ha substituido el algoritmo de determinación de posiciones de flanqueo por un bug con las funciones cos y sin // que retornan aleatoriamente valores positivos o negativos con el mismo ángulo. // //------------------------------------------------------------------------------------------------------------- // Version: 3.0.0 // Added: // Improved IA flanking possitions // Improved IA movements in combat // Now IA can be supressed by fire // IA may use smoke grenades when in fire // Improved performance (this script now runs every 15s and do not need to stress to 1 second) // Implemented comunications simulating radio to know enemy position //Errores corregidos y modificaciones // Corregida la función KRON_distancePosSqr que no devolvia la distancia correcta entre dos puntos // Corregido bug que no alimentaba correctamente el objetivocompartido cuando este fallecia // Corregido control de la distancia al objetivo que hacia que la IA no flanquera // Algoritmo de control de acción y movimiento modificado // ======================================================================================================================================================================================================== KNOWN PROBLEMS: 1) Pilots are very stupid if they have to land, sometimes they crash the helicopter (trees). 2) Sometimes a vehicle stops and wait for something (driver switches off the engine)? In the end (~2min) stuck control makes it move but I do not know if the problem is UPSMON or Arma. Difficult to reproduce cause it happens at random times and very rarely. Expecialy when reinforcement AI use combat vehicle. Possible explanation: targetpos in the forest, AI lost the way, no radio contact etc :) 3) Too much smoke might cause drop in Fps. (change parameters: R_USE_SMOKE_wounded = 13; R_USE_SMOKE_killed = 35;) =============================================================================================== HINTS & TIPS : ------------------- 0) To get rid of the debug information set (in Init_UPSMON.sqf) KRON_UPS_Debug = 0; ------------------- 1) note for MissionMakers : UPSMON patrol vehicles after some time use up all fuel and stop. Use a script to refuel the vehicles. ------------------ 2) - Hide area markers before briefing. - create Game Logic Object put in initialization field: nul = call compile preprocessFile "scripts\UPSMON\!R\markerAlpha.sqf"; (all markers area must be named area0, area1...area13) ------------------ 3) If you use civilians, always set their skill to 0 (save CPU). ------------------ 4) in init.sqf do not use: if (isServer) then { //Init UPSMON scritp call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; }; use: //Init UPSMON scritp call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; as Init_UPSMON.sqf has got part of the code which should be run on all clients. ---------------- 5) If you fight on the small area think about lowering the "KRON_UPS_sharedist". example: If the fight area is a town (600x600) and "KRON_UPS_sharedist = 700;", in the moment you are spotted at the edge of the town all AI units in the 700m from you gets info about your position, and if they are not busy you can expect attack of all units. 6) Only one init per Group, if you init in the unit INIT (make sure this unit is 100% possibility of present) 7) if the leader is vehicle -> the group follows the vehicle (fast), if the leader is outside vehicle -> the vehicle follow the foot leader. (slow) 8) to count civilians killed by players use (array): KILLED_CIV_COUNTER [Total,by West,by East,by Resistance, the Killer] example: total_number_civilians_killed_by_any_players = KILLED_CIV_COUNTER select 0; number_civilians_killed_by_any_east_players = KILLED_CIV_COUNTER select 2; the_killer = KILLED_CIV_COUNTER select 4; (Note: if the player becomes ENEMY to all is not side anymore. Kills by ENEMY are only counted in Total) ================================================================================================ Hello UPSMON users, I'm currently run the project but I'm not very good at creating new function to the UPSMON as I'm not good script writer. I feel much better as a person who can adjust existing code to work with UPSMON well. 95% of the functions in UPSMON were there (created by Kronzky or Monsada). I just make some of them work more smooth, and fixed some bugs. The aim is reliability, performance and make all end user friendly. So if you found a bug or had improved part of the code... let me know. Any new code that could make UPSMON runs better or add new functions is very welcome. :) forum: http://forums.bistudio.com/showthread.php?t=91696 report bug: http://dev-heaven.net/projects/upsmon/issues (do not forget to attach simple mission to reproduce problem) Thank you !R// ========================================================================================================= // UPSMON - Urban Patrol Script Mon // Version: 5.0.7 // Author: Monsada (chs.monsada@gmail.com) // Comunidad Hispana de Simulación: // http://www.simulacion-esp.com // // Wiki: http://dev-heaven.net/projects/upsmon/wiki // Forum: http://forums.bistudio.com/showthread.php?t=91696 // Share your missions with upsmon: http://dev-heaven.net/projects/upsmon/boards/86 // --------------------------------------------------------------------------------------------------------- // Based on Urban Patrol Script // Version: 2.0.3 // Author: Kronzky (www.kronzky.info / kronzky@gmail.com) // --------------------------------------------------------------------------------------------------------- // Required parameters: // unit = Unit to patrol area (1st argument) // markername = Name of marker that covers the active area. (2nd argument) // // Patrol squad samples: // nul=[this,"town"] execVM "upsmon.sqf"; // // defensive squad samples: // nul=[this,"town","nomove"] execVM "scripts\upsmon.sqf"; // // Optional parameters: _ // random = Place unit at random start position. // randomdn = Only use random positions on ground level. // randomup = Only use random positions at top building positions. // min:n/max:n = Create a random number (between min and max) of 'clones'. // init:string = Custom init string for created clones. // nomove = Unit will stay at start position until enemy is spotted. // nofollow = Unit will only follow an enemy within the marker area. // delete:n = Delete dead units after 'n' seconds. // nowait = Do not wait at patrol end points. // noslow = Keep default behaviour of unit (don't change to "safe" and "limited"). // noai = Don't use enhanced AI for evasive and flanking maneuvers. // showmarker = Display the area marker. // trigger = Display a message when no more units are left in sector. // empty:n = Consider area empty, even if 'n' units are left. // track = Display a position and destination marker for each unit. // reinforcement = Makes squad as reinforcement, when alarm KRON_UPS_reinforcement==true this squad will go where enemy were. // reinforcement:x = Makes squad as reinforcement id, when alarm KRON_UPS_reinforcementx==true this squad will go where enemy were. // fortify = makes leader order to take positions on nearly buildings at distance 200 meters, squad fortified moves less than "nomove" // spawned = use only with squads created in runtime, this feature will add squad to UPSMON correctly. // nowp = No waypoints will be created for this squad UNTIL ENEMY DETECTED, this squad will comunicate enemies but will not be moved by UPSMON until enemy detected, after that upsmon takes control of squad // nowp2 = No waypoints will be created for this squad UNTIL ENEMY DETECTED and damaged, this squad will comunicate enemies but will not be moved by UPSMON until enemy detected and damaged, after that upsmon takes control of squad // nowp3 = No waypoints will be created for this squad in any way, this squad will comunicate enemies but will not be moved by UPSMON. // ambush = Ambush squad will not move until in combat, will lay mines if enabled and wait for incoming enemies stealth and ambush when near or discovered. // ambush2 = Ambush squad will not move until in combat, will NOT LAY MINES and wait for incoming enemies stealth and ambush when near or discovered. // ambush:n = Creates an anbush and wait maximun the especified time n in seconds. you can put 0 seconds for putting mines and go away if combined with "move" for example // ambush2:n = Same as ambush:n but without laying mines. // aware,combat,stealth,careless defines default behaviour of squad // respawn = allow squad to respawn when all members are dead and no targets near // respawn:x = allows to define the number of times squad may respawn. // ----------------------------------------------------------------------------- // Modified: 08.04.2010 // ----------------------------------------------------------------------------- // Changes in version: // ----------------------------------------------------------------------------- // Added: // nowp = No waypoints will be created for this squad UNTIL ENEMY DETECTED // nowp2 = No waypoints will be created for this squad UNTIL ENEMY DETECTED AND DAMAGED // nowp3 = No waypoints will be created for this squad in any way. // Ambush2 Same as ambush but without using mines // Added spawn support for vehicles in squad // Modified: // FORTIFY moves leader too and prevents from moving when hurt // Solved bug in targetting of resistance // Solved bug when respawning a template squad were creating a new template // Solved bug that did exiting AI form vehicle when upsmon begins // Solved bug of squads loosing group and gets stucked // Avoid to take same position on buildings // Solved bug in control of heli // ----------------------------------------------------------------------------- if (!isServer) exitWith {}; // ----------------------------------------------------------------------------- if (isNil("KRON_UPS_INIT")) then { KRON_UPS_INIT=0; }; waitUntil {KRON_UPS_INIT==1}; // convert argument list to uppercase _UCthis = []; for [{_i=0},{_i0) then {player sidechat format["%1: New instance",_grpidx,_npc getVariable ("UPSMON_grpid")]}; //Is ACE mod installed and loaded? //_ace = isClass(configFile >> "CfgPatches" >> "ace_main"); //Did ACE scripting start? //if (KRON_UPS_Debug>0) then {player sidechat format["_ACE=%1 ACE=%2",_ace,!(isNil "ace_main")]}; // get name of area marker _areamarker = _this select 1; if (isNil ("_areamarker")) exitWith { hint "UPS: Area marker not defined.\n(Typo, or name not enclosed in quotation marks?)"; }; // remember center position of area marker _centerpos = getMarkerPos _areamarker; _centerX = abs(_centerpos select 0); _centerY = abs(_centerpos select 1); _centerpos = [_centerX,_centerY]; // show area marker _showmarker = if ("SHOWMARKER" in _UCthis) then {"SHOWMARKER"} else {"HIDEMARKER"}; if (_showmarker=="HIDEMARKER") then { //_areamarker setMarkerCondition "false"; // VBS2 _areamarker setMarkerPos [-abs(_centerX),-abs(_centerY)]; }; // is anybody alive in the group? _exit = true; if (typename _npc=="OBJECT") then { if (!isnull group _npc) then { _npc = [_npc,units (group _npc)] call MON_getleader; }else{ _vehicles = [_npc,2] call MON_nearestSoldiers; if (count _vehicles>0) then { _npc = [_vehicles select 0,units (_vehicles select 0)] call MON_getleader; }; }; } else { if (count _obj>0) then { _npc = [_obj,count _obj] call MON_getleader; }; }; if (!(_npc iskindof "Man")) then { if (!isnull(commander _npc) ) then { _npc = commander _npc; }else{ if (!isnull(driver _npc) ) then { _npc = driver _npc; }else{ _npc = gunner _npc; }; }; group _npc selectLeader _npc; }; if (alive _npc) then {_exit = false;}; if (KRON_UPS_Debug>0 && _exit) then {player sidechat format["%1 There is no alive members %1 %2 %3",_grpidx,typename _npc,typeof _npc, count units _npc]}; // exit if something went wrong during initialization (or if unit is on roof) if (_exit) exitWith { if (KRON_UPS_DEBUG>0) then {hint "Initialization aborted"}; }; // remember the original group members, so we can later find a new leader, in case he dies _members = units _npc; KRON_UPS_Total = KRON_UPS_Total + (count _members); //Fills member soldier types _vehicles = []; { if (vehicle _x != _x ) then { _vehicles = _vehicles - [vehicle _x]; _vehicles = _vehicles + [vehicle _x]; }; _membertypes = _membertypes + [typeof _x]; }foreach _members; //Fills member vehicle types { _vehicletypes = _vehicletypes + [typeof _x]; }foreach _vehicles; // what type of "vehicle" is unit ? _isman = "Man" countType [_npc]>0; _iscar = "LandVehicle" countType [_npc]>0; _isboat = "Ship" countType [_npc]>0; _isplane = "Air" countType [_npc]>0; // we just have to brute-force it for now, and declare *everyone* an enemy who isn't a civilian _issoldier = _side != civilian; _friends=[]; _enemies=[]; _sharedenemy=0; if (_issoldier) then { switch (_side) do { case west: { _sharedenemy=0; _friendside = [west]; _enemyside = [east]; }; case east: { _sharedenemy=1; _friendside = [east]; _enemyside = [west]; }; case resistance: { _sharedenemy=2; _enemyside = KRON_UPS_Res_enemy; if (!(east in _enemyside)) then { _friendside = [east]; }; if (!(west in _enemyside)) then { _friendside = [west]; }; }; }; }; if (_side in KRON_UPS_Res_enemy) then { _enemyside = _enemyside + [resistance]; }else { _friendside = _friendside + [resistance]; }; sleep .05; //Sets min units alive for surrender _surrender = call (compile format ["KRON_UPS_%1_SURRENDER",_side]); // Tanks friendlys are contabiliced { if ( side _x in _friendside && ( _x iskindof "Tank" || _x iskindof "Wheeled_APC" )) then { _friendlytanks = _friendlytanks + [_x]; }; }foreach vehicles; // global unit variable to externally influence script //call compile format ["KRON_UPS_%1=1",_npcname]; // X/Y range of target area _areasize = getMarkerSize _areamarker; _rangeX = _areasize select 0; _rangeY = _areasize select 1; _area = abs((_rangeX * _rangeY) ^ 0.5); // marker orientation (needed as negative value!) _areadir = (markerDir _areamarker) * -1; // store some trig calculations _cosdir=cos(_areadir); _sindir=sin(_areadir); // minimum distance of new target position _mindist=(_rangeX^2+_rangeY^2)/3; if (_rangeX==0) exitWith { hint format["UPS: Cannot patrol Sector: %1\nArea Marker doesn't exist",_areamarker]; }; //hint format["%1,%2,%3,%4",_areamarker,isNil ("_areamarker"),_rangeX,_rangeY]; // remember the original mode & speed _orgMode = behaviour _npc; _orgSpeed = speedmode _npc; // set first target to current position (so we'll generate a new one right away) _currPos = getpos _npc; _orgPos = _currPos; _orgDir = getDir _npc; _orgWatch=[_currPos,50,_orgDir] call KRON_relPos; _lastpos = _currPos; _avoidPos = [0,0]; _flankPos = [0,0]; _attackPos = [0,0]; _newattackPos = [0,0]; _fixedtargetpos = [0,0]; _frontPos = [0,0]; _dirf1 = 0;_dirf2=0;_flankPos2=[0,0]; _dist = 10000; _lastdist = 0; _lastmove1 = 0; _lastmove2 = 0; _maxmove=0; _moved=0; _damm=0; _dammchg=0; _lastdamm = 0; _timeontarget = 0; _fightmode = "walk"; _fm=0; _gothit = false; _pursue=false; _hitPos=[0,0,0]; _react = 0; _lastdamage = 0; _lastknown = 0; _opfknowval = 0; _sin0=1; _sin90=1; _cos90=0; _sin270=-1; _cos270=0; _targetX =0; _targetY=0; _relTX=0;_relTY=0; _relUX=0;_relUY=0; _supressed = false; _flankdist=0; _nBuilding=nil; _nBuildingt =nil; _speedmode="Limited"; _distnbuid = 0; _distnbuidt = 0; _objsflankPos1 = []; _cntobjs1 = 0; _objsflankPos2 = []; _cntobjs2 = 0; _targettext =""; _dir1 =0;_dir2=0;_dir3=0;_dd=0; _timeontarget=0; _newdamage =0; _reinforcement =""; _reinforcementsent = false; _target = objnull; _newtarget=objnull; _flankdir=0; //1 tendencia a flankpos1, 2 tendencia a flankpos2 _prov=0; _targets=[]; _planta=0; //Indice de plantas en edificios _newflankAngle = 0; _closeenough = KRON_UPS_closeenough; _gunner = objnull; _driver = objnull; _fortify = false; _buildingdist= 60;//Distance to search buildings near _Behaviour = "CARELESS"; _grp = grpnull; _grp = group _npc; _template = 0; _nowpType = 1; _ambushtype = 1; // set target tolerance high for choppers & planes if (_isplane) then {_closeenough=KRON_UPS_closeenough * 2}; // ***************************************** optional arguments ***************************************** // wait at patrol end points _pause = if ("NOWAIT" in _UCthis) then {"NOWAIT"} else {"WAIT"}; // don't move until an enemy is spotted _nomove = if ("NOMOVE" in _UCthis) then {"NOMOVE"} else {"MOVE"}; //fortify group in near places _fortify= if ("FORTIFY" in _UCthis) then {true} else {false}; _fortifyorig = _fortify; if (_fortify) then { _nomove="NOMOVE"; _minreact = KRON_UPS_minreact * 3; _buildingdist = _buildingdist * 2; _makenewtarget = true; _wait = 3000; }; // don't follow outside of marker area _nowp = if ("NOWP" in _UCthis) then {true} else {false}; _nowp = if ("NOWP2" in _UCthis) then {true} else {_nowp}; _nowp = if ("NOWP3" in _UCthis) then {true} else {_nowp}; _nowpType = if ("NOWP2" in _UCthis) then {2} else {_nowpType}; _nowpType = if ("NOWP3" in _UCthis) then {3} else {_nowpType}; _orignowp = _nowp; //Ambush squad will no move until in combat or so close enemy _ambush= if ("AMBUSH" in _UCthis) then {true} else {false}; _ambush= if ("AMBUSH:" in _UCthis) then {true} else {_ambush}; _ambush= if ("AMBUSH2" in _UCthis) then {true} else {_ambush}; _ambushwait = ["AMBUSH:",_ambushwait,_UCthis] call KRON_UPSgetArg; _ambushwait = ["AMBUSH2:",_ambushwait,_UCthis] call KRON_UPSgetArg; _ambushType = if ("AMBUSH2" in _UCthis) then {2} else {_ambushType}; _ambushType = if ("AMBUSH2:" in _UCthis) then {2} else {_ambushType}; // don't follow outside of marker area _respawn = if ("RESPAWN" in _UCthis) then {true} else {false}; _respawn = if ("RESPAWN:" in _UCthis) then {true} else {_respawn}; _respawnmax = ["RESPAWN:",_respawnmax,_UCthis] call KRON_UPSgetArg; if (!_respawn) then {_respawnmax = 0}; // any init strings? _initstr = ["INIT:","",_UCthis] call KRON_UPSgetArg; // don't follow outside of marker area _nofollow = if ("NOFOLLOW" in _UCthis) then {"NOFOLLOW"} else {"FOLLOW"}; // share enemy info _shareinfo = if ("NOSHARE" in _UCthis) then {"NOSHARE"} else {"SHARE"}; // "area cleared" trigger activator _areatrigger = if ("TRIGGER" in _UCthis) then {"TRIGGER"} else {if ("NOTRIGGER" in _UCthis) then {"NOTRIGGER"} else {"SILENTTRIGGER"}}; // suppress fight behaviour if ("NOAI" in _UCthis) then {_issoldier=false}; // adjust cycle delay _cycle = ["CYCLE:",KRON_UPS_Cycle,_UCthis] call KRON_UPSgetArg; _currcycle=_cycle; //spawned for squads createds in runtime _spawned= if ("SPAWNED" in _UCthis) then {true} else {false}; if (_spawned) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1: squad has been spawned, respawns %2",_grpidx,_respawnmax]}; switch (side _npc) do { case west: { KRON_AllWest=KRON_AllWest + units _npc; }; case east: { KRON_AllEast=KRON_AllEast + units _npc; }; case resistance: { KRON_AllRes=KRON_AllRes + units _npc; if (east in KRON_UPS_Res_enemy ) then { KRON_UPS_East_enemies = KRON_UPS_East_enemies+units _npc; } else { KRON_UPS_East_friends = KRON_UPS_East_friends+units _npc; }; if (west in KRON_UPS_Res_enemy ) then { KRON_UPS_West_enemies = KRON_UPS_West_enemies+units _npc; } else { KRON_UPS_West_friends = KRON_UPS_West_friends+units _npc; }; }; }; call (compile format ["KRON_UPS_%1_Total = KRON_UPS_%1_Total + count (units _npc)",side _npc]); }; // drop units at random positions _initpos = "ORIGINAL"; if ("RANDOM" in _UCthis) then {_initpos = "RANDOM"}; if ("RANDOMUP" in _UCthis) then {_initpos = "RANDOMUP"}; if ("RANDOMDN" in _UCthis) then {_initpos = "RANDOMDN"}; // don't position groups or vehicles on rooftops if ((_initpos!="ORIGINAL") && ((!_isman) || (count _members)>1)) then {_initpos="RANDOMDN"}; // set behaviour modes (or not) _orgMode = "SAFE"; if ("CARELESS" in _UCthis) then {_orgMode = "CARELESS"}; if ("AWARE" in _UCthis) then {_orgMode = "AWARE"}; if ("COMBAT" in _UCthis) then {_orgMode = "COMBAT"}; if ("STEALTH" in _UCthis) then {_orgMode = "STEALTH"}; _Behaviour = _orgMode; _npc setbehaviour _Behaviour; //Sets initial speed _noslow = if ("NOSLOW" in _UCthis) then {"NOSLOW"} else {"SLOW"}; if (_noslow!="NOSLOW") then { _orgSpeed = "limited"; } else { _orgSpeed = "FULL"; }; _speedmode = _orgSpeed; _npc setspeedmode _speedmode; // If enemy detected reinforcements will be sent _reinforcement= if ("REINFORCEMENT" in _UCthis) then {"REINFORCEMENT"} else {"NOREINFORCEMENT"}; _rfid = ["REINFORCEMENT:",0,_UCthis] call KRON_UPSgetArg; if (_rfid>0) then { _reinforcement="REINFORCEMENT"; //if (KRON_UPS_Debug>0) then {hintsilent format["%1: reinforcement group %2",_grpidx,_rfid,_rfidcalled,_reinforcement]}; }; //Is a template for spawn module? _template = ["TEMPLATE:",_template,_UCthis] call KRON_UPSgetArg; //Fills template array for spawn if (_template > 0 && !_spawned) then { KRON_UPS_TEMPLATES = KRON_UPS_TEMPLATES + ( [[_template]+[_side]+[_membertypes]+[_vehicletypes]] ); //if (KRON_UPS_Debug>0) then {diag_log format["%1 Adding TEMPLATE %2 _spawned %3",_grpidx,_template,_spawned]}; //if (KRON_UPS_Debug>0) then {player globalchat format["KRON_UPS_TEMPLATES %1",count KRON_UPS_TEMPLATES]}; }; // make start position random if (_initpos!="ORIGINAL") then { // find a random position (try a max of 20 positions) _try=0; _bld=0; _bldpos=0; while {_try<20} do { _currPos=[_centerX,_centerY,_rangeX,_rangeY,_cosdir,_sindir,_areadir] call KRON_randomPos; _posinfo=[_currPos] call KRON_PosInfo3; // _posinfo: [0,0]=no house near, [obj,-1]=house near, but no roof positions, [obj,pos]=house near, with roof pos _bld=_posinfo select 0; _bldpos=_posinfo select 1; if (_isplane || _isboat || !(surfaceiswater _currPos)) then { if (((_initpos=="RANDOM") || (_initpos=="RANDOMUP")) && (_bldpos>0)) then {_try=99}; if (((_initpos=="RANDOM") || (_initpos=="RANDOMDN")) && (_bldpos==0)) then {_try=99}; }; _try=_try+1; //sleep .05; }; if (_bldpos==0) then { if (_isman) then { {_x setpos _currPos} foreach units _npc; } else { _npc setpos _currPos; }; } else { // put the unit on top of a building _npc setPos (_bld buildingPos _bldpos); _currPos = getPos _npc; _nowp=true; // don't move if on roof }; sleep .05; }; // track unit _track = if (("TRACK" in _UCthis) || (KRON_UPS_Debug>0)) then {"TRACK"} else {"NOTRACK"}; _trackername = ""; _destname = ""; if (_track=="TRACK") then { _track = "TRACK"; _trackername=format["trk_%1",_grpidx]; _markerobj = createMarker[_trackername,[0,0]]; _markerobj setMarkerShape "ICON"; _markertype = if (isClass(configFile >> "cfgMarkers" >> "WTF_Dot")) then {"WTF_DOT"} else {"DOT"}; _trackername setMarkerType _markertype; _markercolor = switch (side _npc) do { case west: {"ColorGreen"}; case east: {"ColorRed"}; case resistance: {"ColorBlue"}; default {"ColorBlack"}; }; _trackername setMarkerColor _markercolor; _trackername setMarkerText format["%1",_grpidx]; _trackername setmarkerpos _currPos; _destname=format["dest_%1",_grpidx]; _markerobj = createMarker[_destname,[0,0]]; _markerobj setMarkerShape "ICON"; _markertype = if (isClass(configFile >> "cfgMarkers" >> "WTF_Flag")) then {"WTF_FLAG"} else {"FLAG"}; _destname setMarkerType _markertype; _destname setMarkerColor _markercolor; _destname setMarkerText format["%1",_grpidx]; _destname setMarkerSize [.5,.5]; }; // delete dead units _deletedead = ["DELETE:",0,_UCthis] call KRON_UPSgetArg; if (_deletedead>0) then { {_x addEventHandler['killed',format["[_this select 0,%1] spawn KRON_deleteDead",_deletedead]]; }forEach _members; }; // how many group clones? // TBD: add to global side arrays? _mincopies = ["MIN:",0,_UCthis] call KRON_UPSgetArg; _maxcopies = ["MAX:",0,_UCthis] call KRON_UPSgetArg; if (_mincopies>_maxcopies) then {_maxcopies=_mincopies}; if (_maxcopies>140) exitWith {hint "Cannot create more than 140 groups!"}; if (_maxcopies>0) then { _copies=_mincopies+random (_maxcopies-_mincopies); // create the clones for "_grpcnt" from 1 to _copies do { // copy groups if (isNil ("KRON_grpindex")) then {KRON_grpindex = 0}; KRON_grpindex = KRON_grpindex+1; // copy group leader _unittype = typeof _npc; // make the clones civilians // use random Civilian models for single unit groups if ((_unittype=="Civilian") && (count _members==1)) then {_rnd=1+round(random 20); if (_rnd>1) then {_unittype=format["Civilian%1",_rnd]}}; _grp=createGroup side _npc; _lead = _grp createUnit [_unittype, getpos _npc, [], 0, "form"]; _lead setVehicleVarName format["l%1",KRON_grpindex]; call compile format["l%1=_lead",KRON_grpindex]; _lead setBehaviour _orgMode; _lead setSpeedmode _orgSpeed; _lead setSkill skill _npc; _lead setVehicleInit _initstr; [_lead] join _grp; _grp selectLeader _lead; // copy team members (skip the leader) _c=0; { _c=_c+1; if (_c>1) then { _newunit = _grp createUnit [typeof _x, getpos _x, [],0,"form"]; _newunit setBehaviour _orgMode; _newunit setSpeedMode _orgSpeed; _newunit setSkill skill _x; _newunit setVehicleInit _initstr; [_newunit] join _grp; }; } foreach _members; _nul=[_lead,_areamarker,_pause,_noslow,_nomove,_nofollow,_initpos,_track,_showmarker,_shareinfo,"DELETE:",_deletedead] execVM "scripts\upsmon.sqf"; //sleep .05; }; processInitCommands; sleep .05; }; // units that can be left for area to be "cleared" _zoneempty = ["EMPTY:",0,_UCthis] call KRON_UPSgetArg; // create area trigger if (_areatrigger!="NOTRIGGER") then { _trgside = switch (side _npc) do { case west: {"WEST"}; case east: {"EAST"}; case resistance: {"GUER"}; case civilian: {"CIV"};}; //_trgside = switch (side _npc) do { case west: {"EAST"}; case east: {"WEST"}; case resistance: {"ANY"}; case civilian: {"ANY"};}; _trgname="KRON_Trig_"+_trgside+"_"+_areamarker; _flgname="KRON_Cleared_"+_areamarker; // has the trigger been created already? KRON_TRGFlag=-1; call compile format["%1=false",_flgname]; call compile format["KRON_TRGFlag=%1",_trgname]; if (isNil ("KRON_TRGFlag")) then { // trigger doesn't exist yet, so create one (make it a bit bigger than the marker, to catch path finding 'excursions' and flanking moves) call compile format["%1=createTrigger['EmptyDetector',_centerpos]",_trgname]; call compile format["%1 setTriggerArea[_rangeX*1.5,_rangeY*1.5,markerDir _areamarker,true]",_trgname]; call compile format["%1 setTriggerActivation[_trgside,'PRESENT',true]",_trgname]; call compile format["%1 setEffectCondition 'true'",_trgname]; call compile format["%1 setTriggerTimeout [5,7,10,true]",_trgname]; if (_areatrigger!="SILENTTRIGGER") then { call compile format["%1 setTriggerStatements['count thislist<=%6', 'titletext [''SECTOR <%2> LIMPIO'',''PLAIN''];''%2'' setmarkerpos [-%4,-%5];%3=true;', 'titletext [''SECTOR <%2> HA SIDO REOCUPADO'',''PLAIN''];''%2'' setmarkerpos [%4,%5];%3=false;']", _trgname,_areamarker,_flgname,_centerX,_centerY,_zoneempty]; } else { call compile format["%1 setTriggerStatements['count thislist<=%3', '%2=true;', '%2=false;']", _trgname,_flgname,_zoneempty]; }; //Si quieres que ejecute tu script descomenta estas lineas //message = format["_trgside=%1, _npc=%2",_trgside, _npc]; //call compile format["%1 setTriggerStatements['this', 'nul = [%1,%3,thisList] execvm ''mon\enemydetected.sqF'';', '%2=false;'];", _trgname,_flgname,_trgside]; //setTriggerStatements['this', 'nul = [thislist,_trgside] execvm "mon\enemydetectedd.sqF"';, 'ok = false'] }; sleep .05; }; //Si algún soldado tiene un edificio util cerca lo toma if ( _nomove=="NOMOVE" ) then { sleep 10; _unitsIn = [_grpid,_npc,150] call MON_GetIn_NearestStatic; if ( count _unitsIn > 0 ) then { sleep 10}; [_npc, _buildingdist,false,_wait,true] spawn MON_moveNearestBuildings; }; // init done _makenewtarget=true; _newpos=false; _targetPos = [0,0,0];//_currPos; _targettext ="_currPos"; _swimming = false; _waiting = if (_nomove=="NOMOVE") then {9999} else {0}; _sharedist = if (_nomove=="NOMOVE") then {KRON_UPS_sharedist} else {KRON_UPS_sharedist*1.5}; //Gets position of waypoint if no targetpos if (format ["%1", _targetPos] == "[0,0,0]") then { _index = (count waypoints _grp) - 1; _wp = [_grp,_index]; _targetPos = waypointPosition _wp; if (([_currpos,_targetPos] call KRON_distancePosSqr)<= 20) then {_targetPos = [0,0,0];}; }; // *********************************************************************************************************** // ************************************************ MAIN LOOP ************************************************ // *********************************************************************************************************** _loop=true; scopeName "main"; while {_loop} do { //if (KRON_UPS_Debug>0) then {player sidechat format["%1: _cycle=%2 _currcycle=%3 _react=%4 _waiting=%5",_grpidx,_cycle,_currcycle,_react,_waiting]}; _timeontarget=_timeontarget+_currcycle; _react=_react+_currcycle; _waiting = _waiting - _currcycle; _lastreact = _lastreact+_currcycle; _newpos = false; // did anybody in the group got hit? _newdamage=0; { if((damage _x)>0.2) then { _newdamage=_newdamage+(damage _x); // damage has increased since last round if (_newdamage>_lastdamage) then { _lastdamage=_newdamage; _gothit=true; }; }; if (!alive _x || !canmove _x) then { _members=_members-[_x]; }; } foreach _members; // nobody left alive, exit routine if (count _members==0) then { _exit=true; } else { // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; }; //exits from loop if (_exit) exitwith {}; //Checks if surrender is enabled if ( _surrender > 0 ) then { _surrended = call (compile format ["KRON_UPS_%1_SURRENDED",_side]); }; //If surrended exits from script if (_surrended) exitwith { { [_x] spawn MON_surrender; }foreach _members; if (KRON_UPS_Debug>0) then {_npc globalchat format["%1: %2 SURRENDED",_grpidx,_side]}; }; //Asignamos el lider actual del grupo en el array de lideres de grupos KRON_NPCs set [_grpid,_npc]; // current position _currPos = getpos _npc; _currX = _currPos select 0; _currY = _currPos select 1; if (_track=="TRACK" || KRON_UPS_Debug>0) then { _trackername setmarkerpos _currPos; }; // if the AI is a civilian we don't have to bother checking for enemy encounters if ((_issoldier) && !(_exit)) then { _pursue=false; //_Behaviour = Behaviour _npc; //Variables para saber si estamos en un vehiculo _incar = "LandVehicle" countType [vehicle (_npc)]>0; _inheli = "Air" countType [vehicle (_npc)]>0; _inboat = "Ship" countType [vehicle (_npc)]>0; //Si el grupo es un refuerzo y se han detectado los enemigos se envian al objetivo if (_rfid > 0 ) then { _rfidcalled = call (compile format ["KRON_UPS_reinforcement%1",_rfid]); if (isnil "_rfidcalled") then {_rfidcalled=false}; _fixedtargetPos = call (compile format ["KRON_UPS_reinforcement%1_pos",_rfid]); if (isnil "_fixedtargetPos") then { _fixedtargetPos=[0,0]; }else{ _fixedtargetPos = [abs(_fixedtargetPos select 0),abs(_fixedtargetPos select 1)]; _target = objnull; }; }; //Reinforcement control if (_reinforcement=="REINFORCEMENT") then { if ( (KRON_UPS_reinforcement || _rfidcalled) && (!_reinforcementsent)) then { _reinforcementsent=true; _fortify = false; _minreact = KRON_UPS_minreact; _buildingdist = 60; _react = _react + 100; _waiting = -1; if (KRON_UPS_Debug>0) then {player sidechat format["%1 called for reinforcement %2",_grpidx,_fixedtargetPos]}; }else{ if ( !(KRON_UPS_reinforcement || _rfidcalled) && (_reinforcementsent)) then { _fixedtargetPos = [0,0]; _attackPos = [0,0]; _fortify = _fortifyorig; _reinforcementsent=false; _nowp = _orignowp; if (_rfid > 0 ) then { call (compile format ["KRON_UPS_reinforcement%1_pos = [0,0]",_rfid]); call (compile format ["KRON_UPS_reinforcement%1 = false",_rfid]); }; if (KRON_UPS_Debug>0) then {player sidechat format["%1 reinforcement canceled",_grpidx]}; }; }; }; //Gets targets from radio _targets = call (compile format ["KRON_targets%1",_sharedenemy]); //Reveal targets found by members to leader { _NearestEnemy = assignedTarget _x; //_NearestEnemy = _x findnearestenemy _x; if (_x knowsabout _NearestEnemy > 0.5 && (_npc knowsabout _NearestEnemy <= 0.5 || count _targets <= 0 )) then { if (_npc knowsabout _NearestEnemy <= 0.5 ) then { _npc reveal _NearestEnemy; if (KRON_UPS_Debug>0) then {player globalchat format["%1: %2 reveals target %3 to leader",_grpidx,typeof _x, typeof _NearestEnemy]}; }; //If no targets adds this if (count _targets <= 0) then { //_target = _NearestEnemy; _targets = _targets + [_NearestEnemy]; _NearestEnemy setvariable ["UPSMON_lastknownpos", position _NearestEnemy, false]; //if (KRON_UPS_Debug>0) then {player globalchat format["%1: %3 added to targets",_grpidx,typeof _x, typeof _target]}; }; }; }foreach units _npc; //Resets distance to target _dist = 10000; //Gets current known position of target and distance if ( !isNull (_target) && alive _target ) then { _newattackPos = _target getvariable ("UPSMON_lastknownpos"); if ( !isnil "_newattackPos" ) then { _attackPos=_newattackPos; //Gets distance to target known pos _dist = ([_currpos,_attackPos] call KRON_distancePosSqr); }; }; //Initialization for geting new targets //Si el objetivo actual está muerto o no existe se limpia el conocimiento anterior if (isNull (_target) || !alive _target || !canmove _target ) then { _lastknown = 0; _opfknowval = 0; _target = objnull; }; //_maxknowledge=0; _newtarget = _target; if ((_shareinfo=="SHARE")) then { // if the leader comes across another unit that's either injured or dead, go into combat mode as well. // If the other person is still alive, share enemy information. //Solicita por radio la posición del enemigo, si está dentro del radio de acción actua if ((KRON_UPS_comradio == 2)) then { _targetsnear = false; //I we have a close target alive do not search another if (!alive _target || !canmove _target || _dist > _closeenough) then { { //if (KRON_UPS_Debug>0) then {player sidechat format["%1: targets=%2 tg=%3 newtg=%4 dist=%5 %6 %7 %8 %9",_grpidx,count _targets,typeof _x,_newtarget, _dist,_knows, _maxknowledge,_dist2,_attackPos]}; if ( !isnull _x && canmove _x && alive _x ) then { _newattackPos = _x getvariable ("UPSMON_lastknownpos"); if ( !isnil "_newattackPos" ) then { _dist3 = ([_currpos,_newattackPos] call KRON_distancePosSqr); //Sets if near targets to begin warning IF ( _dist3 <= (_closeenough + KRON_UPS_safedist)) then { _targetsnear = true }; //Sets new target if ( ( isnull (_newtarget) || captive _newtarget|| !alive _newtarget|| !canmove _newtarget || _dist3 < _dist ) && ( _dist3 <= _sharedist || _reinforcementsent ) && ( !(_x iskindof "Air") || (_x iskindof "Air" && _isplane )) && ( !(_x iskindof "Ship") || (_x iskindof "Ship" && _isboat )) && ( _x emptyPositions "Gunner" == 0 && _x emptyPositions "Driver" == 0 || (!isnull (gunner _x) && canmove (gunner _x)) || (!isnull (driver _x) && canmove (driver _x))) ) then { _newtarget = _x; _opfknowval = _npc knowsabout _x; _dist = _dist3; if (_dist < _closeenough) exitWith {}; }; }; }; } foreach _targets; sleep 0.5; }; }; //Si cambia el target cambiamos inicializamos la dirección de flanqueo if ( !isNull (_newtarget) && alive _newtarget && canmove _newtarget && (_newtarget != _target || isNull (_target)) ) then { _timeontarget = 0; _targetdead = false; _flankdir= if (random 100 <= 10) then {0} else {_flankdir}; _target = _newtarget; }; }; //Gets current known position of target and distance if ( !isNull (_target) && alive _target ) then { //Enemy detected if (_fightmode != "fight" ) then { _fightmode = "fight"; _react = KRON_UPS_react; if (KRON_UPS_Debug>0) then {player sidechat format["%1: Enemy detected %2",_grpidx, typeof _target]}; if (_nowpType == 1) then {_nowp = false}; }; _newattackPos = _target getvariable ("UPSMON_lastknownpos"); if ( !isnil "_newattackPos" ) then { _attackPos=_newattackPos; //Gets distance to target known pos _dist = ([_currpos,_attackPos] call KRON_distancePosSqr); //Looks at target known pos _members lookat _attackPos; }; }; //Si el enemigo se ha alejado de la covertura de rádio y no es un refuerzo enviado habremos perdido la pista if ( _fightmode != "walk" && !isnull(_target) && _dist < 15 && _npc knowsabout _target < 0.5 ) then { //If squad is near last position and no target clear position of target if (KRON_UPS_Debug>0) then {player sidechat format["%1: Target lost",_grpidx]}; _fightmode="walk"; _speedmode = _orgSpeed; _target = objnull; _Behaviour = _orgMode; _waiting = -1; _unitpos = "AUTO"; _pursue=false; _nowp = _orignowp; _targetdead = true; _makenewtarget = true; //Volvemos a la posición original }; //Si aumenta el conocimiento del target aceleramos la reacción if (_opfknowval>_lastknown ) then { _react = _react + 20; }; // if spotted an enemy or got shot, so start pursuit, if in combat and exceed time to react or movecompleted if (_fightmode != "walk" && ((_react >= KRON_UPS_react && _lastreact >=_minreact) || moveToCompleted _npc )) then { _pursue=true; }; //Ambush if (_ambush && !_ambushed) then { _ambushed = true; _nowp = true; _currcycle = 2; _grp setFormation "LINE"; _npc setBehaviour "STEALTH"; _npc setSpeedMode "FULL"; sleep 10; { [_x,"DOWN"] spawn MON_setUnitPos; _x stop true; }foreach units _npc; //Puts a mine if near road if ( KRON_UPS_useMines && _ambushType == 1 ) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1: Puting mine for ambush",_grpidx]}; _npc setBehaviour "careless"; _dir1 = getDir _npc; _mineposition = [position _npc,_dir1, 25] call MON_GetPos2D; _roads = _mineposition nearroads KRON_UPS_ambushdist; if (count _roads > 0) then { _mineposition = position (_roads select 0); if (_Mines > 0 && [_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; if (count _roads > 3) then { _mineposition = position (_roads select 3); if (_Mines > 0 && [_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; }; } else { _mineposition = [position _npc,(_dir1-30)mod 360, KRON_UPS_ambushdist + random 15] call MON_GetPos2D; if (_Mines > 0 && [_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; _mineposition = [position _npc,(_dir1+30)mod 360, KRON_UPS_ambushdist + random 15] call MON_GetPos2D; if (_Mines > 0 && [_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; }; _mineposition = [position _npc,_dir1, KRON_UPS_ambushdist + random 20] call MON_GetPos2D; if ([_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; _mineposition = [position _npc,_dir1-15, KRON_UPS_ambushdist + random 10] call MON_GetPos2D; if ([_npc,_mineposition] call MON_CreateMine) then {_Mines = _Mines -1;}; _npc setBehaviour "careless"; sleep 30; { if (!stopped _x) then { _x domove position _npc; waituntil {moveToCompleted _x || moveToFailed _x || !alive _x || !canmove _x || _x distance _npc <= 5}; }; }foreach units _npc; }; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; _npc setBehaviour "STEALTH"; _grp setFormation "LINE"; sleep 10; { [_x,"DOWN"] spawn MON_setUnitPos; _x stop true; _x setUnitPos "DOWN"; }foreach units _npc; }; //Ambus enemy is nearly aproach //_ambushdist = 50; if (_ambush) then { _prov = ((_ambushdist*2 - (_npc distance _target))*3) - 40; //if (KRON_UPS_Debug>0) then {player sidechat format["%1:%6 _ambushdist=%5 last=%2 dist=%3 prov=%4",_grpidx,_lastdist,_npc distance _target,_prov,_ambushdist,typeof _target]}; if (_gothit || _reinforcementsent || time > _ambushwait || ( "Air" countType [_target]<=0 && ( _npc distance _target <= _ambushdist + random 10 || (!isNull (_target) && (( random 100 <= _prov && _npc distance _target > _lastdist) || _npc distance _target > _ambushdist*3 && _lastdist < _ambushdist*3 && _lastdist > 0)) )) ) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1: FIREEEEEEEEE!!!",_grpidx]}; _nowp = _orignowp; _ambush = false; _ambushed = false; _currcycle = _cycle; { _x stop false; _x setUnitPos "Middle"; } foreach _members; //No engage yet _pursue = false; }; //Sets distance to target _lastdist = _npc distance _target; }; //if (KRON_UPS_Debug>0) then {player sidechat format["%1: _nowp=%2 in vehicle=%3 _inheli=%4 _npc=%5",_grpidx,_nowp,vehicle (_npc) ,_inheli,typeof _npc ]}; //If in vehicle take driver if not controlled by user if (alive _npc && !_nowp) then { if (!_isman || (vehicle (_npc) != _npc && !_inboat && !(vehicle (_npc) iskindof "StaticWeapon"))) then { //If new target is close enough leaves vehicle _unitsin = []; if (!_inheli) then { if (_fightmode == "walk") then { _GetOutDist = _area / 20; }else{ _GetOutDist = _closeenough * ((random .4) + 0.6); }; //If near target or stuck getout of vehicle and lock or gothit exits inmediately if (_gothit || _dist <= _closeenough * 1.5 || (_lastcurrpos select 0 == _currpos select 0 && _lastcurrpos select 1 == _currpos select 1 && moveToFailed (vehicle (_npc))) || moveTocompleted (vehicle (_npc))) then { _GetOutDist = 10000; }; //if (KRON_UPS_Debug>0) then {player sidechat format["%1: vehicle=%2 _npc=%3",_grpidx,vehicle (_npc) ,typeof _npc ]}; _unitsin = [_npc,_targetpos,_GetOutDist] call MON_GetOutDist; sleep 0.05; }else{ _GetOutDist = 0; }; if (count _unitsin > 0) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1: Geting out of vehicle",_grpidx,([_currpos,_targetpos] call KRON_distancePosSqr),_GetOutDist,_area]}; _timeout = time + 15; { waituntil {vehicle _x == _x || !canmove _x || !alive _x || time > _timeout || movetofailed _x }; }foreach _unitsin; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; if (_fightmode == "fight" || _gothit) then { _npc setBehaviour "AWARE"; _groupOne = group _npc; _groupOne setFormation "DIAMOND"; [_npc,50] call MON_move; }; if (_fightmode == "fight") then { _pursue = true; }else { _pursue = false; _makenewtarget=true; }; }; }; }; //Si bajo ataque o aumenta el conocimiento se acelera la respuesta y se retoma el control de la AI if (_gothit ) then { _react = if (!_supressed) then {_react + 30}; if (_fightmode != "walk") then { if (_nowpType == 2) then {_nowp = false}; }; }; //Si no hay objetivo se anula la orden de persecución if ((isNull (_target) || !alive _target )) then { _pursue=false; if (_gothit && !_fortify) then { if (_fightmode == "walk") then { //Podría tratarse de un sniper, mejor estar alerta y moverse por si acaso _Behaviour = "AWARE"; _speedmode = "FULL"; _unitpos = "AUTO"; _gothit = false; _makenewtarget = true; _waiting = -1; if (KRON_UPS_Debug>0) then {player sidechat format["%1: Have been damaged moving",_grpidx,_makenewtarget]}; } else { if (_react >= KRON_UPS_react && _lastreact >=_minreact && count _targets <= 0) then { //Nos disparan y no tenemos target, nos movemos de posición if (KRON_UPS_Debug>0) then {player sidechat format["%1: Under fire by unkown target, moving to newpos",_grpidx]}; //Cubre al grupo con una granada de humo if (!_supressed && (random 100)<80) then { [_npc,_target] spawn MON_throw_grenade; }; _gothit = false; _makenewtarget = true; _waiting = -1; _pause="NOWAIT"; _speedmode = "FULL"; _unitpos = "middle"; _Behaviour = "AWARE"; }else{ if (_lastreact >=_minreact && !_targetdead) then { _targetdead = true; _pursue = true; //Nos hemos qdado sin objetivos continuamos la búsqueda if (KRON_UPS_Debug>0) then {player sidechat format["%1: Target defeated, searching",_grpidx]}; }; }; }; }; }; //If no fixed target check if current target is available if (format ["%1",_fixedtargetPos] != "[0,0]") then { //If fixed target check if close enough or near enemy and gothit if (([_currpos,_fixedtargetpos] call KRON_distancePosSqr) <= _closeenough || (_dist <= _closeenough && _gothit)) then { _fixedtargetPos = [0,0]; }else{ _pursue = false; _attackPos=_fixedtargetPos; if (_react >= KRON_UPS_react && _lastreact >=_minreact) then { _makenewtarget = true; _unitpos = "AUTO"; _speed = "FULL"; }; }; }; //If captive or surrended do not pursue if ( isnil "_attackPos") then {_pursue = false;}; if ( captive _target || format ["%1", _attackPos] == "[0,0]") then {_pursue = false;}; //If no waypoint do not move if (_nowp) then { _makenewtarget = false; _pursue = false; }; if (_inheli) then { _landing = _heli getVariable "UPSMON_landing"; if (isnil ("_landing")) then {_landing=false;}; if (_landing) then { _pursue = false; }; }; sleep 0.5; //********************************************************************************************************************** // PURSUE: SE INICIA LA PERSECUCIÓN DEL OBJETIVO //********************************************************************************************************************** //if (KRON_UPS_Debug>0) then {diag_log format["%1:pursue=%3 _react=%9 timeon=%4 targets=%5 _target=%6 captive=%11 _attackPos=%7 nowp=%8 _inheli=%10 _fixedtargetPos=%12 _fightmode=%13",_grpidx,_dist,_pursue,_timeontarget,count _targets, _target,_attackPos,_nowp,_react,_inheli,captive _target,_fixedtargetPos,_fightmode]}; if (_pursue) then { _pursue = false; _newpos = true; _react = 0; _lastreact = 0; _timeontarget = 0; _makenewtarget = false; _fm = 1; //Cancel supress effect when reaction time _supressed = false; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; // get position of spotted unit in player group, and watch that spot _targetPos = _attackPos; _targetX = _targetPos select 0; _targetY = _targetPos select 1; _currPos = getpos _npc; // also go into "combat mode" _pause="NOWAIT"; _waiting=0; // angle from unit to target _dir1 = [_currPos,_targetPos] call KRON_getDirPos; // angle from target to unit (reverse direction) _dir2 = (_dir1+180) mod 360; //Establecemos una distancia de flanqueo _flankdist = ((random 0.5)+0.7)*KRON_UPS_safedist; //La distancia de flanqueo no puede ser superior a la distancia del objetivo o nos pordría pillar por la espalda _flankdist = if ((_flankdist*1.40) >= _dist) then {_dist*.65} else {_flankdist}; if (_inheli) then {_flankdist = _flankdist / 2;}; // avoidance position (right or left of unit) _avoidPos = [_currPos,_dir2, KRON_UPS_safedist] call MON_GetPos2D; //Calculamos posición de avance frontal _frontPos = [_targetPos,_dir2, _flankdist] call MON_GetPos2D; //Adaptamos el ángulo de flanqueo a la distancia _newflankAngle = ((random(KRON_UPS_flankAngle)+1) * 2 * (_flankdist / KRON_UPS_safedist )) + (KRON_UPS_flankAngle/1.4) ; if (_newflankAngle > KRON_UPS_flankAngle) then {_newflankAngle = KRON_UPS_flankAngle}; //Calculamos posición de flanqueo 1 45º _dirf1 = (_dir2+_newflankAngle) mod 360; _flankPos = [_targetPos,_dirf1, _flankdist] call MON_GetPos2D; //Calculamos posición de flanqueo 2 -45º _dirf2 = (_dir2-_newflankAngle+360) mod 360; _flankPos2 = [_targetPos,_dirf2, _flankdist] call MON_GetPos2D; if (KRON_UPS_Debug>0) then { "flank1" setmarkerpos _flankPos; "flank2" setmarkerpos _flankPos2; "target" setmarkerpos _attackPos; }; //Decidir por el mejor punto de flanqueo //Contamos las posiciones de destino de otros grupos más alejadas _fldest = 0; _fldest2 = 0; _fldestfront = 0; _i = 0; { if (_i != _grpid && format ["%1", _x] != "[0,0]") then { _dist1 = [_x,_flankPos] call KRON_distancePosSqr; _dist2 = [_x,_flankPos2] call KRON_distancePosSqr; _dist3 = [_x,_frontPos] call KRON_distancePosSqr; if (_dist1 <= _flankdist/1.5 || _dist2 <= _flankdist/1.5 || _dist3 <= _flankdist/1.5) then { if (_dist1 < _dist2 && _dist1 < _dist3) then {_fldest = _fldest + 1;}; if (_dist2 < _dist1 && _dist2 < _dist3) then {_fldest2 = _fldest2 + 1;}; if (_dist3 < _dist1 && _dist3 < _dist2) then {_fldestfront = _fldestfront + 1;}; }; }; _i = _i + 1; }foreach KRON_targetsPos; //sleep 0.05; //Contamos las posiciones de otros grupos más alejadas _i = 0; { if (_i != _grpid && !isnull(_x)) then { _dist1 = [getpos(_x),_flankPos] call KRON_distancePosSqr; _dist2 = [getpos(_x),_flankPos2] call KRON_distancePosSqr; _dist3 = [getpos(_x),_frontPos] call KRON_distancePosSqr; if (_dist1 <= _flankdist/1.5 || _dist2 <= _flankdist/1.5 || _dist3 <= _flankdist/1.5) then { if (_dist1 < _dist2 && _dist1 < _dist3) then {_fldest = _fldest + 1;}; if (_dist2 < _dist1 && _dist2 < _dist3) then {_fldest2 = _fldest2 + 1;}; if (_dist3 < _dist1 && _dist3 < _dist2) then {_fldestfront = _fldestfront + 1;}; }; }; _i = _i + 1; }foreach KRON_NPCs; //sleep 0.05; //La preferencia es la elección inicial de dirección switch (_flankdir) do { case 1: {_prov = 125}; case 2: {_prov = -25}; default {_prov = 50}; }; //Si es positivo significa que hay más destinos existentes lejanos a la posicion de flanqueo1, tomamos primariamente este if (_fldest<_fldest2) then {_prov = _prov + 50;}; if (_fldest2<_fldest) then {_prov = _prov - 50;}; //Si la provablilidad es negativa indica que tomará el flank2 por lo tanto la provabilidad de coger 1 es 0 if (_prov<0) then {_prov = 0;}; //Evaluamos la dirección en base a la provablilidad calculada if ((random 100)<=_prov) then { _flankdir =1; _flankPos = _flankPos; _targettext = "_flankPos"; } else { _flankdir =2; _flankPos = _flankPos2; _targettext = "_flankPos2"; }; //Posición de ataque por defecto el flanco _targetPos = _flankPos; _targettext = "_flankPos"; if ((surfaceIsWater _flankPos && !(_isplane || _isboat)) ) then { _targetPos = _attackPos;_targettext ="_attackPos"; _flankdir =0; } else { if (_fldestfront < _fldest && _fldestfront < _fldest2) then { _targetPos = _frontPos;_targettext ="_frontPos"; }; }; //Establecemos tipo de waypoint //con DESTROY tiene peor comportamiento y a veces no se mueven _wptype = "MOVE"; //Establecer velocidad y modo de combate _rnd = random 100; if ( _dist <= _closeenough ) then { //Si estamos muy cerca damos prioridad a fuego a discrección if ( _dist <= _closeenough/2 ) then { //Modo combate cerrado _speedmode = "LIMITED"; _wpformation = "LINE"; _unitpos = "Middle"; _react = _react + KRON_UPS_react / 2; _minreact = KRON_UPS_minreact / 2; if ((_nomove == "NOMOVE" && _rnd < 25) && !_reinforcementsent) then { //Combate defensivo _Behaviour = "STEALTH"; _wptype = "HOLD"; } else { _Behaviour = "COMBAT"; _wptype = "MOVE"; } }else{ //Si la tropa tiene el rol de no moverse tenderá a mantener la posición _speedmode = "FULL"; _wpformation = "WEDGE"; _unitpos = "Middle"; _minreact = KRON_UPS_minreact / 1.5; if ((_nomove == "NOMOVE" && _rnd < 50) && !_reinforcementsent) then { //Combate defensivo _Behaviour = "COMBAT"; _wptype = "HOLD"; } else { _Behaviour = "AWARE"; _wptype = "MOVE"; }; }; } else { if (( _dist <= (_closeenough + KRON_UPS_safedist))) then { _speedmode = "FULL"; _wpformation = "WEDGE"; _unitpos = if (_rnd < 90) then {"Middle"}else{"AUTO"}; _minreact = KRON_UPS_minreact; if ((_nomove=="NOMOVE" && _rnd < 75) && !_reinforcementsent) then { //Combate defensivo _Behaviour = "AWARE"; _wptype = "HOLD"; }else{ //Movimiento con precaución (más rápido) _Behaviour = "AWARE"; _wptype = "MOVE"; }; } else { //In distance of radio patrol may act. if (( _dist < KRON_UPS_sharedist )) then { //Pelotón lejos del objetivo hay que desplazarse rápido y directo al punto _Behaviour = "AWARE"; _speedmode = "FULL"; _unitpos = if (_rnd < 60) then {"Middle"}else{"AUTO"}; _minreact = KRON_UPS_minreact * 2; if ((_nomove=="NOMOVE" && _rnd < 95) && !_reinforcementsent) then { _wptype = "HOLD"; _wpformation = "WEDGE"; }else{ _wptype = "MOVE"; _wpformation = "WEDGE"; }; } else { //Pelotón muy muy lejos del objetivo si es rol nomove no se moverán _Behaviour = "SAFE"; _speedmode = "FULL"; _unitpos = "AUTO"; _minreact = KRON_UPS_minreact * 3; if (((_nomove=="NOMOVE") || (_nomove=="MOVE" && _rnd < 70)) && !_reinforcementsent) then { _wptype = "HOLD"; _wpformation = "WEDGE"; }else{ _wptype = "MOVE"; _wpformation = "COLUMN"; }; }; }; }; //Las escuadras fortificadas mantienen siempre la posición if ( _fortify && (random 100)<99) then {_wptype = "HOLD"}; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; //If leader is in vehicle will move in anyway if (vehicle (_npc) != _npc || !_isman) then { _wptype = "MOVE"; _Behaviour = "AWARE"; if ( _inheli ) then { _speedmode = "FULL"; _unitpos = "AUTO"; if ( (random 100)<60 ) then { _targetPos = _AttackPos; }; }; }; //Establecemos el target KRON_targetsPos set [_grpid,_targetPos]; sleep .05; //If use statics are enabled leader searches for static weapons near. // Tanks enemies are contabiliced if ( KRON_UPS_useMines && _Mines > 0 ) then { _enemytanksnear = false; { if ( ("Tank" countType [_x] > 0 || "Wheeled_APC" countType [_x] >0 || "Tank" countType [vehicle _x] > 0 || "Wheeled_APC" countType [vehicle _x] >0 ) && alive _x && canMove _x && _npc distance _x <= _closeenough + KRON_UPS_safedist ) exitwith { _enemytanksnear = true; _enemytanknear = _x;}; }foreach _targets; //If use mines are enabled and enemy armors near and no friendly armor put mine. if ( _enemytanksnear && !isnull _enemytanknear && alive _enemytanknear ) then { _friendlytanksnear = false; { if (!( alive _x && canMove _x)) then {_friendlytanks = _friendlytanks - [_x]}; if (alive _x && canMove _x && _npc distance _x <= _closeenough + KRON_UPS_safedist ) exitwith { _friendlytanksnear = true;}; }foreach _friendlytanks; if (!_friendlytanksnear && random(100)<30 ) then { _dir1 = [_currPos,position _enemytanknear] call KRON_getDirPos; _mineposition = [position _npc,_dir1, 25] call MON_GetPos2D; _roads = _mineposition nearroads 50; if (count _roads > 0) then {_mineposition = position (_roads select 0);}; if ([_npc,_mineposition] call MON_CreateMine) then { _Mines = _Mines -1; if (KRON_UPS_Debug>0) then {player sidechat format["%1: %3 puting mine for %2",_grpidx,typeof _enemytanknear, side _npc]}; }; }; }; }; //Si es unidad de refuerzo siempre acosará al enemigo if (_reinforcementsent) then { _wptype="MOVE"; _newpos=true; _makenewtarget = false; }; if (_nofollow=="NOFOLLOW" && _wptype != "HOLD") then { _targetPos = [_targetPos,_centerpos,_rangeX,_rangeY,_areadir] call KRON_stayInside; _targetdist = [_currPos,_targetPos] call KRON_distancePosSqr; if ( _targetdist <= 1 ) then { _wptype="HOLD"; }; }; if (_wptype == "HOLD") then { _targetPos = _currPos; _targettext ="_currPos"; }; _lastknown = _opfknowval; //Se actualiza con el último valor, por si cambia el target //Si por el motivo que sea se cancela la nueva posición se deben limpiar los parámetros que hacen entrar en pursuit if (!_newpos) then { //Si la unidad ha decidio mantener posición pero está siendo atacada está siendo suprimida, debe tener la oportunidad de reaccionar _newpos = _gothit; if (!_newpos) then { _targetPos=_lastpos; if (KRON_UPS_Debug>0) then {player sidechat format["%1 Mantaining orders %2",_grpidx,_nomove]}; }; }; if (KRON_UPS_Debug>=1) then { "avoid" setmarkerpos _avoidPos; "flank" setmarkerpos _flankPos; _destname setMarkerPos _targetPos; }; }; //END PURSUE }; //((_issoldier) && ((count _enemies)>0) sleep 0.5; //********************************************************************************************************************** // SIN NOVEDADES //********************************************************************************************************************** if !(_newpos) then { // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; // calculate new distance // if we're waiting at a waypoint, no calculating necessary _currpos = getpos _npc; //Sets behaviour of squad if nearly changes of target if (_targetsnear) then{ if( toUpper(_Behaviour) IN _safemode) then { _Behaviour = "AWARE"; _npc setBehaviour _Behaviour; }; }; //If in safe mode if find dead bodies change behaviour if( toUpper(_Behaviour) IN _safemode) then { _unitsin = [_npc,_buildingdist] call MON_deadbodies; if (count _unitsin > 0) then { _Behaviour = "AWARE"; _react = _react + 30; _npc setBehaviour _Behaviour; if (KRON_UPS_Debug>0) then {player sidechat format["%1 dead bodies found! set %2",_grpidx,_Behaviour, count _targets]}; }; }; //Stuck control if (!_nowp && alive _npc && canmove _npc && _wptype == "MOVE" && _timeontarget >= 60 && _lastcurrpos select 0 == _currpos select 0 && _lastcurrpos select 1 == _currpos select 1) then { [_npc] call MON_cancelstop; _makenewtarget = true; if (KRON_UPS_Debug>0) then {player sidechat format["%1 stucked, moving",_grpidx]}; }; _lastpos = _targetPos; _lastcurrpos = _currpos; //sets last currpos for avoiding stuk if (_waiting<0) then { //Gets distance to targetpos _targetdist = [_currPos,_targetPos] call KRON_distancePosSqr; //Se evalua si se ha excedido el tiempo máximo de espera y el objetivo ya está abatido para retornar a la posición inicial. if (_fightmode!="walk") then { if (_timeontarget > KRON_UPS_alerttime && count _targets <= 0 && ( isNull (_target) || !alive (_target) || captive _target)) then { _pursue = false; _gothit = false; _targetdead = true; _fightmode = "walk"; _speedmode = _orgSpeed; _targetPos = _currPos; _reinforcementsent = false; _nowp = _orignowp; _target = objnull; _fixedtargetPos = [0,0]; _Behaviour = _orgMode; _waiting = -1; _unitpos = "AUTO"; _wpformation = "WEDGE"; KRON_UPS_reinforcement = false; //ya no hay amenaza if (_rfid > 0 ) then { call (compile format ["KRON_UPS_reinforcement%1 = false;",_rfid]); }; {[_x,"AUTO"] spawn MON_setUnitPos;} foreach units _npc; _npc setBehaviour _orgMode; if (KRON_UPS_Debug>0) then {player sidechat format["%1 Without objectives, leaving combat mode",_grpidx]}; }; }; //if (KRON_UPS_Debug>0) then {player globalchat format["%1 _targetdist %2 atdist=%3 dist=%4",_grpidx, _targetdist, _area/8,_dist]}; // if not in combat and we're either close enough, seem to be stuck, or are getting damaged, so find a new target if (!_nowp && (!_gothit) && (!_swimming) && (_fightmode == "walk") && (( _targetdist <= (_area/4) || moveToFailed _npc) && (_timeontarget > KRON_UPS_maxwaiting))) then { _makenewtarget=true; _unitpos = "AUTO"; _Behaviour = _orgMode; }; // make new target if (_makenewtarget) then { _gothit=false; _react = 0; _lastreact = 0; _makenewtarget = false; _gothit=false; _timeontarget = 0; _wptype = "MOVE"; //if (KRON_UPS_Debug>0) then {player globalchat format["%1 _fixedtargetPos %2 dist %3 ",_grpidx,_fixedtargetPos,_dist]}; if (format ["%1",_fixedtargetPos] !="[0,0]") then { _targetPos = _fixedtargetPos; _targettext ="Reinforcement"; }else{ if (KRON_UPS_Debug>0) then {player sidechat format["%1 Patrol to new position",_grpidx]}; if ((_nomove=="NOMOVE") && (_timeontarget>KRON_UPS_alerttime)) then { if (([_currPos,_orgPos] call KRON_distancePosSqr)<_closeenough) then { _newpos = false; _wptype = "HOLD"; _waiting = 9999; if (_fortify) then { _minreact = KRON_UPS_minreact * 3; _buildingdist = _buildingdist * 2; _wait = 3000; }; } else { _targetPos=_orgPos; _targettext ="_orgPos"; }; } else { // re-read marker position/size _centerpos = getMarkerPos _areamarker; _centerX = abs(_centerpos select 0); _centerY = abs(_centerpos select 1); _centerpos = [_centerX,_centerY]; _areasize = getMarkerSize _areamarker; _rangeX = _areasize select 0; _rangeY = _areasize select 1; _areadir = (markerDir _areamarker) * -1; // find a new target that's not too close to the current position _targetPos=_currPos; _targettext ="newTarget"; _tries=0; while {((([_currPos,_targetPos] call KRON_distancePosSqr) < _mindist)) && (_tries<20)} do { _tries=_tries+1; // generate new target position (on the road) _road=0; while {_road<20} do { _targetPos=[_centerX,_centerY,_rangeX,_rangeY,_cosdir,_sindir,_areadir] call KRON_randomPos; _road=[_targetPos,(_isplane||_isboat),_road] call KRON_OnRoad; }; }; }; }; sleep 0.05; // distance to target position _avoidPos = [0,0]; _flankPos = [0,0]; _attackPos = [0,0]; _frontPos = [0,0]; _fm=0; _newpos=true; }; }; }; // if in water, get right back out of it again if (surfaceIsWater _currPos) then { if (_isman && !_swimming) then { _drydist=999; // look around, to find a dry spot for [{_a=0}, {_a<=270}, {_a=_a+90}] do { _dp=[_currPos,30,_a] call KRON_relPos; if !(surfaceIsWater _dp) then {_targetPos=_dp}; }; _newpos=true; _swimming=true; }; } else { _swimming=false; }; sleep 0.5; //********************************************************************************************************************** // NEWPOS: SE EJECUTA LA ORDEN DE MOVIMIENTO //********************************************************************************************************************** // if (KRON_UPS_Debug>0) then {player sidechat format["%1 rea=%2 wai=%3 tim=%4 tg=%5 %6",_grpidx,_react,_waiting,_timeontarget,typeof _target,alive _target]}; if ((_waiting<=0) && _newpos) then { // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; _currPos = getpos _npc; _newpos = false; _waiting = -1; _swimming=false; _GetIn_NearestVehicles = false; //Gets distance to targetpos _targetdist = [_currPos,_targetPos] call KRON_distancePosSqr; //If gothit and not in vehicle if (_gothit && _npc == vehicle (_npc) && alive _npc ) then { //Unidad suprimida if ((random 100)<50) then { //if (KRON_UPS_Debug>0) then {player sidechat format["%1 supressed by fire",_grpidx]}; //La unidad está suprimida, borramos el waypoint actual _supressed = true; _targetPos = _currPos; _targettext ="SUPRESSED"; _wptype = "HOLD"; //Cuerpo a tierra { //Se anula el movimiento if ( _x iskindof "Man" && canmove _x && alive _x) then { if ((random 100)<40 || (primaryWeapon _x ) in KRON_UPS_MG_WEAPONS) then {[_x,"DOWN",20] spawn MON_setUnitPosTime; }else{ [_x,"Middle"] spawn MON_setUnitPos;}; }; } foreach units _npc; sleep 0.05; //Retirada!! if ((random 100)<=60 && morale _npc < 0) then { _targetPos = _avoidPos;_targettext = "_avoidPos"; _wptype = "MOVE"; _flankdir = 0; if (!_newpos && KRON_UPS_Debug>0) then {player sidechat format["%1 All Retreat!!!",_grpidx]}; }; }; //Animación croqueta { if ( (random 100)<20) then { _x spawn MON_animCroqueta; }; } foreach units _npc; //Cubre al grupo con una granada de humo if ((random 100)<30 || _targettext == "_avoidPos") then { //[_npc,_target] call MON_throw_grenade; }; sleep 0.5; }; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; //Si no ha sido suprimida continuamos el avance if (alive _npc) then { _currPos = getpos _npc; if ( _wptype == "MOVE") then { //Try to avoid stucked soldiers out of vehicles if ( _npc == vehicle _npc) then { { if (alive _x && canmove _x) then { //[_x] spawn MON_cancelstop; [_x] dofollow _npc; }; }foreach _members; }; sleep 0.05; //Search for vehicle if (!_gothit && _targetdist >= ( KRON_UPS_searchVehicledist )) then { if ( vehicle _npc == _npc && _dist > _closeenough ) then { _unitsIn = [_grpid,_npc] call MON_GetIn_NearestVehicles; if ( count _unitsIn > 0) then { _GetIn_NearestVehicles = true; _speedmode = "FULL"; _unitpos = "AUTO"; _npc setbehaviour "CARELESS"; _npc setspeedmode "FULL"; _timeout = time + 60; _vehicle = objnull; _vehicles = []; { waituntil {vehicle _x != _x || !canmove _x || !canstand _x || !alive _x || time > _timeout || movetofailed _x}; if ( vehicle _x != _x && (isnull _vehicle || _vehicle != vehicle _x)) then { _vehicle = vehicle _x ; _vehicles = _vehicles + [_vehicle] }; }foreach _unitsIn; sleep 1; { _vehicle = _x; _cargo = _vehicle getvariable ("UPSMON_cargo"); if ( isNil("_cargo")) then {_cargo = [];}; _cargo ordergetin true; //Wait for other groups to getin { waituntil {vehicle _x != _x || !canmove _x || !canstand _x || !alive _x || time > _timeout || movetofailed _x}; }foreach _cargo; //Starts gunner control [_vehicle] spawn MON_Gunnercontrol; //Resets vehicle id and cargo _vehicle setVariable ["UPSMON_grpid", 0, false]; _vehicle setVariable ["UPSMON_cargo", [], false]; } foreach _vehicles; //Cheks if leader has dead until wait _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc) exitwith {exit=true;}; if ( "Air" countType [vehicle (_npc)]>0) then { _rnd = (random 2) * 0.1; _flyInHeight = round(KRON_UPS_flyInHeight * (0.9 + _rnd)); vehicle _npc flyInHeight _flyInHeight; //Si acaba de entrar en el heli se define punto de aterrizaje if (_GetIn_NearestVehicles) then { _GetOutDist = round(((KRON_UPS_paradropdist ) * (random 100) / 100 ) + 150); [vehicle _npc, _TargetPos, _GetOutDist,_flyInHeight] spawn MON_doParadrop; //Execute control stuck for helys [vehicle _npc] spawn MON_HeliStuckcontrol; //if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: flyingheiht=%2 paradrop at dist=%3",_grpidx, _flyInHeight, _GetOutDist,_rnd]}; }; }; }; }; }; }; sleep 0.05; //Get in combat vehicles if (!_gothit && !_GetIn_NearestVehicles && _fightmode != "walk" ) then { _dist2 = _dist / 4; if ( _dist2 <= 100 ) then { _unitsIn = []; _unitsIn = [_grpid,_npc,_dist2,false] call MON_GetIn_NearestCombat; _timeout = time + (_dist2/2); if ( count _unitsIn > 0) then { if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: Geting in combat vehicle targetdist=%2",_grpidx,_npc distance _target]}; _npc setbehaviour "CARELESS"; _npc setspeedmode "FULL"; { waituntil {vehicle _x != _x || !canmove _x || !canstand _x || !alive _x || time > _timeout || movetofailed _x}; }foreach _unitsIn; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; //Return to combat mode _npc setbehaviour _Behaviour; _timeout = time + 180; { waituntil {vehicle _x != _x || !canmove _x || !alive _x || time > _timeout || movetofailed _x}; }foreach _unitsIn; { if ( vehicle _x iskindof "Air") then { //moving hely for avoiding stuck if (driver vehicle _x == _x) then { _vehicle = vehicle (_x); [_vehicle,1000] spawn MON_domove; //Execute control stuck for helys [_vehicle] spawn MON_HeliStuckcontrol; if (KRON_UPS_Debug>0 ) then {player sidechat format["%1: Geting in combat vehicle after",_grpidx,_npc distance _target]}; }; }; if (driver vehicle _x == _x) then { //Starts gunner control [vehicle _x] spawn MON_Gunnercontrol; }; }foreach _unitsIn; }; sleep 0.05; }; }; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; //If use statics are enabled leader searches for static weapons near. if (KRON_UPS_useStatics && (vehicle _npc == _npc) && !_GetIn_NearestVehicles && ((_wptype == "HOLD" && (random 100) < 80) || (_wptype != "HOLD" && (random 100) < 60))) then { _unitsIn = [_grpid,_npc,_buildingdist] call MON_GetIn_NearestStatic; if ( count _unitsIn > 0) then { _npc setbehaviour "CARELESS"; _npc setspeedmode "FULL"; _timeout = time + 60; { waituntil {vehicle _x != _x || !canmove _x || !alive _x || time > _timeout || movetofailed _x}; }foreach _unitsIn; }; sleep 0.05; }; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc || isplayer _npc ) exitwith {exit=true;}; //Buildings usage. if (!_GetIn_NearestVehicles) then { if ( _wptype == "HOLD" && vehicle _npc == _npc && ( _fortify ||(random 100) < 60) ) then { //if (KRON_UPS_Debug>0) then {player sidechat format["%1: Moving to nearest buildings",_grpidx]}; [_npc,_buildingdist,false,_wait] spawn MON_moveNearestBuildings; } else { //If we are close enough patrol in buildings for searching enemies if ((( _wptype != "HOLD" && vehicle _npc == _npc && (random 100) < 90 ) && _npc == vehicle _npc && _dist <= ( _closeenough ))) then { [_npc,_buildingdist,true] spawn MON_moveNearestBuildings; }; }; sleep 0.05; }; // did the leader die? _npc = [_npc,_members] call MON_getleader; if (!alive _npc || !canmove _npc) exitwith {exit=true;}; if (isnull _grp || _grp != group _npc) then { _grp = group _npc; }; _index = currentWaypoint _grp; //Si el waypoing es distinto del que tiene o es diferente de hold lo establecemos IF (_wptype != "HOLD" || _lastwptype != _wptype) then { //No haq waypoints o están completados //_index = 1 Waypoint por defecto, no usar. if ( _index == 1 || _index > count waypoints _grp && !isnull _grp) then { _wp = _grp addWaypoint [_targetPos, 0]; _index = _wp select 1; //if (KRON_UPS_Debug>0) then {player sidechat format["%1: created wp %2 index %3",_grpidx,_wp, _index]}; } else { _wp = [_grp,_index]; //if (KRON_UPS_Debug>0) then {player globalchat format["%1: not created wp %2 index %3 %4",_grpidx,_wp, _index,_targetPos]}; }; }; _wp = [_grp,_index]; //Definimos los parámetros del nuevo waypoint _wp setWaypointType _wptype; _wp setWaypointPosition [_targetPos, 0]; _wp setWaypointFormation _wpformation; _wp setWaypointSpeed _speedmode; _lastwptype = _wptype; //Si tiene más de 2 waypoints borramos los obsoletos { if ( _x select 1 < _index ) then { deleteWaypoint _x; }; }foreach waypoints _grp; sleep 0.05; //if (KRON_UPS_Debug>0) then {diag_log format["%1: waypoints %2 %3 %4 %5",_grpidx,count waypoints _grp, _grp, group _npc, group (leader _npc)]}; //Sets behaviour if (toupper(behaviour _npc) != toupper (_Behaviour)) then { _npc setBehaviour _Behaviour; }; //Refresh position vector KRON_targetsPos set [_grpid,_targetPos]; //Aunque haya predefinido un tipo de movimiento se dejará un pequeño porcentaje para variar a nivel individual { if ((random 100)<95 && _x == vehicle _x && _x iskindof "Man" && !((primaryWeapon _x ) in KRON_UPS_MG_WEAPONS)) then { [_x,_unitpos] spawn MON_setUnitPos; }else{ [_x,"AUTO"] spawn MON_setUnitPos; }; } foreach units _npc; //If closeenough will leave some soldiers doing supress fire if (_gothit || _dist <= _closeenough) then { { if (!canStand _x || ((primaryWeapon _x ) in KRON_UPS_MG_WEAPONS) || (vehicle _x == _x && _x iskindof "Man" && (random 100) < 50) ) then { _x suppressFor 20; }; } foreach units _npc; }; }; _gothit=false; //moving //if (KRON_UPS_Debug>0) then {player sidechat format["%1: %2 %3 %4 %5 %6 %7 %8 %9 %10",_grpidx, _wptype, _targettext,_dist, _speedmode, _unitpos, _Behaviour, _wpformation,_fightmode,count waypoints _grp];}; };//if ((_waiting<=0) && _newpos) then { if (_track=="TRACK") then { switch (_fm) do { case 1: {_destname setmarkerSize [.4,.4]}; case 2: {_destname setmarkerSize [.6,.6]}; default {_destname setmarkerSize [.5,.5]}; }; _destname setMarkerPos _targetPos; }; //If in hely calculations must done faster if (_isplane || _inheli) then {_currcycle = _cycle/2}; if ((_exit) || (isNil("_npc"))) then { _loop=false; } else { // slowly increase the cycle duration after an incident sleep _currcycle; }; };//while {_loop} if (KRON_UPS_Debug>0) then {hint format["%1 exiting mainloop",_grpidx]}; //Limpiamos variables globales de este grupo KRON_targetsPos set [_grpid,[0,0]]; KRON_NPCs set [_grpid,objnull]; KRON_UPS_Exited=KRON_UPS_Exited+1; if (_track=="TRACK") then { //_trackername setMarkerType "Dot"; _trackername setMarkerType "Empty"; _destname setMarkerType "Empty"; }; //Gets dist from orinal pos if (!isnull _target) then { _dist = ([_orgpos,position _target] call KRON_distancePosSqr); }; if (KRON_UPS_Debug>0) then {player sidechat format["%1 _dist=%2 _closeenough=%3",_grpidx,_dist,_closeenough]}; //does respawn of group if (_respawn && _respawnmax > 0 && !_surrended && _dist > _closeenough) then { if (KRON_UPS_Debug>0) then {player sidechat format["%1 doing respawn",_grpidx]}; // copy group leader _unittype = _membertypes select 0; // make the clones civilians // use random Civilian models for single unit groups if ((_unittype=="Civilian") && (count _members==1)) then {_rnd=1+round(random 20); if (_rnd>1) then {_unittype=format["Civilian%1",_rnd]}}; _grp=createGroup _side; _lead = _grp createUnit [_unittype, _orgpos, [], 0, "form"]; _lead setVehicleInit _initstr; [_lead] join _grp; _grp selectLeader _lead; //sleep 1; // copy team members (skip the leader) _c=0; { _c=_c+1; if (_c>1) then { _newunit = _grp createUnit [_x, _orgpos, [],0,"form"]; _newunit setVehicleInit _initstr; [_newunit] join _grp; }; } foreach _membertypes; { _targetpos = _orgpos findEmptyPosition [10, 200]; sleep .4; if (count _newpos <= 0) then {_targetpos = _orgpos}; //if (KRON_UPS_Debug>0) then {player globalchat format["%1 create vehicle _newpos %2 ",_x,_targetpos]}; _newunit = _x createvehicle (_targetpos); } foreach _vehicletypes; //Set new parameters if (!_spawned) then {_UCthis = _UCthis + ["SPAWNED"]}; _UCthis set [0,_lead]; _respawnmax = _respawnmax - 1; _UCthis = ["RESPAWN:",_respawnmax,_UCthis] call KRON_UPSsetArg; //Exec UPSMON script _UCthis SPAWN UPSMON; processInitCommands; }; _friends=nil; _enemies=nil; _enemytanks = nil; _friendlytanks = nil; _roads = nil; _targets = nil; _members = nil; _membertypes = nil; _UCthis = nil; if (!alive _npc) then { deleteGroup _grp; }; if(true) exitWith {}; if ((!isServer) && (player != player)) then { waitUntil {player == player}; }; //Init UPSMON scritp (must be run on all clients) call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; //Process statements stored using setVehicleInit processInitCommands; //Finish world initialization before mission is launched. finishMissionInit;%ð®ì—©û¨W´k™RÒ\ÿß