mirror of
https://github.com/Ignatz-HeMan/SEM
synced 2024-08-30 16:22:10 +00:00
Add files via upload
This commit is contained in:
parent
dbc4299ac7
commit
bcd566fd87
1
sem/$PREFIX$
Normal file
1
sem/$PREFIX$
Normal file
@ -0,0 +1 @@
|
||||
sem
|
60
sem/config.cpp
Normal file
60
sem/config.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
class CfgPatches {
|
||||
class SEM {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
SEM_version = 0.8.3;
|
||||
requiredVersion = 1.38;
|
||||
requiredAddons[] = {"a3_epoch_server"};
|
||||
};
|
||||
};
|
||||
|
||||
class CfgFunctions {
|
||||
class SEM {
|
||||
class main {
|
||||
file = "sem";
|
||||
class semInit {
|
||||
//preInit = 1;
|
||||
postInit = 1;
|
||||
};
|
||||
};
|
||||
|
||||
class SEM_scripts
|
||||
{
|
||||
file = "sem\scripts";
|
||||
class createComposition {};
|
||||
class getWorldData {};
|
||||
class missionController {};
|
||||
class missionCleanup {};
|
||||
class findMissionPos {};
|
||||
class selectMission {};
|
||||
class selectClosest {};
|
||||
class endCondition {};
|
||||
class spawnVehicle {};
|
||||
class vehicleUnlock {};
|
||||
class saveVehicle {};
|
||||
class convoyRoute {};
|
||||
class attachToVeh {};
|
||||
class safeDetach {};
|
||||
class emptyGear {};
|
||||
class randomPos {};
|
||||
class crateLoot {};
|
||||
};
|
||||
|
||||
class SEM_AIscripts
|
||||
{
|
||||
file = "sem\scripts\ai";
|
||||
class spawnAI {};
|
||||
class stripUnit {};
|
||||
class removeGear {};
|
||||
class findThread {};
|
||||
class AIactDeact {};
|
||||
class AIsetOwner {};
|
||||
class AIdamageEH {};
|
||||
class AIkilledEH {};
|
||||
class AIfiredEH {};
|
||||
class broadcastAI {};
|
||||
class AImove {};
|
||||
class AIconvoy {};
|
||||
};
|
||||
};
|
||||
};
|
248
sem/fn_semInit.sqf
Normal file
248
sem/fn_semInit.sqf
Normal file
@ -0,0 +1,248 @@
|
||||
/*
|
||||
SEM - "Simple Epoch Missions" configuration file
|
||||
By KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
[] spawn {
|
||||
diag_log "#SEM INIT: Waiting for Epoch Server Ready ...";
|
||||
waituntil {!isnil "EPOCH_SERVER_READY"};
|
||||
diag_log "#SEM INIT: Epoch Server is ready... SEM waiting more 10s to start ...";
|
||||
uisleep 10;
|
||||
diag_log "#SEM INIT: Initialize Simple Epoch Missions";
|
||||
|
||||
private ["_handle","_end"];
|
||||
_handle = execVM "sem\sem_config.sqf";
|
||||
waitUntil {isNull _handle};
|
||||
diag_log "#SEM: Loaded settings.";
|
||||
|
||||
if ((typeName SEM_debug) isEqualTo "SCALAR") then {
|
||||
SEM_debug = (switch(round SEM_debug)do{
|
||||
case 0:{"off"};
|
||||
case 1:{"log"};
|
||||
case 2:{"full"};
|
||||
default{"log"};
|
||||
});
|
||||
};
|
||||
if !(SEM_debug in ["off","log","full"]) then {
|
||||
SEM_debug = "log"
|
||||
};
|
||||
|
||||
if (SEM_debug in ["log","full"]) then{
|
||||
SEM_version = getText(configFile >> "CfgPatches" >> "sem" >> "SEM_version");
|
||||
diag_log format ["#SEM Version %1 is running on %2 %3 version %4 [%5] %6 branch.",
|
||||
SEM_version,
|
||||
(productVersion select 1),
|
||||
str(if(isDedicated)then[{"dedicated server"},{if(hasInterface)then[{if(isServer)then[{"localhost"},{"client"}]},{"headless client"}]}]),
|
||||
str(floor((productVersion select 2)/100)) + "." + str((productVersion select 2)-((floor((productVersion select 2)/100))*100)),
|
||||
str(productVersion select 3),
|
||||
(productVersion select 4)];
|
||||
};
|
||||
|
||||
/* Set up variables */
|
||||
|
||||
SEM_MinPlayerStatic = (if(isMultiPlayer)then[{1 max SEM_MinPlayerStatic},{0}]);
|
||||
SEM_MinPlayerDynamic = (if(isMultiPlayer)then[{1 max SEM_MinPlayerDynamic},{0}]);
|
||||
SEM_MissionTimerMin = 1 max SEM_MissionTimerMin;
|
||||
SEM_MissionTimerMax = 1 max SEM_MissionTimerMax;
|
||||
SEM_MissionCleanup = -1 max SEM_MissionCleanup;
|
||||
if(SEM_MissionTimerMin > SEM_MissionTimerMax)then{
|
||||
private "_tempValueHolder";
|
||||
_tempValueHolder = SEM_MissionTimerMax;
|
||||
SEM_MissionTimerMax = SEM_MissionTimerMin;
|
||||
SEM_MissionTimerMin = _tempValueHolder;
|
||||
};
|
||||
|
||||
SEM_Krypto_AIroadkill = 1 max (abs SEM_Krypto_AIroadkill);
|
||||
|
||||
{if !(_x in SEM_removeWeaponsFromDeadAI)then{SEM_removeWeaponsFromDeadAI pushBack _x}}forEach ["launch_RPG32_F","Srifle_GM6_F","Srifle_LRR_F","m107_EPOCH","m107Tan_EPOCH"];
|
||||
{if !(_x in SEM_removeMagazinesFromDeadAI)then{SEM_removeMagazinesFromDeadAI pushBack _x}}forEach ["RPG32_F","RPG32_HE_F","5Rnd_127x108_Mag","5Rnd_127x108_APDS_Mag","7Rnd_408_Mag"];
|
||||
SEM_AIdropGearChance = 0 max SEM_AIdropGearChance min 100;
|
||||
SEM_AIsniperDamageDistance = 300 max SEM_AIsniperDamageDistance min 1000;
|
||||
SEM_AIsniperDamageEHunits = [];
|
||||
|
||||
if(SEM_debug isEqualTo "full")then{ /* Load debug settings */
|
||||
SEM_MinPlayerStatic = 0;
|
||||
SEM_MinPlayerDynamic = 0;
|
||||
SEM_MissionCleanup = 2;
|
||||
SEM_AIdisableSniperDamage = true; SEM_AIsniperDamageDistance = 100;
|
||||
[] spawn {
|
||||
SEM_version = SEM_version + " - DEBUG IS ON!";
|
||||
while{true}do{publicVariable "SEM_version"; UIsleep 180};
|
||||
};
|
||||
}else{publicVariable "SEM_version"; UIsleep 30};
|
||||
|
||||
SEM_worldData = call SEM_fnc_getWorldData;
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["#SEM DEBUG: World Data received. Counting %1 locations on island %2", count (SEM_worldData select 2), str worldName]};
|
||||
|
||||
publicVariable "SEM_AIsniperDamageDistance";
|
||||
SEM_lastMissionPositions = [];
|
||||
SEM_MissionID = 0;
|
||||
|
||||
if(hasInterface && isServer)then{waitUntil{isPlayer player}};
|
||||
|
||||
SEM_createMissionMarker = {
|
||||
private ["_create","_markerPos","_markerID","_markerA","_markerB","_markerC","_markerD","_markerC_Pos","_markerName","_markerColor"];
|
||||
_create = _this select 0;
|
||||
|
||||
//Create Marker
|
||||
if (_create) then {
|
||||
_markerPos = _this select 1;
|
||||
_markerID = _this select 2;
|
||||
_markerName = _this select 3;
|
||||
_markerColor = (
|
||||
switch (_this select 4) do {
|
||||
case 0: {"ColorWhite"};
|
||||
case 1: {"ColorUNKNOWN"};
|
||||
case 2: {"ColorOrange"};
|
||||
case 3: {"ColorEAST"};
|
||||
case 4: {"ColorCIV"};
|
||||
case 5: {"ColorBlack"};
|
||||
default {"Default"};
|
||||
}
|
||||
);
|
||||
_staticMission = ( switch(_this select 5)do{
|
||||
case "static": {true};
|
||||
case "dynamic": {false};
|
||||
default {true};
|
||||
});
|
||||
|
||||
|
||||
if (_staticMission)then { //Static Mission
|
||||
_markerA = createMarker [format["SEM_MissionMarkerA_%1", _markerID], _markerPos];
|
||||
_markerB = createMarker [format["SEM_MissionMarkerB_%1", _markerID], _markerPos];
|
||||
_markerC = createMarker [format["SEM_MissionMarkerC_%1", _markerID], _markerPos];
|
||||
|
||||
{
|
||||
_x setMarkerShape "ELLIPSE";
|
||||
_x setMarkerSize [500,500];
|
||||
_x setMarkerPos _markerPos
|
||||
}forEach [_markerA,_markerB];
|
||||
|
||||
_markerA setMarkerBrush "Cross";
|
||||
_markerA setMarkerColor _markerColor;
|
||||
|
||||
_markerB setMarkerBrush "Border";
|
||||
_markerB setMarkerColor "ColorRed";
|
||||
|
||||
_markerC_Pos = [(_markerPos select 0) - (count _markerName * 15), (_markerPos select 1) - 530, 0];
|
||||
_markerC setMarkerShape "Icon";
|
||||
_markerC setMarkerType "HD_Arrow";
|
||||
_markerC setMarkerColor _markerColor;
|
||||
_markerC setMarkerPos _markerC_Pos;
|
||||
_markerC setMarkerText _markerName;
|
||||
_markerC setMarkerDir 37;
|
||||
}
|
||||
else { //Dynamic Mission
|
||||
_markerD = createMarker [format["SEM_MissionMarkerD_%1", _markerID], _markerPos];
|
||||
_markerD setMarkerShape "Icon";
|
||||
_markerD setMarkerType "mil_circle"; //"HD_Destroy";
|
||||
_markerD setMarkerColor _markerColor;
|
||||
_markerD setMarkerPos _markerPos;
|
||||
_markerD setMarkerText _markerName;
|
||||
};
|
||||
}
|
||||
else { //else delete marker
|
||||
_this spawn {
|
||||
private ["_endCondition","_deleteMarkerID","_endMissionType"];
|
||||
_endCondition = _this select 1;
|
||||
_deleteMarkerID = _this select 2;
|
||||
_endMissionType = _this select 3;
|
||||
|
||||
if(_endCondition == 3)then {
|
||||
{
|
||||
if (getMarkerColor format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID] != "") then {
|
||||
format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID] setMarkerColor "ColorIndependent";
|
||||
};
|
||||
} forEach (
|
||||
if (_endMissionType == "static") then {
|
||||
["A","B","C"]
|
||||
}
|
||||
else {
|
||||
["D"]
|
||||
}
|
||||
);
|
||||
sleep 120;
|
||||
}
|
||||
else {
|
||||
{
|
||||
if (getMarkerColor format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID] != "")then{
|
||||
format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID] setMarkerColor "ColorGrey";
|
||||
};
|
||||
} forEach (if(_endMissionType == "static")then {
|
||||
["A","B","C"]
|
||||
}
|
||||
else {
|
||||
["D"]
|
||||
}
|
||||
);
|
||||
uisleep 30;
|
||||
};
|
||||
|
||||
{ /* Only delete existing Marker */
|
||||
if (getMarkerColor format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID] != "") then {
|
||||
deleteMarker format["SEM_MissionMarker%1_%2", _x, _deleteMarkerID];
|
||||
}
|
||||
} forEach (
|
||||
if (_endMissionType == "static") then {
|
||||
["A","B","C"]
|
||||
}
|
||||
else {
|
||||
["D"]
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
SEM_client_updateMissionMarkerPos = {
|
||||
private["_updateMarkerID","_updateMarkerPos"];
|
||||
_updateMarkerID = _this select 0;
|
||||
_updateMarkerPos = _this select 1;
|
||||
|
||||
if (getMarkerColor format["SEM_MissionMarkerD_%1", _updateMarkerID] != "")then{
|
||||
format["SEM_MissionMarkerD_%1", _updateMarkerID] setMarkerPos _updateMarkerPos;
|
||||
};
|
||||
};
|
||||
|
||||
SEM_Client_VehDamage = compilefinal "
|
||||
private ['_vk','_vP','_s'];
|
||||
_vk = _this;
|
||||
_vP = vehicle player;
|
||||
if (!local _vk) exitWith {};
|
||||
if (_vk != _vP) exitWith {};
|
||||
{
|
||||
_vk setHitIndex [_forEachIndex,((_vk getHitIndex _forEachIndex)+(0.15+(random 0.15)))];
|
||||
} forEach ((getAllHitPointsDamage _vk) param [0,[]]);
|
||||
";
|
||||
SEM_Client_GlobalHint = compilefinal "
|
||||
_this spawn {
|
||||
if (isnil 'SEM_lastEvent') then {
|
||||
SEM_lastEvent = 0;
|
||||
};
|
||||
waitUntil {
|
||||
if(time - SEM_lastEvent > 20) exitwith {
|
||||
SEM_lastEvent = time;
|
||||
true
|
||||
};
|
||||
false
|
||||
};
|
||||
_sound = _this select 0;
|
||||
switch(_sound)do{
|
||||
case 0:{playSound 'UAV_05'};
|
||||
case 1:{playSound 'UAV_01'};
|
||||
case 2:{playSound 'UAV_04'};
|
||||
case 3:{playsound 'UAV_03'};
|
||||
};
|
||||
hint parseText format['%1', _this select 1];
|
||||
};
|
||||
";
|
||||
publicvariable 'SEM_Client_VehDamage';
|
||||
publicvariable 'SEM_Client_GlobalHint';
|
||||
|
||||
[
|
||||
[SEM_staticMissions, SEM_staticMissionsPath ,"static"]
|
||||
] call SEM_fnc_missionController;
|
||||
};
|
59
sem/missionsDynamic/convoyRepair.sqf
Normal file
59
sem/missionsDynamic/convoyRepair.sqf
Normal file
@ -0,0 +1,59 @@
|
||||
/* KiloSwiss */
|
||||
private["_startPos","_endPos","_timeout","_name","_missionID","_missionType","_dir","_missionObjects","_convoyVehicles","_group","_box1","_hintString","_convoy","_start","_units","_endCondition","_enterableVehicles"];
|
||||
|
||||
_startPos = _this select 0 select 0;
|
||||
_endPos = _this select 0 select 1;
|
||||
_name = _this select 1 select 1;
|
||||
_timeOut = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_dir = (_this select 0) call BIS_fnc_dirTo;
|
||||
_missionObjects = [];
|
||||
_convoyVehicles = [];
|
||||
_enterableVehicles = [];
|
||||
//--
|
||||
|
||||
_convoyVeh1 = ["I_G_Quadbike_01_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_mainVehicle = ["I_G_Offroad_01_repair_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_convoyVeh2 = ["I_G_Offroad_01_armed_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
{_convoyVehicles pushBack _x}forEach [_convoyVeh1, _mainVehicle, _convoyVeh2];
|
||||
|
||||
_mainVehicle setRepairCargo (0.0007 +(random 0.0003));
|
||||
_enterableVehicles pushBack _mainVehicle;
|
||||
|
||||
//--
|
||||
_group = [_startPos,(5+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
|
||||
_convoy = [_group, _endPos, _missionID, _mainVehicle, _convoyVehicles, _enterableVehicles] spawn SEM_fnc_AIconvoy;
|
||||
|
||||
_hintString = format["<t align='center' size='2.0' color='#f29420'>Mission<br/>%1</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>Blablablablabla!", _name];
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
waitUntil{sleep 1; scriptDone _convoy};
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [(getPos _mainVehicle),_units,_start,_timeout,_missionID,[_mainVehicle]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
{_x call SEM_fnc_vehicleUnlock}count _enterableVehicles;
|
||||
{_x setVehicleAmmo 0}count _convoyVehicles;
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_convoyVehicles spawn{{_x setDamage 1} count _this; sleep 300; {deleteVehicle _x}count _this};
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
70
sem/missionsDynamic/convoyStrider.sqf
Normal file
70
sem/missionsDynamic/convoyStrider.sqf
Normal file
@ -0,0 +1,70 @@
|
||||
/* KiloSwiss */
|
||||
private["_startPos","_endPos","_timeout","_name","_missionID","_missionType","_dir","_missionObjects","_convoyVehicles","_group","_box1","_hintString","_convoy","_start","_units","_endCondition","_enterableVehicles"];
|
||||
|
||||
_startPos = _this select 0 select 0;
|
||||
_endPos = _this select 0 select 1;
|
||||
_name = _this select 1 select 1;
|
||||
_timeOut = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_dir = (_this select 0) call BIS_fnc_dirTo;
|
||||
_missionObjects = [];
|
||||
_convoyVehicles = [];
|
||||
_enterableVehicles = [];
|
||||
//--
|
||||
|
||||
_convoyVeh1 = ["I_G_Offroad_01_armed_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_mainVehicle = ["I_MRAP_03_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_convoyVeh2 = ["I_G_Offroad_01_armed_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
{
|
||||
_convoyVehicles pushBack _x
|
||||
} forEach [_convoyVeh1, _mainVehicle, _convoyVeh2];
|
||||
|
||||
_enterableVehicles pushBack _mainVehicle;
|
||||
|
||||
//--
|
||||
_group = [_startPos,(5+(random 2))] call SEM_fnc_spawnAI;
|
||||
{
|
||||
_missionObjects pushBack _x
|
||||
} forEach units _group;
|
||||
|
||||
_convoy = [_group, _endPos, _missionID, _mainVehicle, _convoyVehicles, _enterableVehicles] spawn SEM_fnc_AIconvoy;
|
||||
|
||||
_hintString = format["<t align='center' size='2.0' color='#f29420'>Mission<br/>%1</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>Blablablablabla!", _name];
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
waitUntil{sleep 1; scriptDone _convoy};
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [(getPos _mainVehicle),_units,_start,_timeout,_missionID,[_mainVehicle]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if (_endCondition == 3) then { //Win!
|
||||
{
|
||||
_x call SEM_fnc_vehicleUnlock
|
||||
} count _enterableVehicles;
|
||||
{
|
||||
_x setVehicleAmmo 0
|
||||
} count _convoyVehicles;
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}
|
||||
else { // 1 or 2 = Fail
|
||||
{
|
||||
deleteVehicle _x;
|
||||
uisleep 0.1
|
||||
} forEach _missionObjects;
|
||||
_convoyVehicles spawn{{_x setDamage 1} count _this; sleep 300; {deleteVehicle _x}count _this};
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
};
|
||||
|
||||
deleteGroup _group;
|
84
sem/missionsDynamic/convoySupply.sqf
Normal file
84
sem/missionsDynamic/convoySupply.sqf
Normal file
@ -0,0 +1,84 @@
|
||||
/* KiloSwiss */
|
||||
private["_startPos","_endPos","_timeout","_name","_missionID","_missionType","_dir","_missionObjects","_convoyVehicles","_group","_box1","_hintString","_convoy","_start","_units","_endCondition","_enterableVehicles"];
|
||||
|
||||
|
||||
/* Convoy VEHICLES
|
||||
I_G_Quadbike_01_F
|
||||
I_G_Offroad_01_F
|
||||
I_G_Offroad_01_armed_F
|
||||
|
||||
I_G_Offroad_01_repair_F //Repair Jeep
|
||||
xyz setRepairCargo (0.0007 +(random 0.0003));
|
||||
|
||||
I_MRAP_03_F //Armored Infantry Transporter
|
||||
|
||||
I_G_Van_01_transport_F //small van
|
||||
I_Truck_02_transport_F //truck
|
||||
I_G_Offroad_01_F //offroad
|
||||
*/
|
||||
|
||||
|
||||
_startPos = _this select 0 select 0;
|
||||
_endPos = _this select 0 select 1;
|
||||
_name = _this select 1 select 1;
|
||||
_timeOut = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_dir = (_this select 0) call BIS_fnc_dirTo;
|
||||
_missionObjects = [];
|
||||
_convoyVehicles = [];
|
||||
_enterableVehicles = [];
|
||||
//--
|
||||
|
||||
_convoyVeh1 = ["I_G_Quadbike_01_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_mainVehicle = ["I_G_Van_01_transport_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_convoyVeh2 = ["I_G_Offroad_01_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
{_convoyVehicles pushBack _x}forEach [_convoyVeh1, _mainVehicle, _convoyVeh2];
|
||||
|
||||
//_enterableVehicles pushBack _mainVehicle;
|
||||
|
||||
//--
|
||||
_box1 = createVehicle ["C_supplyCrate_F", _startPos, [], 30, "NO_COLLIDE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
_box1 setDir (getDir _mainVehicle);
|
||||
[_box1, _mainVehicle] call SEM_fnc_attachtoVeh;
|
||||
|
||||
//--
|
||||
_group = [_startPos,(5+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
|
||||
_convoy = [_group, _endPos, _missionID, _mainVehicle, _convoyVehicles, _enterableVehicles] spawn SEM_fnc_AIconvoy;
|
||||
|
||||
_hintString = format["<t align='center' size='2.0' color='#f29420'>Mission<br/>%1</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>Blablablablabla!", _name];
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
waitUntil{sleep 1; scriptDone _convoy};
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [(getPos _mainVehicle),_units,_start,_timeout,_missionID,[_mainVehicle,_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1,0] call SEM_fnc_crateLoot;
|
||||
_box1 call SEM_fnc_safeDetach;
|
||||
{_x call SEM_fnc_vehicleUnlock}count _enterableVehicles;
|
||||
{_x setVehicleAmmo 0}count _convoyVehicles;
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_convoyVehicles spawn{{_x setDamage 1} count _this; sleep 300; {deleteVehicle _x}count _this};
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
68
sem/missionsDynamic/convoyWeapon.sqf
Normal file
68
sem/missionsDynamic/convoyWeapon.sqf
Normal file
@ -0,0 +1,68 @@
|
||||
/* KiloSwiss */
|
||||
private["_startPos","_endPos","_timeout","_name","_missionID","_missionType","_dir","_missionObjects","_convoyVehicles","_group","_box1","_hintString","_convoy","_start","_units","_endCondition","_enterableVehicles"];
|
||||
|
||||
_startPos = _this select 0 select 0;
|
||||
_endPos = _this select 0 select 1;
|
||||
_name = _this select 1 select 1;
|
||||
_timeOut = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_dir = (_this select 0) call BIS_fnc_dirTo;
|
||||
_missionObjects = [];
|
||||
_convoyVehicles = [];
|
||||
_enterableVehicles = [];
|
||||
//--
|
||||
|
||||
_convoyVeh1 = ["I_G_Offroad_01_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_mainVehicle = ["I_Truck_02_transport_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
_convoyVeh2 = ["I_G_Offroad_01_armed_F",_startPos,1,0,_dir] call SEM_fnc_spawnVehicle;
|
||||
{_convoyVehicles pushBack _x}forEach [_convoyVeh1, _mainVehicle, _convoyVeh2];
|
||||
|
||||
//_enterableVehicles pushBack _mainVehicle;
|
||||
|
||||
//--
|
||||
_box1 = createVehicle ["Box_NATO_Wps_F", _startPos, [], 30, "NO_COLLIDE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
_box1 setDir (getDir _mainVehicle);
|
||||
[_box1, _mainVehicle] call SEM_fnc_attachtoVeh;
|
||||
|
||||
//--
|
||||
_group = [_startPos,(5+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
|
||||
_convoy = [_group, _endPos, _missionID, _mainVehicle, _convoyVehicles, _enterableVehicles] spawn SEM_fnc_AIconvoy;
|
||||
|
||||
_hintString = format["<t align='center' size='2.0' color='#f29420'>Mission<br/>%1</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>Blablablablabla!", _name];
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
|
||||
/* Mission End Conditions */
|
||||
waitUntil{sleep 1; scriptDone _convoy};
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [(getPos _mainVehicle),_units,_start,_timeout,_missionID,[_mainVehicle,_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1] call SEM_fnc_crateLoot;
|
||||
_box1 call SEM_fnc_safeDetach;
|
||||
{_x call SEM_fnc_vehicleUnlock}count _enterableVehicles;
|
||||
{_x setVehicleAmmo 0}count _convoyVehicles;
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_convoyVehicles spawn{{_x setDamage 1} count _this; sleep 300; {deleteVehicle _x}count _this};
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
75
sem/missionsStatic/bCamp_big.sqf
Normal file
75
sem/missionsStatic/bCamp_big.sqf
Normal file
@ -0,0 +1,75 @@
|
||||
private["_pos","_timeout","_cleanup","_missionID","_missionType","_missionObjects","_group","_composition","_compositions","_compositionObjects","_hintString","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: bCamp.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_compositions =["camp4"];
|
||||
_composition = _compositions select random (count _compositions -1);
|
||||
_compositionObjects = [_composition, (random 359), _pos] call SEM_fnc_createComposition;
|
||||
{
|
||||
_missionObjects pushBack _x
|
||||
} forEach _compositionObjects;
|
||||
|
||||
_group1 = [_pos,4] call SEM_fnc_spawnAI;
|
||||
_group2 = [_pos,4] call SEM_fnc_spawnAI;
|
||||
_group3 = [_pos,(4+round(random 1))] call SEM_fnc_spawnAI;
|
||||
_units = units _group1 + units _group2 + units _group3;
|
||||
{
|
||||
_missionObjects pushBack _x
|
||||
} forEach _units;
|
||||
|
||||
[_group1, _pos] call SEM_fnc_AImove;
|
||||
[_group2, _pos] call SEM_fnc_AImove;
|
||||
[_group3, _pos] call SEM_fnc_AImove;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Bandit Base</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A bandit Base has been discovered!<br/>
|
||||
You have our permission to confiscate any property you find as payment for eliminating the threat!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
_start = time;
|
||||
waitUntil{ uisleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if (_endCondition == 3) then { //Win!
|
||||
if (SEM_MissionCleanup > 0) then {
|
||||
[_pos, _missionObjects] call SEM_fnc_missionCleanup
|
||||
};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}
|
||||
else { // 1 or 2 = Fail
|
||||
{
|
||||
deleteVehicle _x;
|
||||
uisleep 0.1
|
||||
} forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
};
|
||||
|
||||
deleteGroup _group1;
|
||||
deleteGroup _group2;
|
||||
deleteGroup _group3;
|
72
sem/missionsStatic/bCamp_small.sqf
Normal file
72
sem/missionsStatic/bCamp_small.sqf
Normal file
@ -0,0 +1,72 @@
|
||||
private["_pos","_timeout","_cleanup","_missionID","_missionType","_missionObjects","_group","_composition","_compositions","_compositionObjects","_hintString","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: bCamp.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_compositions =["camp1","camp2","camp3"];
|
||||
_composition = _compositions select random (count _compositions -1);
|
||||
_compositionObjects = [_composition, (random 359), _pos] call SEM_fnc_createComposition;
|
||||
{
|
||||
_missionObjects pushBack _x
|
||||
} forEach _compositionObjects;
|
||||
|
||||
_group1 = [_pos,(4+(random 1))] call SEM_fnc_spawnAI;
|
||||
_group2 = [_pos,(4+(random 1))] call SEM_fnc_spawnAI;
|
||||
_units = units _group1 + units _group2;
|
||||
{
|
||||
_missionObjects pushBack _x
|
||||
} forEach _units;
|
||||
|
||||
[_group1, _pos] call SEM_fnc_AImove;
|
||||
[_group2, _pos] call SEM_fnc_AImove;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Bandit Base Camp</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A bandit camp has been discovered!<br/>
|
||||
You have our permission to confiscate any property you find as payment for eliminating the threat!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
_start = time;
|
||||
waitUntil{ uisleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if (_endCondition == 3) then { //Win!
|
||||
if (SEM_MissionCleanup > 0) then {
|
||||
[_pos, _missionObjects] call SEM_fnc_missionCleanup
|
||||
};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}
|
||||
else { // 1 or 2 = Fail
|
||||
{
|
||||
deleteVehicle _x;
|
||||
uisleep 0.1
|
||||
} forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
};
|
||||
|
||||
deleteGroup _group1;
|
||||
deleteGroup _group2;
|
73
sem/missionsStatic/bDevice.sqf
Normal file
73
sem/missionsStatic/bDevice.sqf
Normal file
@ -0,0 +1,73 @@
|
||||
private["_pos","_timeout","_name","_missionID","_missionType","_missionObjects","_group","_box1","_camonet","_wreck","_hintString","_boxPos","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: bCamp.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_wreck = createVehicle ["Land_Device_disassembled_F",_pos,[], 0, "NONE"];
|
||||
_missionObjects pushBack _wreck;
|
||||
_wreck setDir (random 360);
|
||||
_wreck setPos _pos;
|
||||
|
||||
_camonet = createVehicle ["CamoNet_INDP_open_F",_pos,[], 0, "NO_COLLIDE"];
|
||||
_missionObjects pushBack _camonet;
|
||||
_camonet setDir (getDir _wreck);
|
||||
_camonet setPos _pos;
|
||||
|
||||
_boxPos = (_wreck modelToWorld [4,0,0]);
|
||||
_boxPos set [2,0];
|
||||
_box1 = createVehicle ["Box_NATO_Wps_F", _boxPos, [], 0, "NO_COLLIDE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
_box1 setDir (getDir _wreck);
|
||||
_box1 setPos _boxPos;
|
||||
|
||||
_group = [_pos,(6+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
[_group, _pos] call SEM_fnc_AImove;
|
||||
//[_group, _pos] spawn SEM_fnc_AIsetOwner;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Device discovered!</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A nuclear device has been discovered<br/>
|
||||
Remove the device and enemies as soon as possible!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID,[_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1,1] call SEM_fnc_crateLoot;
|
||||
if(SEM_MissionCleanup > 0)then{[_pos, _missionObjects] call SEM_fnc_missionCleanup};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
59
sem/missionsStatic/bHeliCrash.sqf
Normal file
59
sem/missionsStatic/bHeliCrash.sqf
Normal file
@ -0,0 +1,59 @@
|
||||
private["_pos","_timeout","_cleanup","_missionID","_missionType","_missionObjects","_group","_box1","_wreck","_hintString","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: bHeliCrash.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_wreck = createVehicle ["Land_Wreck_Heli_Attack_02_F", _pos, [], 0, "NONE"];
|
||||
_missionObjects pushBack _wreck;
|
||||
_wreck setDir (random 360);
|
||||
_wreck setPos _pos;
|
||||
|
||||
_box1 = createVehicle ["Box_NATO_WpsSpecial_F", _pos, [], 15, "NONE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
|
||||
_group = [_pos,(6+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
[_group, _pos] call SEM_fnc_AImove;
|
||||
//[_group, _pos] spawn SEM_fnc_AIsetOwner;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Heli Crash</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A heli with supplies and bandit troops has crashed<br/>
|
||||
You have our permission to confiscate any property you find as payment for eliminating the threat!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID,[_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1,1] call SEM_fnc_crateLoot;
|
||||
if(SEM_MissionCleanup > 0)then{[_pos, _missionObjects] call SEM_fnc_missionCleanup};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
59
sem/missionsStatic/bPlaneCrash.sqf
Normal file
59
sem/missionsStatic/bPlaneCrash.sqf
Normal file
@ -0,0 +1,59 @@
|
||||
private["_pos","_timeout","_cleanup","_missionID","_missionType","_missionObjects","_group","_box1","_wreck","_hintString","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: bPlaneCrash.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_wreck = createVehicle ["Land_Wreck_Plane_Transport_01_F", _pos, [], 0, "NONE"];
|
||||
_missionObjects pushBack _wreck;
|
||||
_wreck setDir (random 360);
|
||||
_wreck setPos _pos;
|
||||
|
||||
_box1 = createVehicle ["Box_NATO_WpsSpecial_F", _pos, [], 15, "NONE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
|
||||
_group = [_pos,(6+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
[_group, _pos] call SEM_fnc_AImove;
|
||||
//[_group, _pos] spawn SEM_fnc_AIsetOwner;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Supply Plane</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A supply plane has crashed<br/>
|
||||
You have our permission to confiscate any property you find as payment for eliminating the threat!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID,[_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1,1] call SEM_fnc_crateLoot;
|
||||
if(SEM_MissionCleanup > 0)then{[_pos, _missionObjects] call SEM_fnc_missionCleanup};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
72
sem/missionsStatic/bSupplyCrash.sqf
Normal file
72
sem/missionsStatic/bSupplyCrash.sqf
Normal file
@ -0,0 +1,72 @@
|
||||
private["_pos","_timeout","_cleanup","_missionID","_missionType","_missionObjects","_group","_box1","_truck","_wreck","_smallWrecks","_truckWrecks","_wreckPos","_hintString","_start","_units","_endCondition"];
|
||||
/*
|
||||
Based Of drsubo Mission Scripts
|
||||
File: supplyVanCrash.sqf
|
||||
Author: Cammygames, drsubo
|
||||
Edited by KiloSwiss
|
||||
*/
|
||||
|
||||
_pos = _this select 0;
|
||||
_name = _this select 1 select 1;
|
||||
_timeout = _this select 1 select 2; //Mission timeout
|
||||
_missionID = _this select 2;
|
||||
_missionType = _this select 3;
|
||||
_missionObjects = [];
|
||||
//--
|
||||
|
||||
_smallWrecks = ["Land_Wreck_HMMWV_F","Land_Wreck_Hunter_F","Land_Wreck_Van_F","Land_Wreck_Ural_F"];
|
||||
|
||||
_truck = createVehicle ["Land_Wreck_Truck_dropside_F",_pos,[], 0, "NONE"];
|
||||
_missionObjects pushBack _truck;
|
||||
_truck setDir (random 360);
|
||||
_truck setPos _pos;
|
||||
|
||||
_wreckPos = (_truck modelToWorld [(2-(random 4)),(if(random 1 > 0.5)then[{12},{-12}]),0]);
|
||||
_wreckPos set [2,0];
|
||||
_wreck = _smallWrecks select random(count _smallWrecks -1);
|
||||
_wreck = createVehicle [_wreck,_wreckPos,[], 0, "NONE"];
|
||||
_missionObjects pushBack _wreck;
|
||||
_wreck setDir ((getDir _truck)+(if(random 1 > 0.5)then[{+(random 12)},{-(random 12)}]));
|
||||
_wreck setPos _wreckPos;
|
||||
|
||||
_box1 = createVehicle ["C_supplyCrate_F", _pos, [], 3, "NONE"];
|
||||
_missionObjects pushBack _box1;
|
||||
_box1 call SEM_fnc_emptyGear;
|
||||
_box1 attachTo [_truck,[-1.2345,1.2,.345]];
|
||||
deTach _box1; /* Let it fall off */
|
||||
|
||||
_group = [_pos,(6+(random 2))] call SEM_fnc_spawnAI;
|
||||
{_missionObjects pushBack _x}forEach units _group;
|
||||
[_group, _pos] call SEM_fnc_AImove;
|
||||
//[_group, _pos] spawn SEM_fnc_AIsetOwner;
|
||||
|
||||
_hintString = "<t align='center' size='2.0' color='#f29420'>Mission<br/>Supply Van Crash</t><br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>A supply van with base building material has crashed!<br/>
|
||||
You have our permission to confiscate any property you find as payment for eliminating the threat!";
|
||||
[0,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
|
||||
/* Mission End Conditions */
|
||||
|
||||
_start = time;
|
||||
_units = units _group;
|
||||
waitUntil{ sleep 5;
|
||||
_endCondition = [_pos,_units,_start,_timeout,_missionID,[_box1]]call SEM_fnc_endCondition;
|
||||
(_endCondition > 0)
|
||||
};
|
||||
|
||||
SEM_globalMissionMarker = [false,_endCondition,_missionID,_missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
if(_endCondition == 3)then[{ //Win!
|
||||
[_box1,1] call SEM_fnc_crateLoot;
|
||||
if(SEM_MissionCleanup > 0)then{[_pos, _missionObjects] call SEM_fnc_missionCleanup};
|
||||
_hintString = "<t align='center' size='2.0' color='#6bab3a'>Mission success<br/>
|
||||
<t size='1.25' color='#ffff00'>______________<br/><br/>All bandits have been defeated!";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
},{ // 1 or 2 = Fail
|
||||
{deleteVehicle _x; sleep .1}forEach _missionObjects;
|
||||
_hintString = "<t align='center' size='2.0' color='#ab2121'>Mission FAILED</t>";
|
||||
[_endCondition,_hintString] remoteexec ["SEM_Client_GlobalHint",-2];
|
||||
}];
|
||||
|
||||
deleteGroup _group;
|
51
sem/missionsStatic/compositions/camp1.sqf
Normal file
51
sem/missionsStatic/compositions/camp1.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
private ["_objs"];
|
||||
_objs =
|
||||
[
|
||||
["Land_CncWall1_F",[-2.03516,0.556641,-1.85966e-005],137.606,1,0,"_this setVectorUp [0,0,1]"],
|
||||
["Land_CncWall1_F",[2.19727,0.253906,-1.66893e-005],227.703,1,0,"_this setVectorUp [0,0,1]"],
|
||||
["Land_CncWall1_F",[1.91406,-4.06055,0.000117779],318.571,1,0,"_this setVectorUp [0,0,1]"],
|
||||
["Land_CncWall1_F",[-2.5293,-3.76953,-0.000117779],47.7458,1,0,"_this setVectorUp [0,0,1]"],
|
||||
["Land_CncWall4_F",[6.28516,1.91797,0.000105381],270.731,1,0],
|
||||
["Land_CncWall1_F",[7.00195,-0.888672,-5.24521e-006],180.23,1,0],
|
||||
["Land_CncBarrierMedium_F",[5.74805,5,9.01222e-005],224.048,1,0],
|
||||
["Land_ToiletBox_F",[7.67383,-2.74023,3.19481e-005],88.3438,1,0],
|
||||
["Land_CncWall1_F",[8.29102,-0.896484,0.000154972],180.23,1,0],
|
||||
["Land_RattanTable_01_F",[4.44531,-7.15625,4.76837e-007],5.7211,1,0],
|
||||
["Land_GymRack_01_F",[-8.67773,0.246094,6.62804e-005],88.887,1,0],
|
||||
["Land_WoodenTable_large_F",[-4.76367,-7.41602,2.38419e-006],299.179,1,0],
|
||||
["Land_GymBench_01_F",[-8.63281,-2.55273,5.38826e-005],269.768,1,0],
|
||||
["MetalBarrel_burning_F",[1.58398,8.84766,1.66893e-005],0,1,0],
|
||||
["Land_ChairPlastic_F",[3.77539,-8.3457,1.78814e-005],295.095,1,0],
|
||||
["Land_ChairPlastic_F",[5.64648,-7.26563,1.78814e-005],182.996,1,0],
|
||||
["Land_ChairPlastic_F",[-3.375,-8.86719,1.85966e-005],241.077,1,0],
|
||||
["Land_CncShelter_F",[9.62695,0.476563,0.000114918],90.4933,1,0],
|
||||
["Land_GymRack_03_F",[-8.86328,-4.57813,-0.000160694],271.388,1,0],
|
||||
["MetalBarrel_burning_F",[8.29297,-5.64258,-5.38826e-005],0,1,0],
|
||||
["Land_Bench_F",[-5.46875,-8.45508,2.38419e-006],120.094,1,0],
|
||||
["Land_CncWall4_F",[-10.4707,1.25977,8.10623e-006],89.1825,1,0],
|
||||
["Land_CncBarrierMedium_F",[-8.76758,5.40625,-0.000279903],141.274,1,0],
|
||||
["Land_CncWall4_F",[3.375,10.0684,0.000101566],179.973,1,0],
|
||||
["Land_BagBunker_Large_F",[-3.70898,10.3105,3.09944e-005],179.083,1,0],
|
||||
["Land_CncWall4_F",[10.1172,-3.37891,0.000106335],270.731,1,0],
|
||||
["Land_WaterCooler_01_old_F",[-8.84375,-6.03906,7.27177e-005],44.5031,1,0],
|
||||
["Land_CncWall4_F",[-10.418,-3.875,-2.90871e-005],89.1807,1,0],
|
||||
["Land_CncWall4_F",[10.2344,4.41211,6.62804e-005],270.614,1,0],
|
||||
["Land_CncBarrierMedium_F",[-9.94141,4.48047,1.00136e-005],141.274,1,0],
|
||||
["Land_HBarrierBig_F",[6.91992,-9,4.91142e-005],329.663,1,0],
|
||||
["Land_CncBarrierMedium_F",[5.20508,-9.96289,-0.215637],146.229,1,0],
|
||||
["Land_CncWall4_F",[8.0332,8.60547,6.1512e-005],214.572,1,0],
|
||||
["Land_CncBarrierMedium_F",[-5.72266,-10.166,-0.348724],30.8811,1,0],
|
||||
["Land_CncBarrierMedium_F",[8.61523,-8.08594,-0.226772],145.456,1,0],
|
||||
["Land_HBarrierBig_F",[-7.26953,-9.29883,-0.000293255],31.8765,1,0],
|
||||
["Land_HBarrierTower_F",[0.00585938,-12.123,-0.000235081],358.383,1,0],
|
||||
["Land_CncBarrierMedium_F",[-8.80469,-8.12109,-0.258788],31.1346,1,0],
|
||||
// ["Box_NATO_WpsSpecial_F",[-4.05078,9.38672,0.23],88.477,1,0,"[_this,2]call SEM_fnc_crateLoot"],
|
||||
// ["Land_MetalCase_01_large_F",[0.00195313,-9.41016,-3.57628e-006],88.0797,1,0,"[_this,1]call SEM_fnc_crateLoot"],
|
||||
["Box_NATO_AmmoVeh_F",[0.0625,-1.94922,-2.38419e-006],344.12,1,0,"[_this,0]call SEM_fnc_crateLoot"]
|
||||
];
|
||||
_objs
|
41
sem/missionsStatic/compositions/camp2.sqf
Normal file
41
sem/missionsStatic/compositions/camp2.sqf
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
private ["_objs"];
|
||||
_objs =
|
||||
[
|
||||
["Land_BagFence_Round_F",[0.757813,0.849609,-0.000125408],223.283,1,0],
|
||||
["Land_BagFence_Short_F",[1.14063,-1.47461,-0.000127316],90.2709,1,0],
|
||||
["Land_BagFence_Short_F",[-1.45703,1.28125,-2.81334e-005],0.678136,1,0],
|
||||
["Land_BagFence_Round_F",[0.548828,-3.72656,-0.000146866],319.226,1,0],
|
||||
["Land_BagFence_Round_F",[-3.83203,0.935547,-7.58171e-005],135.737,1,0],
|
||||
["Land_BagFence_Short_F",[-1.80859,-4.03125,7.10487e-005],0.678136,1,0],
|
||||
["Land_BagFence_Short_F",[-4.35938,-1.4043,1.57356e-005],90.2709,1,0],
|
||||
["Land_WoodenTable_large_F",[4.375,-1.82227,2.6226e-006],91.0072,1,0],
|
||||
["Land_BagFence_Round_F",[-4.08398,-3.50781,-4.52995e-005],47.0398,1,0],
|
||||
["Land_BarrelEmpty_grey_F",[-2.04102,5.2207,6.12736e-005],0.00310008,1,0],
|
||||
["Land_FieldToilet_F",[1.45313,-6.13281,2.3365e-005],90.4438,1,0],
|
||||
["Land_HBarrierWall4_F",[-1.08789,6.39844,-0.000239849],3.9928,1,0],
|
||||
["Land_BarrelEmpty_grey_F",[7.05273,2.29883,6.12736e-005],0.00309681,1,0],
|
||||
["Land_BarrelEmpty_grey_F",[7.01563,3.57422,6.12736e-005],0.00314962,1,0],
|
||||
["Land_HBarrierWall6_F",[9.16211,1.94141,-0.000191212],93.0184,1,0],
|
||||
["Land_HBarrierWall_corner_F",[-5.73242,5.98633,-5.67436e-005],273.483,1,0],
|
||||
["Land_PaperBox_open_full_F",[-2.44336,-8.30859,-0.000125408],358.264,1,0],
|
||||
["MetalBarrel_burning_F",[0.451172,-8.80469,0.000204563],0,1,0],
|
||||
["Land_Pallet_MilBoxes_F",[-4.4707,-8.16016,-0.000335217],91.9018,1,0],
|
||||
["Land_BagBunker_Tower_F",[7.4043,-5.54102,-1.43051e-006],270.266,1,0],
|
||||
["MetalBarrel_burning_F",[6.96094,6.125,-0.000161648],0,1,0],
|
||||
["Land_HBarrierWall6_F",[-9.89258,-4.11914,-6.05583e-005],272.841,1,0],
|
||||
["Land_HBarrierWall_corner_F",[1.81055,-9.55078,1.38283e-005],90.7513,1,0],
|
||||
["Land_HBarrierWall4_F",[-2.7168,-9.94727,-2.81334e-005],184.12,1,0],
|
||||
["Land_HBarrierWall_corner_F",[7.54297,7.41797,0.000103474],1.63958,1,0],
|
||||
["Land_HBarrierWall_corridor_F",[-10.8281,2.49219,-6.7234e-005],1.70905,1,0],
|
||||
["Land_HBarrierWall_corridor_F",[2.61914,11.1465,2.38419e-006],271.076,1,0],
|
||||
["Land_HBarrierWall_corner_F",[-8.21289,-9.62695,4.76837e-007],181.676,1,0],
|
||||
// ["Box_NATO_WpsSpecial_F",[4.97461,-5.53125,0],270.708,1,0,"[_this,2]call SEM_fnc_crateLoot"],
|
||||
// ["Land_MetalCase_01_large_F",[-7.32031,-8.11719,1.19209e-006],132.164,1,0,"[_this,1]call SEM_fnc_crateLoot"],
|
||||
["Box_NATO_AmmoVeh_F",[-1.76563,-1.27539,1.43051e-006],337.757,1,0,"[_this,0]call SEM_fnc_crateLoot"]
|
||||
];
|
||||
_objs
|
65
sem/missionsStatic/compositions/camp3.sqf
Normal file
65
sem/missionsStatic/compositions/camp3.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
private ["_objs"];
|
||||
_objs =
|
||||
[
|
||||
["Land_Obstacle_Pass_F",[-0.939453,1.53906,-1.07127],180.173,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["MetalBarrel_burning_F",[-1.85742,-1.82422,-3.19481e-005],0.128915,1,0],
|
||||
["Land_CncBarrierMedium_F",[2.31055,-1.67188,-0.724247],91.0734,1,0],
|
||||
["Land_CncWall4_F",[-2.66211,-0.339844,-1.38283e-005],269.841,1,0],
|
||||
["Land_CncWall4_F",[2.70898,2.36523,0.000135899],0.887989,1,0],
|
||||
["Land_CncWall4_F",[2.05078,-3.125,-1.09673e-005],180.487,1,0],
|
||||
["Land_Obstacle_Pass_F",[-3.94531,1.51758,-1.0242],180.173,1,0],
|
||||
["Land_CncWall4_F",[-3.11328,-3.01367,0.000207424],0.415082,1,0],
|
||||
["Land_CncBarrierMedium_F",[-2.37305,3.50781,-0.178329],89.3517,1,0],
|
||||
["Land_CncWall4_F",[4.85742,-0.53125,-4.33922e-005],90.9194,1,0],
|
||||
["GroundWeaponHolder",[-0.199219,6.30664,0],271.646,1,0],
|
||||
["Land_CncShelter_F",[6.61719,1.43945,-2.43187e-005],1.5348,1,0],
|
||||
["Land_BagBunker_Large_F",[-3.06836,7.04883,-1.09673e-005],180.251,1,0],
|
||||
["Land_HBarrierBig_F",[2.82813,6.96289,0.000105381],271.904,1,0],
|
||||
["Land_Obstacle_Crawl_F",[-7.82617,0.746094,3.57628e-005],90.7407,1,0],
|
||||
["Land_CncBarrierMedium4_F",[-8.18555,-1.26367,-1.7643e-005],1.40305,1,0],
|
||||
["Land_CncWall4_F",[-8.27344,-2.96875,0.000179768],0.689722,1,0],
|
||||
["Land_CncBarrierMedium4_F",[8.44336,-3.13281,-0.00012064],0.62749,1,0],
|
||||
["Land_CncBarrierMedium_F",[-8.70313,3.17188,-6.53267e-005],180.687,1,0],
|
||||
["Land_Obstacle_RunAround_F",[5.81445,7.99805,-9.53674e-006],1.1785,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["Land_HBarrierBig_F",[8.88086,4.25391,-5.10216e-005],92.8236,1,0],
|
||||
["Land_Obstacle_Cross_F",[10.0273,-1.2168,4.29153e-006],89.424,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["Land_CncShelter_F",[-9.01367,4.54297,-0.000121593],0.647442,1,0],
|
||||
["I_HMG_01_A_F",[-9.03711,5.17773,0.00170755],359.754,1,0],
|
||||
["Land_CncBarrierMedium_F",[-9.98242,3.17578,-2.0504e-005],180.687,1,0],
|
||||
["Land_CncBarrierMedium_F",[1.17188,12.5117,-1.28746e-005],90.4673,1,0],
|
||||
["Land_ConcretePipe_F",[-12.1543,3.31641,0.0604606],1.48036,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["Land_CncWall4_F",[-12.4277,-0.685547,0.00018549],237.848,1,0],
|
||||
["Land_CncBarrierMedium4_F",[-10.6855,7.16797,8.10623e-006],89.8421,1,0],
|
||||
["Land_CncBarrierMedium_F",[-3.60742,12.5703,0.000341892],89.7082,1,0],
|
||||
["Land_ConcretePipe_F",[-12.1523,6.31445,0.0511794],0.516319,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["MetalBarrel_burning_F",[7.03906,12.1895,-1.85966e-005],0.372423,1,0],
|
||||
["Land_CncShelter_F",[0.0234375,14.1914,1.7643e-005],0.0516688,1,0],
|
||||
["Land_CncShelter_F",[-2.41211,14.1855,-4.14848e-005],0.00567879,1,0],
|
||||
["Land_CncShelter_F",[2.46484,14.2031,-0.000396252],0.00567879,1,0],
|
||||
["Land_CncBarrierMedium4_F",[-13.6445,5.33789,-7.00951e-005],90.2575,1,0],
|
||||
["Land_CncShelter_F",[-4.85352,14.1738,0.00037241],0.0516688,1,0],
|
||||
["Land_ConcretePipe_F",[-12.1582,9.35742,0.0404024],359.299,1,0,"_this enableSimulation false; _this allowDamage false"],
|
||||
["Land_HBarrierBig_F",[9.11523,12.6914,-1.43051e-006],271.406,1,0],
|
||||
["Land_CncBarrierMedium_F",[-1.20508,15.8867,-0.000380993],89.7082,1,0],
|
||||
["Land_BagBunker_Small_F",[5.58398,14.6758,-4.24385e-005],1.38705,1,0],
|
||||
["Land_CncBarrierMedium_F",[3.49805,15.873,0.000109196],89.7082,1,0],
|
||||
["Land_CncBarrierMedium4_F",[0.490234,16.916,-0.0226235],0.696245,1,0],
|
||||
["Land_CncBarrierMedium_F",[-6.08203,15.8691,-2.6226e-005],89.7082,1,0],
|
||||
["MetalBarrel_burning_F",[-7.30273,15.9004,-6.81877e-005],1.38656,1,0],
|
||||
["Land_CncBarrierMedium_F",[5.12109,16.8945,0.000258923],182.057,1,0],
|
||||
["Land_CncBarrierMedium_F",[6.94141,16.8496,3.09944e-005],182.14,1,0],
|
||||
["Land_CncBarrierMedium4_F",[-6.9375,16.9727,-0.000205994],0.696245,1,0],
|
||||
["Land_HBarrierBig_F",[-2.9043,18.2578,7.86781e-005],1.59054,1,0],
|
||||
["Land_HBarrierBig_F",[5.76172,18.0664,4.43459e-005],2.27927,1,0],
|
||||
["Land_HBarrierBig_F",[-14.6777,13.2188,-1.28746e-005],92.3338,1,0],
|
||||
["Land_Pallets_stack_F",[-12.4121,16.1094,-2.38419e-007],13.2322,1,0],
|
||||
["Land_HBarrierBig_F",[-11.5391,18.3164,-0.000188351],2.27927,1,0],
|
||||
// ["Land_MetalCase_01_large_F",[-2.53906,6.50391,-0.0250037],179.146,1,0,"[_this,1]call SEM_fnc_crateLoot"],
|
||||
["Box_NATO_AmmoVeh_F",[3.27539,0.876953,-3.8147e-006],29.1847,1,0,"[_this,0]call SEM_fnc_crateLoot"]
|
||||
];
|
||||
_objs
|
118
sem/missionsStatic/compositions/camp4.sqf
Normal file
118
sem/missionsStatic/compositions/camp4.sqf
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
private ["_objs"];
|
||||
_objs =
|
||||
[
|
||||
["Land_LampStreet_small_F",[23513.1,18872.8,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Box_NATO_AmmoVeh_F",[23516.1,18872.8,0],0,1,0,"[_this,0]call SEM_fnc_crateLoot"],
|
||||
["Land_Obstacle_Crawl_F",[23551.5,18867.2,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_Obstacle_RunAround_F",[23546.4,18867.2,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23553.8,18867.9,0],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23549.1,18867.9,0],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23553.8,18868,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23549.1,18867.8,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrierTower_F",[23514.5,18839.7,0],359.091,[[-0.0158654,0.999874,0],[0,0,1]],false],
|
||||
["Land_HBarrierWall_corridor_F",[23551.4,18874.9,0.109977],91.3637,[[0.999717,-0.0237979,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23554,18859.4,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23554,18859.4,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23554.1,18850.9,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23548.9,18847.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23554.2,18851,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23548.8,18847.6,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23522,18840.5,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23530.5,18840.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.7,18867,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.7,18858.6,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.7,18867,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.6,18858.5,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_BagBunker_Tower_F",[23548.5,18851.8,0],269.091,[[-0.999874,-0.0158651,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23544.9,18874.9,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23498.6,18840.3,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23490.9,18841.7,0],204.015,[[-0.406971,-0.913441,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23544.9,18874.9,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23507,18840.2,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23490.9,18841.7,2.08234],204.469,[[-0.414204,-0.910184,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23538.8,18840.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23538.8,18840.7,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.6,18852.1,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.7,18852.2,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.8,18844.1,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23543.8,18844.1,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23530.5,18840.6,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23507,18840.3,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23522.1,18840.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23498.6,18840.3,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_Cargo_Patrol_V1_F",[23539.3,18844.1,-0.0557444],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_ScrapHeap_2_F",[23538.2,18854.4,0],142.727,[[0.605609,-0.795762,0],[0,-0,1]],false],
|
||||
["Land_Scrap_MRAP_01_F",[23531.3,18847,0],228.182,[[-0.745264,-0.666769,0],[-0,0,1]],false],
|
||||
["WaterPump_01_forest_F",[23522.7,18843.7,0],90,[[1,-4.37114e-008,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.6,18880.1,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.5,18888.5,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.3,18896.9,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_ReservoirTank_V1_F",[23494.1,18852.5,0],311.364,[[-0.750531,0.660836,0],[0,0,1]],false],
|
||||
["Land_Airport_Tower_dam_F",[23489.1,18884.9,0],5.9091,[[0.10295,0.994686,0],[0,0,1]],false],
|
||||
["Land_BagBunker_Large_F",[23493.1,18867.2,0],270.909,[[-0.999874,0.0158656,0],[0,0,1]],false],
|
||||
["Land_Cargo_HQ_V1_F",[23530.5,18883.6,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_Cargo_House_V1_F",[23530.1,18860.3,-0.0453615],179.546,[[0.00793154,-0.999969,0],[0,-0,1]],false],
|
||||
["Land_Cargo_House_V1_F",[23523.9,18860.2,-0.0453615],179.546,[[0.00793154,-0.999969,0],[0,-0,1]],false],
|
||||
["Land_Cargo_House_V1_F",[23517.6,18860.2,-0.0453615],179.546,[[0.00793154,-0.999969,0],[0,-0,1]],false],
|
||||
["Land_Cargo_House_V1_F",[23511.4,18860.1,-0.0453615],179.546,[[0.00793154,-0.999969,0],[0,-0,1]],false],
|
||||
["Land_BagBunker_Large_F",[23518.9,18902.9,0],180.455,[[-0.00793338,-0.999969,0],[-0,0,1]],false],
|
||||
["Land_Cargo40_white_F",[23507.1,18851.3,0],21.3637,[[0.364286,0.931287,0],[0,0,1]],false],
|
||||
["Land_Cargo20_military_green_F",[23520.8,18869.6,2.61306],89.9999,[[1,9.09963e-007,0],[0,0,1]],false],
|
||||
["Land_Wreck_HMMWV_F",[23523.2,18850.3,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_Wreck_Slammer_F",[23509.4,18888.8,0],48.6363,[[0.75053,0.660836,0],[0,0,1]],false],
|
||||
["Land_Wreck_Slammer_hull_F",[23505.1,18867.3,0],337.273,[[-0.386345,0.922354,0],[0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23536.1,18900,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23527.7,18899.9,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23510.3,18900,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23501.8,18899.9,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23493.4,18899.7,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23484.9,18899.5,0],180.833,[[-0.014536,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.6,18880,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.5,18888.6,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23541.2,18896.9,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23536.1,18899.9,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23527.7,18899.8,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23510.3,18900,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23501.8,18899.7,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23493.4,18899.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23484.9,18899.6,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23481.8,18894.4,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23481.9,18886.1,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482,18877.6,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.1,18869.3,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.2,18861,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.3,18852.6,0],90.8328,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23484.8,18846.2,0],50.3784,[[0.770272,0.637715,0],[0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23484.8,18846.1,2.08234],229.924,[[-0.765188,-0.643807,0],[-0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23481.8,18894.4,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482,18886.1,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.1,18877.7,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.3,18860.9,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.3,18852.6,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23519,18899.9,2.08234],180.833,[[-0.0145355,-0.999894,0],[-0,0,1]],false],
|
||||
["Land_Cargo40_white_F",[23523.6,18871.9,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_Cargo40_white_F",[23523.6,18867.6,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_Cargo40_white_F",[23503.6,18883.5,0],233.636,[[-0.805271,-0.592907,0],[-0,0,1]],false],
|
||||
["Land_Cargo20_military_green_F",[23517,18883.4,0],321.818,[[-0.618159,0.786053,0],[0,0,1]],false],
|
||||
["Land_Cargo20_military_green_F",[23524.5,18869.7,2.61306],70.9091,[[0.945001,0.327068,0],[0,0,1]],false],
|
||||
["Land_Cargo20_military_green_F",[23528.3,18869.6,2.61306],89.9999,[[1,9.09963e-007,0],[0,0,1]],false],
|
||||
["Land_Wreck_BRDM2_F",[23536.1,18867.6,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_HBarrier_Big_F",[23482.2,18869.2,2.08234],90.8329,[[0.999894,-0.0145356,0],[0,-0,1]],false],
|
||||
["Land_Cargo20_military_green_F",[23533.6,18894.7,0],0.454559,[[0.00793347,0.999969,0],[0,0,1]],false],
|
||||
["Land_ScrapHeap_2_F",[23521.9,18893.7,0],105.455,[[0.963842,-0.266474,0],[0,-0,1]],false],
|
||||
["Land_HBarrierWall_corridor_F",[23556,18874.9,0],89.5455,[[0.999969,0.00793242,0],[0,0,1]],false],
|
||||
["Land_HBarrierWall_corridor_F",[23544.8,18889,0],89.5455,[[0.999969,0.00793242,0],[0,0,1]],false],
|
||||
["Land_HBarrierWall_corner_F",[23555.1,18889.8,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_HBarrierWall4_F",[23549.6,18889.6,0],0,[[0,1,0],[0,0,1]],false],
|
||||
["Land_CncWall4_F",[23557.4,18880.3,0],268.636,[[-0.999717,-0.0237976,0],[-0,0,1]],false],
|
||||
["Land_CncWall4_F",[23557.3,18885.5,0],268.636,[[-0.999717,-0.0237976,0],[-0,0,1]],false],
|
||||
["Land_CncWall4_F",[23549.4,18882.6,0],131.818,[[0.745265,-0.666769,0],[0,-0,1]],false],
|
||||
["Land_MetalCase_01_large_F",[23519.6,18900.1,0],270,1,0,"[_this,0]call SEM_fnc_crateLoot"]
|
||||
|
||||
];
|
||||
_objs
|
303
sem/scripts/ai/_____fn_AIconvoy.sqf
Normal file
303
sem/scripts/ai/_____fn_AIconvoy.sqf
Normal file
@ -0,0 +1,303 @@
|
||||
/* KiloSwiss */
|
||||
private["_group","_endPos","_missionID","_mainVehicle","_convoyVehicles","","","","",""];
|
||||
|
||||
_group = _this select 0;
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_convoyVehicles = _this select 4;
|
||||
|
||||
/* Marker position update */
|
||||
_this spawn { private["_endPos","_missionID","_mainVehicle","_oldPos","_newPos"];
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_oldPos = position _mainVehicle;
|
||||
|
||||
while{alive _mainVehicle && _mainVehicle distance _endPos > 20}do{
|
||||
UIsleep 10;
|
||||
_newPos = position _mainVehicle;
|
||||
if(_oldPos distance _newPos > 10)then{
|
||||
_oldPos = _newPos;
|
||||
SEM_updateMissionMarkerPos = [_missionID, _newPos];
|
||||
SEM_updateMissionMarkerPos call SEM_client_updateMissionMarkerPos;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_units = (units _group);
|
||||
_startPos = getPos _mainVehicle;
|
||||
{_group addVehicle _x; _x lock 3}forEach _convoyVehicles;
|
||||
|
||||
_vehFront = (if(count _convoyVehicles == 1)then[{_mainVehicle},{{if(_x != _mainVehicle)exitWith{_x}; (_convoyVehicles select 0)}count _convoyVehicles}];
|
||||
_ranks = ["COLONEL","MAJOR","CAPTAIN","LIEUTENANT","SERGEANT","CORPORAL","PRIVATE"];
|
||||
_convoyGrps = [];
|
||||
{
|
||||
_x setVariable ["AIrank", (_ranks select (_forEachIndex min (count _ranks -1)))];
|
||||
_x addEventHandler ["getIn",{ private "_unit";
|
||||
_unit = _this select 2;
|
||||
_unit setUnitRank (_this select 0 getVariable ["AIrank","PRIVATE"]);
|
||||
_unit joinSilent (format ["_convoy%1Grp%2", _missionID, _forEachIndex]);
|
||||
}];
|
||||
call compile format["
|
||||
_convoy%1Grp%2 = createGroup (side %3);
|
||||
_convoyGrps pushBack _convoy%1Grp%2;
|
||||
", _missionID, _forEachIndex, _group];
|
||||
|
||||
//assign at least one driver per vehicle
|
||||
(_units select _forEachIndex) assignAsDriver _x;
|
||||
(_units select _forEachIndex) moveInDriver _x;
|
||||
|
||||
}forEach [_vehFront, _mainVehicle] + [(_convoyVehicles - [_vehFront,_mainVehicle])];
|
||||
|
||||
//Order all Units to get in
|
||||
_units allowGetIn true;
|
||||
_units orderGetIn true;
|
||||
|
||||
//-- Get lowest TopSpeed from all vehicles
|
||||
_topSpeeds = [];
|
||||
{
|
||||
_maxSpd = getNumber (configFile >> "cfgVehicles" >> typeOf _x >> "maxSpeed");
|
||||
if(!isNil "_maxSpd")then{_topSpeeds pushBack _maxSpd};
|
||||
}forEach _convoyVehicles;
|
||||
|
||||
_select = 0;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
while{{_maxSpd > _x}count _topSpeeds != 0}do{
|
||||
_select = _select + 1;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
};
|
||||
{_x forceSpeed (_maxSpd*0.7)*0.2777778}forEach _convoyVehicles; // m/s
|
||||
//DEBUG
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["SEM DEBUG: Convoy Vehicles TopSpeeds: %1 - Selected lowest: %2", _topSpeeds, _maxSpd]};
|
||||
|
||||
|
||||
//Wait until every unit has boarded a vehicle
|
||||
waitUntil{sleep 1; {vehicle _x in _convoyVehicles}count (units _group) == 0};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
_unit1 = units _group select (count units _group -1);
|
||||
_unit1 assignAsDriver _veh;
|
||||
[_unit1] orderGetIn true;
|
||||
*/
|
||||
|
||||
_group move _endPos;
|
||||
_group setSpeedMode "NORMAL";//"FULL";
|
||||
_group setBehaviour "SAFE"; //"CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
_group setFormation "FILE";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_lastMoveCheck = time;
|
||||
_oldPos = getPos _vehFront;
|
||||
|
||||
|
||||
/* Convoy loop */
|
||||
_stayToDefend = true;
|
||||
while {_mainVehicle distance _endPos >= _distance} do { //CONVOY LOOP
|
||||
|
||||
_vehiclePos = getPos _mainVehicle;
|
||||
_vehFrontPos = getPos _vehFront;
|
||||
|
||||
if({!canMove _x}count _convoyVehicles > 0 && _stayToDefend)then{
|
||||
{if(canMove _x)then{(driver _x) doMove _vehiclePos;};}forEach _convoyVehicles;
|
||||
sleep 5;
|
||||
{
|
||||
if(_x distance _vehiclePos < 50)then{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
_x action ["GetOut", (vehicle _x)];
|
||||
sleep 0.5;
|
||||
[_x] orderGetIn false;
|
||||
[_x] allowGetIn false;
|
||||
_x doMove _vehiclePos;
|
||||
};
|
||||
}else{
|
||||
_x doMove _vehiclePos;
|
||||
};
|
||||
}forEach units _group;
|
||||
_group move _vehiclePos;
|
||||
_group setSpeedMode "FULL";
|
||||
|
||||
if({_x distance _veh2 < 50}count units _group == count units _group)then{
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
}else{
|
||||
//-- Work In Progress!
|
||||
|
||||
if({alive _x && !(vehicle _x in _convoyVehicles)}count units _group > 0)then{ //AI has left the vehicle
|
||||
_group setBehaviour "CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
{
|
||||
if(!(vehicle _x in _convoyVehicles))then{
|
||||
[_x] allowGetIn true;
|
||||
[_x] orderGetIn true;
|
||||
};
|
||||
}forEach units _group;
|
||||
sleep 10; //Brake the loop for 10 seconds
|
||||
_group move _endPos;
|
||||
_group setSpeedMode "NORMAL";
|
||||
|
||||
}else{ //Do vehicle speed management and continue travel to destination
|
||||
|
||||
_group setBehaviour "SAFE";
|
||||
_group setCombatMode "GREEN";
|
||||
_group setFormation "COLUMN";
|
||||
|
||||
if(time - _lastMoveCheck > 30)then{
|
||||
_lastMoveCheck = time;
|
||||
if(_vehFrontPos distance _oldPos < 10)then{
|
||||
//FAILSAFE IF CONVOY IS STUCK
|
||||
_group move _endPos;
|
||||
_group setSpeedMode "FULL";
|
||||
sleep 10; //Brake the loop for 10 seconds
|
||||
_group setSpeedMode "NORMAL";
|
||||
};
|
||||
_oldPos = getPos _vehFront;
|
||||
};
|
||||
|
||||
//-- Distance Checks
|
||||
// forceSpeed = m/s
|
||||
// limitSpeed = km/h
|
||||
// 1 km/h == ~0.2777778 m/s
|
||||
|
||||
//Check Formation
|
||||
_distanceA = _veh1 distance _veh2;
|
||||
_distanceB = _veh1 distance _veh3;
|
||||
if(_distanceA > _distanceB)then{
|
||||
_3inFrontOf2 = [_veh2, _veh3, 0] call BIS_fnc_isInFrontOf;
|
||||
if(_3inFrontOf2 || abs(_distanceA - _distanceB) > 10)then{//Swap Vehicles position in convoy (2 <-> 3)
|
||||
//diag_log format["A: Distance 1-2: %1 - Distance 1-3: %2", round (_veh1 distance _veh2), round (_veh1 distance _veh3)];
|
||||
_vehinMiddle = _veh3;
|
||||
_veh3 = _veh2;
|
||||
_veh2 = _vehinMiddle;
|
||||
//diag_log format["B: Distance 1-2: %1 - Distance 1-3: %2", round (_veh1 distance _veh2), round (_veh1 distance _veh3)];
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 1
|
||||
if(_veh1 distance _veh2 > 50 || _veh1 distance _veh3 > 80)then{
|
||||
if(_veh1 distance _veh2 > 80 || _veh1 distance _veh3 > 120)then{
|
||||
_veh1 forceSpeed (_maxSpd*0.1)*0.2777778;
|
||||
_veh1 limitSpeed (_maxSpd*0.1);
|
||||
}else{
|
||||
if(speed _veh3 < 10)then{
|
||||
_veh1 forceSpeed (speed _veh3)*0.2777778;
|
||||
_veh1 limitSpeed (speed _veh3);
|
||||
}else{
|
||||
_veh1 forceSpeed (_maxSpd*0.4)*0.2777778;
|
||||
_veh1 limitSpeed (_maxSpd*0.4);
|
||||
};
|
||||
};
|
||||
}else{
|
||||
if(speed _veh3 < 10 && _veh1 distance _veh3 > 30)then{
|
||||
_veh1 forceSpeed (_maxSpd*0.1)*0.2777778;
|
||||
_veh1 limitSpeed (_maxSpd*0.1);
|
||||
}else{
|
||||
_veh1 forceSpeed (_maxSpd*0.7)*0.2777778; //-- m/s
|
||||
_veh1 limitSpeed (_maxSpd*0.7);
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 2
|
||||
if(_veh2 distance _veh1 > 40)then{
|
||||
if(_veh2 distance _veh3 > _veh2 distance _veh1)then{ //let Vehicle3 catch up
|
||||
_veh2 forceSpeed (_maxSpd*0.4)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.4);
|
||||
}else{
|
||||
if(speed _veh1 < 10)then{ //FAILSAFE IF CONVOY IS STUCK
|
||||
(driver _veh2) doMove (getPos _veh1);
|
||||
_veh2 forceSpeed (_maxSpd*0.7)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.7);
|
||||
}else{
|
||||
//Move faster to catch up with Vehicle1
|
||||
_veh2 forceSpeed _maxSpd*0.2777778;
|
||||
_veh2 limitSpeed _maxSpd;
|
||||
};
|
||||
};
|
||||
}else{
|
||||
if(_veh2 distance _veh1 < 20)then{
|
||||
_veh2 forceSpeed (speed _veh1)*0.2777778;
|
||||
_veh2 limitSpeed (speed _veh1);
|
||||
}else{
|
||||
_veh2 forceSpeed (_maxSpd*0.7)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.7);
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 3
|
||||
if(_veh3 distance _veh2 > 30 || _veh3 distance _veh1 > 60)then{ //catch up
|
||||
_veh3 forceSpeed _maxSpd*0.2777778;
|
||||
_veh3 limitSpeed _maxSpd;
|
||||
}else{
|
||||
if(_veh3 distance _veh2 < 15 && speed _veh2 > 5)then{
|
||||
_veh3 forceSpeed (speed _veh2)*0.2777778;
|
||||
_veh3 limitSpeed (speed _veh2);
|
||||
}else{
|
||||
if(speed _veh1 < 10)then{ //FAILSAFE IF CONVOY IS STUCK
|
||||
(driver _veh3) doMove (getPos _veh1);
|
||||
_veh3 forceSpeed (_maxSpd*0.7)*0.2777778;
|
||||
_veh3 limitSpeed (_maxSpd*0.7);
|
||||
}else{
|
||||
_veh3 forceSpeed (_maxSpd*0.7)*0.2777778;
|
||||
_veh3 limitSpeed (_maxSpd*0.7);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//code to end the while
|
||||
_unitsAlive = ({alive _x}count units _group);
|
||||
if(_unitsAlive < 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
if (damage _mainVehicle == 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
if({isPlayer _x && alive _x}count crew _mainVehicle > 0)then{
|
||||
doStop (units _group);
|
||||
{
|
||||
_x spawn{
|
||||
_this action ["engineOff", (vehicle _this)];
|
||||
sleep 0.5;
|
||||
deleteVehicle _this;
|
||||
};
|
||||
}foreach units _group;
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
|
||||
sleep 1;
|
||||
}; //END OF LOOP
|
||||
|
||||
diag_log "Dynamic Mission Status: Convoy Ended";
|
||||
|
||||
if({alive _x}count units _group > 0 && damage _mainVehicle < 1)then{
|
||||
{if(canMove _x)then{(driver _x) doMove _vehiclePos;};}forEach _convoyVehicles;
|
||||
sleep 10;
|
||||
{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
_x spawn{
|
||||
doStop _this;
|
||||
sleep 1;
|
||||
_this action ["engineOff", (vehicle _this)];
|
||||
_this action ["GetOut", (vehicle _this)];
|
||||
sleep 0.1;
|
||||
[_this] orderGetIn false;
|
||||
[_this] allowGetIn false;
|
||||
_this doMove _vehiclePos;
|
||||
};
|
||||
};
|
||||
}forEach units _group;
|
||||
_group move _vehiclePos;
|
||||
_group setBehaviour "AWARE";
|
||||
_group setFormation "FILE";
|
||||
_group setCombatMode "YELLOW";
|
||||
};
|
||||
|
||||
|
||||
|
348
sem/scripts/ai/___fn_AIconvoy.sqf
Normal file
348
sem/scripts/ai/___fn_AIconvoy.sqf
Normal file
@ -0,0 +1,348 @@
|
||||
/* KiloSwiss */
|
||||
private["_group","_endPos","_missionID","_mainVehicle","_convoyVehicles","_enterableVehicles","_convoyGrps","_ranks","_side","_vehiclePos","_vehFrontPos","_veh1","_veh2","_veh3","_start"];
|
||||
|
||||
_group = _this select 0;
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_convoyVehicles = _this select 4;
|
||||
_enterableVehicles = _this select 5;
|
||||
|
||||
/* Marker position update */
|
||||
_this spawn { private["_endPos","_missionID","_mainVehicle","_oldPos","_newPos"];
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_oldPos = position _mainVehicle;
|
||||
|
||||
while{alive _mainVehicle && _mainVehicle distance _endPos > 50}do{
|
||||
UIsleep 10;
|
||||
_newPos = position _mainVehicle;
|
||||
if(_oldPos distance _newPos > 10)then{
|
||||
_oldPos = _newPos;
|
||||
SEM_updateMissionMarkerPos = [_missionID, _newPos];
|
||||
SEM_updateMissionMarkerPos call SEM_client_updateMissionMarkerPos;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_units = (units _group);
|
||||
_side = side (_units select 0);
|
||||
_startPos = getPos _mainVehicle;
|
||||
|
||||
_vehFront = (if(count _convoyVehicles == 1)then[{_mainVehicle},{{if(_x != _mainVehicle)exitWith{_x}; (_convoyVehicles select 0)}count _convoyVehicles}]);
|
||||
|
||||
{_x setVariable ["AIskill",(skill _x)]}count _units;
|
||||
|
||||
_ranks = ["COLONEL","MAJOR","CAPTAIN","LIEUTENANT","SERGEANT","CORPORAL","PRIVATE"];
|
||||
{
|
||||
_x setFuel 1;
|
||||
_x setDamage 0;
|
||||
_group addVehicle _x;
|
||||
if(_x in _enterableVehicles)then[{_x lock 0},{_x lock 3}];
|
||||
_x setVariable ["AIrank", (_ranks select (_forEachIndex min (count _ranks -1)))];
|
||||
|
||||
_x addEventHandler ["getIn",{
|
||||
(_this select 2) setUnitRank ((_this select 0) getVariable ["AIrank","PRIVATE"]);
|
||||
if((_this select 1) == "driver")then{
|
||||
(_this select 2) setSkill 1;
|
||||
};
|
||||
}];
|
||||
|
||||
_x addEventHandler ["getOut",{
|
||||
(_this select 2) setSkill ((_this select 2) getVariable ["AIskill",0.7]);
|
||||
}];
|
||||
|
||||
_x addeventHandler ["handleDamage",{
|
||||
if(isNull (_this select 3))then{false};
|
||||
}];
|
||||
|
||||
// Fill driver seats first
|
||||
(_units select _forEachIndex) assignAsDriver _x;
|
||||
//(_units select _forEachIndex) moveInDriver _x;
|
||||
//(_units select _forEachIndex) setSkill 1;
|
||||
//(_units select _forEachIndex) setUnitRank (_x getVariable ["AIrank","PRIVATE"]);
|
||||
|
||||
if(_x emptyPositions "GUNNER" > 0)then{ // Assign a gunner
|
||||
_x allowCrewInImmobile true; //allow gunner to stay in immobilized vehicle
|
||||
(_units select (_forEachIndex + (count _convoyVehicles))) assignAsGunner _x;
|
||||
//(_units select (_forEachIndex + (count _convoyVehicles))) moveInGunner _x;
|
||||
//(_units select (_forEachIndex + (count _convoyVehicles))) setUnitRank (_x getVariable ["AIrank","PRIVATE"]);
|
||||
};
|
||||
|
||||
}forEach _convoyVehicles;
|
||||
|
||||
//Order all Units to get in
|
||||
_units allowGetIn true;
|
||||
_units orderGetIn true;
|
||||
|
||||
//Wait until every unit has boarded a vehicle
|
||||
_start = time;
|
||||
waitUntil{sleep 1;{(alive _x && vehicle _x == _x)}count _units == 0 || time - _start >= 30};
|
||||
if({alive _x && vehicle _x == _x}count _units > 0)then{
|
||||
{ /* Move stuck AI into vehicles */
|
||||
if(vehicle _x == _x)then{
|
||||
_y = _x;
|
||||
{ /* Fill driver/gunner seats first */
|
||||
if(_x emptyPositions "DRIVER" > 0)exitWith{_y moveInDriver _x; _y setSkill 1};
|
||||
if(_x emptyPositions "GUNNER" > 0)exitWith{_y moveInGunner _x};
|
||||
}forEach _convoyVehicles;
|
||||
{ /* Fill cargo seats */
|
||||
if(_x emptyPositions "CARGO" > 0)exitWith{_y moveInCargo _x};
|
||||
}forEach (_convoyVehicles - [_mainVehicle]);
|
||||
};
|
||||
_x setUnitRank ((vehicle _x) getVariable ["AIrank","PRIVATE"]);
|
||||
}forEach _units;
|
||||
};
|
||||
|
||||
//-- Get lowest TopSpeed from all vehicles
|
||||
_topSpeeds = [];
|
||||
{
|
||||
_maxSpd = getNumber (configFile >> "cfgVehicles" >> typeOf _x >> "maxSpeed");
|
||||
if(!isNil "_maxSpd")then{_topSpeeds pushBack _maxSpd};
|
||||
}forEach _convoyVehicles;
|
||||
|
||||
_select = 0;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
while{{_maxSpd > _x}count _topSpeeds != 0}do{
|
||||
_select = _select + 1;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
};
|
||||
{_x forceSpeed (_maxSpd*0.8)*0.2777778}forEach _convoyVehicles; // m/s
|
||||
//DEBUG
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["SEM DEBUG: Convoy Vehicles TopSpeeds: %1 - Selected lowest: %2", _topSpeeds, _maxSpd]};
|
||||
|
||||
|
||||
|
||||
hint "start";
|
||||
|
||||
_group move _endPos;
|
||||
//{driver _x move _endPos}count _convoyVehicles;
|
||||
_group setSpeedMode "FULL";//"FULL";
|
||||
_group setBehaviour "SAFE"; //"CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
_group setFormation "COLUMN";
|
||||
|
||||
/* temporary definition of 3 vehicles */
|
||||
_veh1 = _convoyVehicles select 0;
|
||||
_veh2 = _convoyVehicles select 1;
|
||||
_veh3 = _convoyVehicles select 2;
|
||||
|
||||
|
||||
_lastMoveCheck = time;
|
||||
_oldPos = getPos _mainVehicle;
|
||||
|
||||
/* Convoy loop */
|
||||
_stayToDefend = true;
|
||||
while{{_x distance _endPos < 20}count _convoyVehicles < 1}do{ //CONVOY LOOP
|
||||
|
||||
_vehiclePos = getPos _mainVehicle;
|
||||
_vehFrontPos = getPos _vehFront;
|
||||
|
||||
if({!canMove _x}count _convoyVehicles > 0 && _stayToDefend)then{
|
||||
{if(canMove _x)then{(driver _x) doMove _vehiclePos}}forEach _convoyVehicles;
|
||||
sleep 5;
|
||||
{
|
||||
if(_x distance _vehiclePos < 50)then[{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
_x action ["GetOut", (vehicle _x)];
|
||||
sleep 0.5;
|
||||
[_x] orderGetIn false;
|
||||
[_x] allowGetIn false;
|
||||
_x doMove _vehiclePos;
|
||||
};
|
||||
},{
|
||||
_x doMove _vehiclePos;
|
||||
}];
|
||||
}forEach units _group;
|
||||
_group move _vehiclePos;
|
||||
_group setSpeedMode "FULL";
|
||||
|
||||
if({_x distance _veh2 < 50}count units _group == count units _group)then{
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
}else{
|
||||
//-- Work In Progress!
|
||||
|
||||
if({alive _x && !(vehicle _x in _convoyVehicles)}count units _group > 0)then{ //AI has left the vehicle
|
||||
hint "AI has left the vehicle";
|
||||
_group setBehaviour "CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
{
|
||||
if(!(vehicle _x in _convoyVehicles))then{
|
||||
[_x] allowGetIn true;
|
||||
[_x] orderGetIn true;
|
||||
};
|
||||
}forEach units _group;
|
||||
sleep 10; //Brake the loop for 10 seconds
|
||||
_group move _endPos;
|
||||
//_group setSpeedMode "NORMAL";
|
||||
|
||||
}else{ //Do vehicle speed management and continue travel to destination
|
||||
|
||||
//_group move _endPos;
|
||||
//{driver _x move _endPos}count _convoyVehicles;
|
||||
_group setBehaviour "SAFE";
|
||||
_group setCombatMode "GREEN";
|
||||
//_group setFormation "COLUMN";//"FILE";
|
||||
_group setSpeedMode "FULL";
|
||||
|
||||
if(time - _lastMoveCheck > 60)then{
|
||||
_group move _endPos;
|
||||
_lastMoveCheck = time;
|
||||
if(_vehiclePos distance _oldPos < 30)then[{
|
||||
hint "Convoy is stuck";
|
||||
//FAILSAFE IF CONVOY IS STUCK
|
||||
{driver _x doMove _endPos}count _convoyVehicles;
|
||||
//_group setSpeedMode "FULL";
|
||||
sleep 10; //Brake the loop for 20 seconds
|
||||
//_group move _endPos;
|
||||
//_group setSpeedMode "NORMAL";
|
||||
},{_group move _endPos}];
|
||||
_oldPos = getPos _mainVehicle;
|
||||
_group move _endPos;
|
||||
};
|
||||
|
||||
//-- Distance Checks
|
||||
// forceSpeed = m/s
|
||||
// limitSpeed = km/h
|
||||
// 1 km/h == ~0.2777778 m/s
|
||||
|
||||
/*
|
||||
//Check Formation
|
||||
_distanceA = _veh1 distance _veh2;
|
||||
_distanceB = _veh1 distance _veh3;
|
||||
if(_distanceA > _distanceB)then{
|
||||
_3inFrontOf2 = [_veh2, _veh3, 0] call BIS_fnc_isInFrontOf;
|
||||
if(_3inFrontOf2 || abs(_distanceA - _distanceB) > 10)then{//Swap Vehicles position in convoy (2 <-> 3)
|
||||
//diag_log format["A: Distance 1-2: %1 - Distance 1-3: %2", round (_veh1 distance _veh2), round (_veh1 distance _veh3)];
|
||||
_vehinMiddle = _veh3;
|
||||
_veh3 = _veh2;
|
||||
_veh2 = _vehinMiddle;
|
||||
//diag_log format["B: Distance 1-2: %1 - Distance 1-3: %2", round (_veh1 distance _veh2), round (_veh1 distance _veh3)];
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
//Speed Management for Vehicle 1
|
||||
if(_veh1 distance _veh2 > 80 || _veh1 distance _veh3 > 120)then{
|
||||
if(_veh1 distance _veh2 > 100 || _veh1 distance _veh3 > 150)then{
|
||||
//_veh1 forceSpeed (_maxSpd*0.1)*0.2777778;
|
||||
_veh1 limitSpeed 0;
|
||||
}else{
|
||||
if(speed _veh3 < 10)then{
|
||||
//_veh1 forceSpeed (1 max (speed _veh3)*0.2777778);
|
||||
_veh1 limitSpeed (1 max (speed _veh3));
|
||||
}else{
|
||||
//_veh1 forceSpeed (_maxSpd*0.4)*0.2777778;
|
||||
_veh1 limitSpeed (_maxSpd*0.5);
|
||||
};
|
||||
};
|
||||
}else{
|
||||
if(speed _veh3 < 10)then{
|
||||
//_veh1 forceSpeed (_maxSpd*0.1)*0.2777778;
|
||||
_veh1 limitSpeed (_maxSpd*0.1);
|
||||
}else{
|
||||
//_veh1 forceSpeed (_maxSpd*0.8)*0.2777778; //-- m/s
|
||||
_veh1 limitSpeed (_maxSpd*0.8);
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 2
|
||||
if(_veh2 distance _veh1 > 80)then{
|
||||
if(_veh2 distance _veh3 < _veh2 distance _veh1)then{
|
||||
//_veh2 forceSpeed (_maxSpd*0.8)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.8);
|
||||
}else{
|
||||
//Move faster to catch up with Vehicle1
|
||||
//_veh2 forceSpeed _maxSpd*0.2777778;
|
||||
_veh2 limitSpeed _maxSpd;
|
||||
};
|
||||
}else{
|
||||
if(_veh2 distance _veh1 < 40)then{
|
||||
//_veh2 forceSpeed (1 max (speed _veh1)*0.2777778);
|
||||
_veh2 limitSpeed (1 max (speed _veh1));
|
||||
}else{
|
||||
if(_veh2 distance _veh3 > _veh2 distance _veh1)then{ //let Vehicle3 catch up
|
||||
//_veh2 forceSpeed (_maxSpd*0.5)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.5);
|
||||
}else{
|
||||
//_veh2 forceSpeed (_maxSpd*0.8)*0.2777778;
|
||||
_veh2 limitSpeed (_maxSpd*0.8);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 3
|
||||
if(_veh3 distance _veh2 > 80 || _veh3 distance _veh1 > 120)then{ //catch up
|
||||
//_veh3 forceSpeed _maxSpd*0.2777778;
|
||||
_veh3 limitSpeed _maxSpd;
|
||||
}else{
|
||||
if(_veh3 distance _veh2 < 40)then{
|
||||
//_veh3 forceSpeed (1 max (speed _veh2)*0.2777778);
|
||||
_veh3 limitSpeed (1 max (speed _veh2));
|
||||
}else{
|
||||
//if(speed _veh1 < 10)then{ //FAILSAFE IF CONVOY IS STUCK
|
||||
// (driver _veh3) doMove (getPos _veh1);
|
||||
//_veh3 forceSpeed (_maxSpd*0.8)*0.2777778;
|
||||
// _veh3 limitSpeed (_maxSpd*0.8);
|
||||
//}else{
|
||||
//_veh3 forceSpeed (_maxSpd*0.8)*0.2777778;
|
||||
_veh3 limitSpeed (_maxSpd*0.8);
|
||||
//};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//code to end the while
|
||||
_unitsAlive = ({alive _x}count units _group);
|
||||
if(_unitsAlive < 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
if (damage _mainVehicle == 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
|
||||
if({isPlayer _x && alive _x}count crew _mainVehicle > 0)then{
|
||||
doStop (units _group);
|
||||
{
|
||||
_x spawn{
|
||||
_this action ["engineOff", (vehicle _this)];
|
||||
sleep 0.5;
|
||||
deleteVehicle _this;
|
||||
};
|
||||
}foreach units _group;
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
|
||||
UIsleep 1;
|
||||
}; //END OF LOOP
|
||||
|
||||
hint "Dynamic Mission Status: Convoy Ended";
|
||||
|
||||
if({alive _x}count units _group > 0 && damage _mainVehicle < 1)then{
|
||||
_group move _vehiclePos;
|
||||
sleep 10;
|
||||
{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
[_x,_vehiclePos] spawn{ private "_unit";
|
||||
_unit = _this select 0;
|
||||
doStop _unit;
|
||||
sleep 1;
|
||||
_unit action ["engineOff", (vehicle _unit)];
|
||||
_unit action ["GetOut", (vehicle _unit)];
|
||||
unassignVehicle _unit;
|
||||
sleep 0.1;
|
||||
[_unit] orderGetIn false;
|
||||
[_unit] allowGetIn false;
|
||||
};
|
||||
};
|
||||
}forEach (units _group);
|
||||
|
||||
_group move _vehiclePos;
|
||||
_group setBehaviour "AWARE";
|
||||
_group setFormation "FILE";
|
||||
_group setCombatMode "YELLOW";
|
||||
[_group, _vehiclePos] call SEM_fnc_AImove;
|
||||
};
|
46
sem/scripts/ai/fn_AIactDeact.sqf
Normal file
46
sem/scripts/ai/fn_AIactDeact.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
private["_enable","_group","_pos"];
|
||||
|
||||
_group = _this select 0;
|
||||
_enable = _this select 1;
|
||||
|
||||
if (_enable )then { //Enable AI
|
||||
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
_x enableAI "AUTOTARGET";
|
||||
//_x enableAI "TARGET";
|
||||
_x enableAI "MOVE";
|
||||
_x enableAI "ANIM";
|
||||
_x enableAI "FSM";
|
||||
_x stop false;
|
||||
_x spawn {
|
||||
_this setUnitPos "Middle";
|
||||
uisleep 30;
|
||||
_this setUnitPos "AUTO"
|
||||
};
|
||||
[_x, false] call SEM_fnc_AIdamageEH;
|
||||
};
|
||||
} count units _group;
|
||||
_group setCombatMode "YELLOW";
|
||||
_group setBehaviour "COMBAT"; //"AWARE";
|
||||
|
||||
diag_log "#SEM: Mission AI enabled";
|
||||
|
||||
}
|
||||
else { //Disable AI
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
_x disableAI "AUTOTARGET";
|
||||
_x disableAI "TARGET";
|
||||
_x disableAI "MOVE";
|
||||
_x disableAI "FSM";
|
||||
_x stop true;
|
||||
_x spawn {_this setUnitPos "DOWN"; sleep 5; _this disableAI "ANIM"};
|
||||
[_x, true] call SEM_fnc_AIdamageEH;
|
||||
};
|
||||
} count units _group;
|
||||
_group setBehaviour "SAFE";
|
||||
_group setCombatMode "BLUE";
|
||||
|
||||
diag_log "#SEM: Mission AI disabled";
|
||||
};
|
322
sem/scripts/ai/fn_AIconvoy.sqf
Normal file
322
sem/scripts/ai/fn_AIconvoy.sqf
Normal file
@ -0,0 +1,322 @@
|
||||
/* KiloSwiss */
|
||||
private["_group","_endPos","_missionID","_mainVehicle","_convoyVehicles","_enterableVehicles","_convoyGrps","_ranks","_side","_vehiclePos","_vehFrontPos","_veh1","_veh2","_veh3","_start"];
|
||||
|
||||
_group = _this select 0;
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_convoyVehicles = _this select 4;
|
||||
_enterableVehicles = _this select 5;
|
||||
|
||||
/* Marker position update */
|
||||
_this spawn { private["_endPos","_missionID","_mainVehicle","_oldPos","_newPos"];
|
||||
_endPos = _this select 1;
|
||||
_missionID = _this select 2;
|
||||
_mainVehicle = _this select 3;
|
||||
_oldPos = position _mainVehicle;
|
||||
|
||||
while{alive _mainVehicle && _mainVehicle distance _endPos > 50}do{
|
||||
UIsleep 10;
|
||||
_newPos = position _mainVehicle;
|
||||
if(_oldPos distance _newPos > 10)then{
|
||||
_oldPos = _newPos;
|
||||
SEM_updateMissionMarkerPos = [_missionID, _newPos];
|
||||
SEM_updateMissionMarkerPos call SEM_client_updateMissionMarkerPos;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_units = (units _group);
|
||||
_side = side (_units select 0);
|
||||
_startPos = getPos _mainVehicle;
|
||||
|
||||
_vehFront = (if(count _convoyVehicles == 1)then[{_mainVehicle},{{if(_x != _mainVehicle)exitWith{_x}; (_convoyVehicles select 0)}count _convoyVehicles}]);
|
||||
|
||||
{
|
||||
_x setVariable ["AIskill",(skill _x)]
|
||||
} count _units;
|
||||
|
||||
_ranks = ["COLONEL","MAJOR","CAPTAIN","LIEUTENANT","SERGEANT","CORPORAL","PRIVATE"];
|
||||
{
|
||||
_x setFuel 1;
|
||||
_x setDamage 0;
|
||||
_group addVehicle _x;
|
||||
if (_x in _enterableVehicles) then {
|
||||
_x lock 0
|
||||
}
|
||||
else {
|
||||
_x lock 3
|
||||
};
|
||||
_x setVariable ["AIrank", (_ranks select (_forEachIndex min (count _ranks -1)))];
|
||||
|
||||
_x addEventHandler ["getIn",{
|
||||
(_this select 2) setUnitRank ((_this select 0) getVariable ["AIrank","PRIVATE"]);
|
||||
if((_this select 1) == "driver")then{
|
||||
(_this select 2) setSkill 1;
|
||||
};
|
||||
}];
|
||||
|
||||
_x addEventHandler ["getOut",{
|
||||
(_this select 2) setSkill ((_this select 2) getVariable ["AIskill",0.7]);
|
||||
}];
|
||||
|
||||
_x addeventHandler ["handleDamage",{
|
||||
if(isNull (_this select 3))then{false};
|
||||
}];
|
||||
|
||||
// Fill driver seats first
|
||||
(_units select _forEachIndex) assignAsDriver _x;
|
||||
|
||||
if(_x emptyPositions "GUNNER" > 0)then{ // Assign a gunner
|
||||
_x allowCrewInImmobile true; //allow gunner to stay in immobilized vehicle
|
||||
(_units select (_forEachIndex + (count _convoyVehicles))) assignAsGunner _x;
|
||||
};
|
||||
|
||||
}forEach _convoyVehicles;
|
||||
|
||||
//Order all Units to get in
|
||||
_units allowGetIn true;
|
||||
_units orderGetIn true;
|
||||
|
||||
//Wait until every unit has boarded a vehicle
|
||||
_start = time;
|
||||
waitUntil {
|
||||
uisleep 1;
|
||||
{
|
||||
(alive _x && vehicle _x == _x)
|
||||
} count _units == 0 || time - _start >= 30
|
||||
};
|
||||
|
||||
if({alive _x && vehicle _x == _x}count _units > 0)then{
|
||||
{ /* Move stuck AI into vehicles */
|
||||
if(vehicle _x == _x)then{
|
||||
_y = _x;
|
||||
{ /* Fill driver/gunner seats first */
|
||||
if(_x emptyPositions "DRIVER" > 0)exitWith{_y moveInDriver _x; _y setSkill 1};
|
||||
if(_x emptyPositions "GUNNER" > 0)exitWith{_y moveInGunner _x};
|
||||
}forEach _convoyVehicles;
|
||||
{ /* Fill cargo seats */
|
||||
if(_x emptyPositions "CARGO" > 0)exitWith{_y moveInCargo _x};
|
||||
}forEach (_convoyVehicles - [_mainVehicle]);
|
||||
};
|
||||
_x setUnitRank ((vehicle _x) getVariable ["AIrank","PRIVATE"]);
|
||||
}forEach _units;
|
||||
};
|
||||
|
||||
//-- Get lowest TopSpeed from all vehicles
|
||||
_topSpeeds = [];
|
||||
{
|
||||
_maxSpd = getNumber (configFile >> "cfgVehicles" >> typeOf _x >> "maxSpeed");
|
||||
if(!isNil "_maxSpd")then{_topSpeeds pushBack _maxSpd};
|
||||
}forEach _convoyVehicles;
|
||||
|
||||
_select = 0;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
while{{_maxSpd > _x}count _topSpeeds != 0}do{
|
||||
_select = _select + 1;
|
||||
_maxSpd = _topSpeeds select _select;
|
||||
};
|
||||
{_x forceSpeed (_maxSpd*0.8)*0.2777778}forEach _convoyVehicles; // m/s
|
||||
//DEBUG
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["SEM DEBUG: Convoy Vehicles TopSpeeds: %1 - Selected lowest: %2", _topSpeeds, _maxSpd]};
|
||||
|
||||
//_group move _endPos;
|
||||
{driver _x move _endPos}count _convoyVehicles;
|
||||
_group setSpeedMode "FULL";//"FULL";
|
||||
_group setBehaviour "SAFE"; //"CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
_group setFormation "COLUMN";
|
||||
|
||||
uisleep 30;
|
||||
|
||||
/* temporary definition of 3 vehicles */
|
||||
_veh1 = _convoyVehicles select 0;
|
||||
_veh2 = _convoyVehicles select 1;
|
||||
_veh3 = _convoyVehicles select 2;
|
||||
|
||||
_lastMoveCheck = time;
|
||||
_oldPos = getPos _mainVehicle;
|
||||
|
||||
/* Convoy loop */
|
||||
_stayToDefend = true;
|
||||
while{{_x distance _endPos < 20}count _convoyVehicles < 1}do{ //CONVOY LOOP
|
||||
|
||||
_vehiclePos = getPos _mainVehicle;
|
||||
_vehFrontPos = getPos _vehFront;
|
||||
|
||||
if({!canMove _x}count _convoyVehicles > 0 && _stayToDefend)then{
|
||||
{if(canMove _x)then{(driver _x) doMove _vehiclePos}}forEach _convoyVehicles;
|
||||
sleep 5;
|
||||
{
|
||||
if(_x distance _vehiclePos < 50)then[{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
_x action ["GetOut", (vehicle _x)];
|
||||
sleep 0.5;
|
||||
[_x] orderGetIn false;
|
||||
[_x] allowGetIn false;
|
||||
_x doMove _vehiclePos;
|
||||
};
|
||||
},{
|
||||
_x doMove _vehiclePos;
|
||||
}];
|
||||
}forEach units _group;
|
||||
_group move _vehiclePos;
|
||||
_group setSpeedMode "FULL";
|
||||
|
||||
if({_x distance _veh2 < 50}count units _group == count units _group)then{
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
}
|
||||
else{
|
||||
//-- Work In Progress!
|
||||
|
||||
if({alive _x && !(vehicle _x in _convoyVehicles)}count units _group > 0)then{ //AI has left the vehicle
|
||||
_group setBehaviour "CARELESS";
|
||||
_group setCombatMode "GREEN";
|
||||
{
|
||||
if(!(vehicle _x in _convoyVehicles))then{
|
||||
[_x] allowGetIn true;
|
||||
[_x] orderGetIn true;
|
||||
};
|
||||
}forEach units _group;
|
||||
uisleep 10; //Brake the loop for 10 seconds
|
||||
_group move _endPos;
|
||||
|
||||
}
|
||||
else{ //Do vehicle speed management and continue travel to destination
|
||||
|
||||
_group setBehaviour "SAFE";
|
||||
_group setCombatMode "GREEN";
|
||||
_group setSpeedMode "FULL";
|
||||
|
||||
if(time - _lastMoveCheck > 60)then{
|
||||
_group move _endPos;
|
||||
_lastMoveCheck = time;
|
||||
if(_vehiclePos distance _oldPos < 30)then {
|
||||
//FAILSAFE IF CONVOY IS STUCK
|
||||
{
|
||||
driver _x doMove _endPos
|
||||
} count _convoyVehicles;
|
||||
sleep 20;
|
||||
if(_vehiclePos distance _oldPos < 10)then{
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
}
|
||||
else {
|
||||
_group move _endPos
|
||||
};
|
||||
_oldPos = getPos _mainVehicle;
|
||||
_group move _endPos;
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 1
|
||||
if(_veh1 distance _veh2 > 80 || _veh1 distance _veh3 > 120)then{
|
||||
if(_veh1 distance _veh2 > 90 || _veh1 distance _veh3 > 130)then{
|
||||
_veh1 limitSpeed 0;
|
||||
}else{
|
||||
if(speed _veh3 < 10)then{
|
||||
_veh1 limitSpeed (1 max (speed _veh3));
|
||||
}else{
|
||||
_veh1 limitSpeed (_maxSpd*0.4);
|
||||
};
|
||||
};
|
||||
}else{
|
||||
if(speed _veh3 < 10)then{
|
||||
_veh1 limitSpeed (_maxSpd*0.1);
|
||||
}else{
|
||||
_veh1 limitSpeed (_maxSpd*0.8);
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 2
|
||||
if(_veh2 distance _veh1 > 80)then{
|
||||
if(_veh2 distance _veh3 < _veh2 distance _veh1)then{
|
||||
_veh2 limitSpeed (_maxSpd*0.8);
|
||||
}
|
||||
else{
|
||||
_veh2 limitSpeed _maxSpd;
|
||||
};
|
||||
}else{
|
||||
if(_veh2 distance _veh1 < 50)then{
|
||||
_veh2 limitSpeed (1 max (speed _veh1));
|
||||
}
|
||||
else{
|
||||
if(_veh2 distance _veh3 > _veh2 distance _veh1)then{
|
||||
_veh2 limitSpeed (_maxSpd*0.5);
|
||||
}
|
||||
else{
|
||||
_veh2 limitSpeed (_maxSpd*0.8);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Speed Management for Vehicle 3
|
||||
if(_veh3 distance _veh2 > 80 || _veh3 distance _veh1 > 150)then{
|
||||
if(_veh3 distance _veh2 < 40)then{
|
||||
_veh3 limitSpeed (1 max (speed _veh2));
|
||||
}else{
|
||||
_veh3 limitSpeed _maxSpd;
|
||||
};
|
||||
}else{
|
||||
if(_veh3 distance _veh2 < 40)then{
|
||||
_veh3 limitSpeed (1 max (speed _veh2));
|
||||
}
|
||||
else{
|
||||
_veh3 limitSpeed (_maxSpd*0.8);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//code to end the while
|
||||
_unitsAlive = ({alive _x}count units _group);
|
||||
if(_unitsAlive < 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
if (damage _mainVehicle == 1) then {
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
|
||||
if({isPlayer _x && alive _x}count crew _mainVehicle > 0)then{
|
||||
doStop (units _group);
|
||||
{
|
||||
_x spawn{
|
||||
_this action ["engineOff", (vehicle _this)];
|
||||
sleep 0.5;
|
||||
deleteVehicle _this;
|
||||
};
|
||||
}foreach units _group;
|
||||
_endPos = _vehiclePos;
|
||||
};
|
||||
|
||||
uisleep 1;
|
||||
};
|
||||
//END OF LOOP
|
||||
|
||||
|
||||
if ({alive _x}count units _group > 0 && damage _mainVehicle < 1) then {
|
||||
_group move _vehiclePos;
|
||||
uisleep 10;
|
||||
{
|
||||
if(_x != gunner (vehicle _x))then{
|
||||
[_x,_vehiclePos] spawn{
|
||||
private "_unit";
|
||||
_unit = _this select 0;
|
||||
doStop _unit;
|
||||
uisleep 1;
|
||||
_unit action ["engineOff", (vehicle _unit)];
|
||||
_unit action ["GetOut", (vehicle _unit)];
|
||||
unassignVehicle _unit;
|
||||
sleep 0.1;
|
||||
[_unit] orderGetIn false;
|
||||
[_unit] allowGetIn false;
|
||||
};
|
||||
};
|
||||
} forEach (units _group);
|
||||
|
||||
_group move _vehiclePos;
|
||||
_group setBehaviour "AWARE";
|
||||
_group setFormation "FILE";
|
||||
_group setCombatMode "YELLOW";
|
||||
[_group, _vehiclePos] call SEM_fnc_AImove;
|
||||
};
|
34
sem/scripts/ai/fn_AIdamageEH.sqf
Normal file
34
sem/scripts/ai/fn_AIdamageEH.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
private ["_addEH","_unit","_EHindex"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_addEH = _this select 1;
|
||||
|
||||
if(_addEH)then[{ //Add damage detection EventHandler
|
||||
|
||||
_EHindex = _unit addEventHandler ["handleDamage",{ private["_AIunit","_source"];
|
||||
_AIunit = _this select 0;
|
||||
_source = _this select 3;
|
||||
if(isPlayer _source)then{
|
||||
(group _AIunit) reveal [_source, 1.5];
|
||||
//_AIunit removeEventHandler ["handleDamage",(_AIunit getVariable "damageEHindex")];
|
||||
_AIunit setVariable ["gotHitBy", [_source, time]]; //define attacker and time
|
||||
_AIunit setVariable ["damageEHindex", -1]; //this is used later
|
||||
};
|
||||
}];
|
||||
_unit setVariable ["damageEHindex", _EHindex];
|
||||
|
||||
},{ //Remove damage detection EventHandler
|
||||
|
||||
_EHindex = _unit getVariable "damageEHindex";
|
||||
if(_EHindex >= 0)then{
|
||||
_unit removeEventHandler ["handleDamage",_EHindex];
|
||||
_unit setVariable ["damageEHindex", -1];
|
||||
};
|
||||
|
||||
if(!isNil {_unit getVariable "gotHitBy"})then{
|
||||
if((time - ((_unit getVariable "gotHitBy") select 1)) >= 150)then{
|
||||
_unit setVariable ["gotHitBy", Nil];
|
||||
};
|
||||
};
|
||||
|
||||
}];
|
8
sem/scripts/ai/fn_AIfiredEH.sqf
Normal file
8
sem/scripts/ai/fn_AIfiredEH.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
call compile format["
|
||||
_this addEventHandler ['Fired',{
|
||||
if(_this select 2 in %1)then{
|
||||
_this select 0 addMagazines [_this select 5, 1];
|
||||
};
|
||||
}];
|
||||
", ["launch_RPG32_F","launch_NLAW_F","launch_Titan_short_F","launch_Titan_F"]];
|
74
sem/scripts/ai/fn_AIkilledEH.sqf
Normal file
74
sem/scripts/ai/fn_AIkilledEH.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
/* Remove Weapons when killed */
|
||||
call compile format["
|
||||
_this addEventHandler ['Killed',{
|
||||
private['_unit','_z','_ran'];
|
||||
_unit = _this select 0;
|
||||
_killer = _this select 1;
|
||||
{_unit removeWeaponGlobal _x}count (%1 + ['EpochRadio0','ItemMap','ItemRadio','ItemWatch','ItemCompass','ItemGPS']);
|
||||
{if(_x in (magazines _unit))then{_unit removeMagazines _x}}count %2;
|
||||
if (SEM_AIdropGearChance < ceil(random 100)) then {
|
||||
_unit call SEM_fnc_removeGear;
|
||||
{deleteVehicle _x} forEach nearestObjects [(getPosATL _unit), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 1];
|
||||
};
|
||||
_unit spawn{
|
||||
sleep .1;
|
||||
{_z = _x;
|
||||
if(_x in (getweaponcargo _z))exitWith{deleteVehicle _z}count %1;
|
||||
if(_x in (getmagazinecargo _z))exitWith{deleteVehicle _z}count %2;
|
||||
}forEach nearestObjects [(getPosATL _this), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3];
|
||||
};
|
||||
}];
|
||||
", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI];
|
||||
|
||||
/* AI run over by vehicle */
|
||||
if(SEM_punish_AIroadkill || SEM_reward_AIkill)then{
|
||||
_this addEventHandler ["killed",{
|
||||
private["_u","_k","_vk"];
|
||||
_u = _this select 0;
|
||||
_k = _this select 1;
|
||||
_vk = vehicle _k;
|
||||
if (SEM_punish_AIroadkill) then {
|
||||
if (_vk isKindOf "Car") then {
|
||||
if (abs speed _vk > 0) then {
|
||||
if (_vk distance _u < 10) then {
|
||||
if (isEngineOn _vk || !isNull (driver _vk)) then {
|
||||
if (SEM_damage_AIroadkill) then {
|
||||
if (!local _vk) then {
|
||||
_vk remoteexec ["SEM_Client_VehDamage",_vk];
|
||||
};
|
||||
};
|
||||
if(SEM_Krypto_AIroadkill > 0)then{
|
||||
[_k,SEM_Krypto_AIroadkill*-1] call EPOCH_server_effectCrypto;
|
||||
};
|
||||
{
|
||||
deleteVehicle _x
|
||||
} forEach nearestObjects [(getPosATL _u), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 3];
|
||||
_u call SEM_fnc_removeGear;
|
||||
if ({alive _x}count units group _u < 1) then {
|
||||
_u spawn {
|
||||
uisleep 5;
|
||||
createMine ["APERSTripMine", (position _this),[],0]
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(SEM_reward_AIkill)then{
|
||||
[_k,(ceil(random 15))] call EPOCH_server_effectCrypto;
|
||||
};
|
||||
};
|
||||
}
|
||||
else {
|
||||
if (SEM_reward_AIkill) then {
|
||||
[_k,(ceil(random 15))] call EPOCH_server_effectCrypto;
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
55
sem/scripts/ai/fn_AImove.sqf
Normal file
55
sem/scripts/ai/fn_AImove.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/* KiloSwiss */
|
||||
_this call SEM_fnc_findthread;
|
||||
|
||||
_this spawn {
|
||||
private["_group","_pos","_owner","_firstLoop","_oldPos","_newPos","_dir","_dist","_posX","_posY","_wp"];
|
||||
_group = _this select 0;
|
||||
_pos = _this select 1;
|
||||
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
if (_x == leader _group) then {
|
||||
_x setUnitRank "CORPORAL";
|
||||
}
|
||||
else {
|
||||
_x setUnitRank "PRIVATE";
|
||||
};
|
||||
};
|
||||
} forEach units _group;
|
||||
|
||||
_firstLoop = true;
|
||||
_oldPos = [0,0,0];
|
||||
_newPos = _pos;
|
||||
|
||||
while {
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
alive _x
|
||||
};
|
||||
} count units _group > 0
|
||||
} do {
|
||||
while {_oldPos distance _newPos < 30} do {
|
||||
uisleep 0.1;
|
||||
_dir = random 360;
|
||||
_dist = (15+(random 45));
|
||||
_posX = (_pos select 0) + sin (_dir) * _dist;
|
||||
_posY = (_pos select 1) + cos (_dir) * _dist;
|
||||
_newPos = [_posX, _posY, 0];
|
||||
};
|
||||
_oldPos = _newPos;
|
||||
|
||||
_group move _newPos;
|
||||
_group setSpeedMode (["FULL","NORMAL","LIMITED"]call BIS_fnc_selectRandom);
|
||||
_group setFormation (["WEDGE","VEE","FILE","DIAMOND"]call BIS_fnc_selectRandom);
|
||||
|
||||
waitUntil {
|
||||
uisleep 5;
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
alive _x && vehicle _x == _x && unitReady _x
|
||||
};
|
||||
} count (units _group) == {alive _x && vehicle _x == _x} count (units _group)
|
||||
};
|
||||
};
|
||||
diag_log format["#SEM: AI moving stopped - Remaining AIs: (%1/%2)", {alive _x}count units _group, count units _group];
|
||||
};
|
174
sem/scripts/ai/fn_AIsetOwner.sqf
Normal file
174
sem/scripts/ai/fn_AIsetOwner.sqf
Normal file
@ -0,0 +1,174 @@
|
||||
private["_group","_pos","_units","_checkPos","_serverID","_firstLoop","_loops","_possibleThreads","_z","_newOwner","_ownerLeft","_AIkilled","_changeOwner"];
|
||||
/*
|
||||
Disable AI processing and move it to nearby players via "setOwner"
|
||||
Work In Progress!
|
||||
|
||||
Update 03.01.2015
|
||||
KiloSwiss
|
||||
|
||||
[_group, true] call SEM_fnc_AIactDeact; //Enable AI
|
||||
[_group, false] call SEM_fnc_AIactDeact; //Disable AI
|
||||
|
||||
*/
|
||||
#define getAttacker(WHO) WHO getVariable "gotHitBy"
|
||||
|
||||
_group = _this select 0;
|
||||
_pos = _this select 1;
|
||||
_checkPos = _pos; _checkPos set [2,2];
|
||||
_units = units _group;
|
||||
_serverID = owner (units _group select 0);
|
||||
//diag_log format["#SEM DEBUG: ServerID: %1", _serverID];
|
||||
|
||||
_group move _pos;
|
||||
_group setspeedMode "FULL";
|
||||
_group setFormation "DIAMOND";
|
||||
sleep 10;
|
||||
[_group, false] call SEM_fnc_AIactDeact; //Disable AI
|
||||
|
||||
_oldPos = _pos;
|
||||
_newPos = _pos;
|
||||
_newOwner = objNull;
|
||||
_firstLoop = true;
|
||||
_changeOwner = false;
|
||||
while {
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
alive _x
|
||||
};
|
||||
} count units _group > 0
|
||||
} do {
|
||||
|
||||
if (_firstLoop) then {
|
||||
_firstLoop=false;
|
||||
_loops = -1;
|
||||
diag_log "#SEM: Mission AI waiting for their first encounter"
|
||||
}
|
||||
else {
|
||||
_loops = 0;
|
||||
diag_log "#SEM: Mission AI searching for new possible thread(s)"
|
||||
};
|
||||
|
||||
waitUntil{
|
||||
uisleep 5;
|
||||
_possibleThreads = []; //Check if any thread for the AI has been detected
|
||||
//Check if any AI is shot by player
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
if (!isNil {getAttacker(_x)}) then {
|
||||
if (isPlayer (getAttacker(_x) select 0) && (getAttacker(_x) select 0) != _newOwner) then {
|
||||
if((time - (getAttacker(_x) select 1)) < 150)then {
|
||||
_possibleThreads pushBack (getAttacker(_x) select 0)
|
||||
}
|
||||
else {
|
||||
_x setVariable ["gotHitBy", Nil]
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _units; //Do NOT replace forEach with count!
|
||||
//Check if any players are near
|
||||
{
|
||||
uisleep 0.1;
|
||||
if (!isnull _x) then {
|
||||
if (isPlayer _x && alive _x && !(_x in _possibleThreads) && _x != _newOwner) then {
|
||||
if (_x isKindOf "Epoch_Man_base_F" || _x isKindOf "Epoch_Female_base_F") then {
|
||||
_possibleThreads pushBack _x
|
||||
}
|
||||
else {
|
||||
_z = _x;
|
||||
if (count crew _z > 0) then {
|
||||
{
|
||||
if (isPlayer _x && _x != _newOwner) then {
|
||||
_possibleThreads pushBack _x
|
||||
}
|
||||
} forEach crew _z;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach (_pos nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F","Helicopter","Car","Motorcycle"], 500]); //Do NOT replace forEach with count!
|
||||
|
||||
if (_loops >= 0) then {
|
||||
if(_loops>5)then {
|
||||
_loops = -1;
|
||||
[_group, false] call SEM_fnc_AIactDeact
|
||||
}
|
||||
else {
|
||||
_loops = _loops + 1
|
||||
};
|
||||
};
|
||||
|
||||
(count _possibleThreads > 0)
|
||||
};
|
||||
/* Thread has been detected */
|
||||
|
||||
[_group, true] call SEM_fnc_AIactDeact; //Enable AI system
|
||||
{_group reveal _x}count _possibleThreads; //Reveal threads
|
||||
|
||||
|
||||
//Select the closest alive player to the mission
|
||||
diag_log format["#SEM DEBUG: Possible threads: %1", _possibleThreads];
|
||||
_newOwner = [_pos, _possibleThreads] call SEM_fnc_selectClosest;
|
||||
_newOwnerID = owner _newOwner; //Define the new owners ID
|
||||
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
_x setOwner _newOwnerID;
|
||||
diag_log format["#SEM: Setowner: Unit: %1 New Owner: %2", _x, _newOwnerID];
|
||||
};
|
||||
}forEach units _group; //Set the new owner
|
||||
waitUntil {
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
owner _x == _newOwnerID;
|
||||
};
|
||||
} forEach units _group || !isPlayer _newOwner;
|
||||
};
|
||||
|
||||
if(isPlayer _newOwner)then[{
|
||||
diag_log format["#SEM: Mission AI has new Owner: %1 - ID: %2", _newOwner, _newOwnerID];
|
||||
|
||||
/* AI transfer completed. */
|
||||
|
||||
//Announce transfer of the ownership to the client
|
||||
SEM_takeAIownership = [_group, _pos];
|
||||
_newOwnerID publicVariableClient "SEM_takeAIownership";
|
||||
|
||||
//[_group,_pos,_newOwner] spawn SEM_fnc_AImove; //IMPORTANT: spawn not call!
|
||||
|
||||
/* Check some stuff */
|
||||
_ownerDistance = _pos distance _newOwner;
|
||||
waitUntil{ UIsleep 5; _ownerLeft = false; _AIkilled = false; _changeOwner = false;
|
||||
if (
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
alive _x
|
||||
}
|
||||
} count units _group < 1
|
||||
) then {
|
||||
_AIkilled = true
|
||||
};
|
||||
if (!_aiKilled) then {
|
||||
if (!isPlayer _newOwner || local (units _group select 0)) then {
|
||||
_ownerLeft = true
|
||||
};
|
||||
if (!_ownerLeft) then {
|
||||
_newDistance = _pos distance _newOwner;
|
||||
if (_newDistance > 800 || (_newDistance > _ownerDistance + 50 && _newDistance > 500)) then { //Current owner moved too far away
|
||||
{
|
||||
uisleep 0.1; //Check for other possible nearby owner
|
||||
if (isPlayer _x && alive _x && !(_x == _newOwner)) then {
|
||||
if (_x distance _pos < _newDistance) exitwith {
|
||||
_changeOwner = true
|
||||
};
|
||||
};
|
||||
} forEach (_pos nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F","Helicopter","Car","Motorcycle"], 500]);
|
||||
};
|
||||
};
|
||||
};
|
||||
(_ownerLeft || _AIkilled || _changeOwner) //All AI units dead or player disconnected or closer player detected
|
||||
};
|
||||
|
||||
},{diag_log format["#SEM: Mission AI new Owner left during processing: %1 - ID: %2", _newOwner, _newOwnerID]}];
|
||||
|
||||
}; //End of while loop
|
30
sem/scripts/ai/fn_broadcastAI.sqf
Normal file
30
sem/scripts/ai/fn_broadcastAI.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/* KiloSwiss */
|
||||
private "_units";
|
||||
|
||||
if (isNil "SEM_AI_Units") then {
|
||||
SEM_AI_Units = []
|
||||
};
|
||||
|
||||
_units = SEM_AI_Units;
|
||||
|
||||
/* Remove old/dead units */
|
||||
//{if(isNull _x || !alive _x)then{_units deleteAt _forEachIndex}}forEach _units;
|
||||
{
|
||||
if (isNull _x || !alive _x) then {
|
||||
_units set [_forEachIndex, "delete"]
|
||||
}
|
||||
}forEach _units;
|
||||
_units = _units - ["delete"];
|
||||
|
||||
/* Add new units */
|
||||
{
|
||||
_units pushBack _x
|
||||
} forEach _this;
|
||||
|
||||
/* Broadcast to clients */
|
||||
SEM_AI_Units = _units;
|
||||
publicVariable "SEM_AI_Units";
|
||||
|
||||
if (SEM_debug in ["log","full"]) then {
|
||||
diag_log format["#SEM DEBUG: Broadcasted %1 AI units to clients", count SEM_AI_Units]
|
||||
};
|
81
sem/scripts/ai/fn_findThread.sqf
Normal file
81
sem/scripts/ai/fn_findThread.sqf
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
Detect Threads in form of players.
|
||||
|
||||
Update 03.01.2015
|
||||
KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
_this spawn {
|
||||
diag_log format["#SEM DEBUG: 1st Find Thread"];
|
||||
private["_group","_pos","_units","_checkPos","_possibleThreads","_z"];
|
||||
_group = _this select 0;
|
||||
_pos = _this select 1;
|
||||
_checkPos = _pos; _checkPos set [2,2];
|
||||
_units = units _group;
|
||||
{
|
||||
[_x, true] call SEM_fnc_AIdamageEH
|
||||
} count _units;
|
||||
{
|
||||
_group reveal [_x,4];
|
||||
} foreach (nearestobjects [_pos,[],50]);
|
||||
|
||||
while {{alive _x}count units _group > 0} do {
|
||||
waitUntil {
|
||||
uisleep 5;
|
||||
_possibleThreads = []; //Check if any thread for the AI has been detected
|
||||
//Check if any AI is shot by player
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
_attackervar = _x getVariable ["gotHitBy", Nil];
|
||||
if (!isNil "_attackervar") then {
|
||||
_attacker = _attackervar select 0;
|
||||
_attacktime = _attackervar select 1;
|
||||
if (isPlayer _attacker && !(_attacker in _possibleThreads)) then {
|
||||
if ((time - _attacktime) < 150) then {
|
||||
_possibleThreads pushBack _attacker;
|
||||
diag_log format["#SEM DEBUG: Attacker: %1",_attacker];
|
||||
}
|
||||
else {
|
||||
_x setVariable ["gotHitBy", Nil]
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _units; //Do NOT replace forEach with count!
|
||||
//Check if any players are near
|
||||
{
|
||||
uisleep 0.1;
|
||||
if (isPlayer _x && alive _x && !(_x in _possibleThreads)) then {
|
||||
if (_x isKindOf "Epoch_Man_base_F" || _x isKindOf "Epoch_Female_base_F") then {
|
||||
_possibleThreads pushBack _x
|
||||
}
|
||||
else {
|
||||
_z = _x;
|
||||
if (count crew _z > 0) then {
|
||||
{
|
||||
if (isPlayer _x) then {
|
||||
_possibleThreads pushBack _x
|
||||
};
|
||||
} forEach crew _z;
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach (_pos nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F","Helicopter","Car","Motorcycle"], 500]); //Do NOT replace forEach with count!
|
||||
|
||||
(count _possibleThreads > 0)
|
||||
};
|
||||
/* Thread has been detected */
|
||||
if(SEM_debug in ["log","full"])then{
|
||||
diag_log format["#SEM DEBUG: Possible threads: %1", _possibleThreads]
|
||||
};
|
||||
|
||||
/* AI react immediately */
|
||||
{
|
||||
_group reveal [_x,2]
|
||||
} count _possibleThreads; //Reveal threads
|
||||
}; //End of while loop
|
||||
};
|
9
sem/scripts/ai/fn_removeGear.sqf
Normal file
9
sem/scripts/ai/fn_removeGear.sqf
Normal file
@ -0,0 +1,9 @@
|
||||
if (!isnull _this) then {
|
||||
removeVest _this;
|
||||
//removeHeadgear _this;
|
||||
removeGoggles _this;
|
||||
removeAllItems _this;
|
||||
removeAllWeapons _this;
|
||||
removeBackpackGlobal _this;
|
||||
{_this removeMagazine _x}count magazines _this;
|
||||
};
|
308
sem/scripts/ai/fn_spawnAI.sqf
Normal file
308
sem/scripts/ai/fn_spawnAI.sqf
Normal file
@ -0,0 +1,308 @@
|
||||
private["_pos","_cnt","_group","_unit","_wpn","_opt","_Umale","_Ufemale","_Uciv","_Ukart","_rifles","_riflesGL","_LMGs","_SMGs","_rifleOptics","_smgOptics","_Sniper","_loadoutsAssigned"];
|
||||
/*
|
||||
File: ai.sqf
|
||||
Author: drsubo
|
||||
usage : [_uLoc] execVM
|
||||
|
||||
Update 03.01.2015
|
||||
Re-written by KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
|
||||
_pos = _this select 0;
|
||||
_cnt = (if(count _this > 1)then[{(_this select 1) max 4},{7}]); //Unit Count (min 5 - default 7)
|
||||
_group = createGroup RESISTANCE;
|
||||
|
||||
while {count (units _group) < _cnt} do {
|
||||
_group createUnit ['I_Soldier_EPOCH', _pos, [], 10, 'NO_COLLIDE'];
|
||||
sleep 0.1;
|
||||
};
|
||||
|
||||
{
|
||||
_x call SEM_fnc_AIkilledEH;
|
||||
_x call SEM_fnc_AIfiredEH;
|
||||
_x call SEM_fnc_stripUnit;
|
||||
_x setVariable["LASTLOGOUT_EPOCH",99999999];
|
||||
} count units _group;
|
||||
|
||||
if(SEM_AIdisableSniperDamage)then{
|
||||
units _group call SEM_fnc_broadcastAI;
|
||||
};
|
||||
|
||||
diag_log format["#SEM: Spawned %1 units at position %2", count units _group, _pos];
|
||||
|
||||
|
||||
_Umale = ["U_O_CombatUniform_ocamo","U_O_PilotCoveralls","U_OG_leader"];
|
||||
|
||||
_Ufemale = ["U_Camo_uniform","U_CamoBlue_uniform","U_CamoBrn_uniform","U_CamoRed_uniform"];
|
||||
|
||||
_Uguer = ["U_OG_Guerilla1_1","U_OG_Guerilla2_1","U_OG_Guerilla2_2","U_OG_Guerilla2_3","U_OG_Guerilla3_1","U_OG_Guerilla3_2"];
|
||||
|
||||
_Uciv = ["U_C_Poloshirt_stripped","U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_tricolour","U_C_Poloshirt_salmon",
|
||||
"U_C_Poloshirt_redwhite","U_C_Poor_1","U_C_WorkerCoveralls","U_C_Journalist","U_C_Scientist","U_OrestesBody"];
|
||||
|
||||
_Ukart = ["U_C_Driver_1","U_C_Driver_2","U_C_Driver_3","U_C_Driver_4","U_C_Driver_1_black","U_C_Driver_1_blue",
|
||||
"U_C_Driver_1_green","U_C_Driver_1_red","U_C_Driver_1_white","U_C_Driver_1_yellow","U_C_Driver_1_orange"];
|
||||
|
||||
|
||||
_rifles = [
|
||||
["akm_EPOCH", "30Rnd_762x39_Mag"],
|
||||
["m16_EPOCH", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["m16Red_EPOCH", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["m4a3_EPOCH", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["Arifle_Katiba_C_F", "30Rnd_65x39_caseless_green_mag_Tracer"],
|
||||
["Arifle_Mk20_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["Arifle_Mk20C_F", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["Arifle_Mk20C_plain_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["Arifle_Mk20_plain_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["Arifle_MXC_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_MXC_Black_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_MX_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_MX_Black_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_SDAR_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["Arifle_TRG21_F", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["Arifle_TRG20_F", "30Rnd_556x45_Stanag_Tracer_Yellow"]
|
||||
];
|
||||
|
||||
_riflesGL = [
|
||||
["Arifle_Katiba_GL_F", "30Rnd_65x39_caseless_green_mag_Tracer"],
|
||||
["Arifle_Mk20_GL_F", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["Arifle_Mk20_GL_plain_F", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["Arifle_MX_GL_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_MX_GL_Black_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_TRG21_GL_F", "30Rnd_556x45_Stanag_Tracer_Green"]
|
||||
];
|
||||
|
||||
_LMGs = [
|
||||
["m249_EPOCH", "200Rnd_556x45_M249"],
|
||||
["m249Tan_EPOCH", "200Rnd_556x45_M249"],
|
||||
["LMG_Mk200_F", "200Rnd_65x39_cased_Box_Tracer"],
|
||||
["Arifle_MX_SW_F", "100Rnd_65x39_caseless_mag_Tracer"],
|
||||
["Arifle_MX_SW_Black_F", "100Rnd_65x39_caseless_mag_Tracer"],
|
||||
["LMG_Zafir_F", "150Rnd_762x54_Box_Tracer"]
|
||||
];
|
||||
|
||||
_rifleOptics = ["optic_Aco","optic_ACO_grn","optic_Holosight"]; //"optic_Hamr","optic_Arco"
|
||||
|
||||
_SMGs = [
|
||||
["SMG_02_F", "30Rnd_9x21_Mag"],
|
||||
["SMG_01_F", "30Rnd_45ACP_Mag_SMG_01"],
|
||||
["Hgun_PDW2000_F", "30Rnd_9x21_Mag"]
|
||||
];
|
||||
|
||||
_smgOptics = ["optic_Aco_smg","optic_ACO_grn_smg","optic_Holosight_smg"];
|
||||
|
||||
|
||||
_DMRs = [
|
||||
["M14_EPOCH", "20Rnd_762x51_Mag"],
|
||||
["M14Grn_EPOCH", "20Rnd_762x51_Mag"],
|
||||
["srifle_EBR_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_01_F", "10Rnd_762x51_Mag"],
|
||||
["arifle_MXM_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MXM_Black_F", "30Rnd_65x39_caseless_mag_Tracer"]
|
||||
];
|
||||
|
||||
//"optic_Nightstalker", "optic_SOS", "optic_LRPS", "optic_DMS"
|
||||
_Sniper = [
|
||||
["m107_EPOCH", "5Rnd_127x108_Mag"],
|
||||
["m107Tan_EPOCH", "5Rnd_127x108_Mag"],
|
||||
["Srifle_GM6_F", "5Rnd_127x108_Mag"],
|
||||
["Srifle_LRR_F", "7Rnd_408_Mag"]
|
||||
];
|
||||
|
||||
if(sunOrMoon < 0.1)then{{_x addWeapon "NVG_EPOCH"}count units _group};
|
||||
|
||||
//Special Hunter (leader)
|
||||
_unit = units _group select 0;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform "U_OG_leader";
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _DMRs select (random (count _DMRs -1));
|
||||
_unit addMagazines [(_wpn select 1), 6];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
_unit addPrimaryWeaponItem "optic_Arco";
|
||||
|
||||
|
||||
//Sniper
|
||||
_unit = units _group select 1;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform "U_O_GhillieSuit";
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _Sniper select (random (count _Sniper -1));
|
||||
_unit addMagazines [(_wpn select 1), 4];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addPrimaryWeaponItem "optic_SOS";
|
||||
_unit selectWeapon (primaryWeapon _unit);
|
||||
_unit addMagazines ["9rnd_45X88_magazine", 4];
|
||||
_unit addWeapon "1911_pistol_EPOCH";
|
||||
|
||||
|
||||
//Rifleman
|
||||
_unit = units _group select 2;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform (_Uguer select (random (count _Uguer -1)));
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _riflesGL select (random (count _riflesGL -1));
|
||||
_unit addMagazines ["3Rnd_HE_Grenade_shell", 2];
|
||||
_unit addMagazines [(_wpn select 1), 4];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
_unit addPrimaryWeaponItem (_rifleOptics select (random (count _rifleOptics -1)));
|
||||
|
||||
|
||||
//Anti Tank
|
||||
_unit = units _group select 3;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform "U_O_CombatUniform_ocamo";
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _SMGs select (random (count _SMGs -1));
|
||||
_unit addMagazines [(_wpn select 1), 3];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
|
||||
_unit addBackPack "B_Carryall_ocamo";
|
||||
_unit addMagazines ["RPG32_HE_F", 1];
|
||||
_unit addMagazines ["RPG32_F", 1];
|
||||
_unit addWeapon "launch_RPG32_F";
|
||||
|
||||
_opt = _smgOptics select (random (count _smgOptics -1));
|
||||
_unit addPrimaryWeaponItem _opt;
|
||||
_unit selectWeapon (secondaryWeapon _unit);
|
||||
|
||||
if(_cnt > 4)then{
|
||||
if(_cnt > 9)then [{ //Group over 10 - spawn some elite soldiers
|
||||
|
||||
//Rifleman
|
||||
_unit = units _group select 5;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform (_Uguer select (random (count _Uguer -1)));
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _riflesGL select (random (count _riflesGL -1));
|
||||
_unit addMagazines [(_wpn select 1), 6];
|
||||
_unit addMagazines ["1Rnd_HE_Grenade_shell", 6];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
_unit addPrimaryWeaponItem "optic_Arco";
|
||||
|
||||
//MG
|
||||
_unit = units _group select 6;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform "U_O_CombatUniform_ocamo";
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _LMGs select (random (count _LMGs -1));
|
||||
_unit addMagazines [(_wpn select 1), 3];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
_unit addPrimaryWeaponItem "optic_Hamr";
|
||||
|
||||
//Anti Tank
|
||||
_unit = units _group select 7;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform "U_O_Wetsuit";
|
||||
_unit addVest "V_19_EPOCH";
|
||||
_unit addMagazines ["30Rnd_556x45_Stanag_Tracer_Red", 3];
|
||||
_unit addWeapon "Arifle_SDAR_F";
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform "U_O_CombatUniform_ocamo";
|
||||
_unit addVest format["V_%1_EPOCH", ceil(random 40)];
|
||||
_wpn = _SMGs select (random (count _SMGs -1));
|
||||
_unit addMagazines [(_wpn select 1), 3];
|
||||
_unit addWeapon (_wpn select 0);
|
||||
};
|
||||
_unit addHeadgear format["H_%1_EPOCH", ceil(random 104)];
|
||||
_unit addBackPack "B_Carryall_ocamo";
|
||||
_unit addMagazines ["RPG32_HE_F", 1];
|
||||
_unit addMagazines ["RPG32_F", 1];
|
||||
_unit addWeapon "launch_RPG32_F";
|
||||
_opt = _smgOptics select (random (count _smgOptics -1));
|
||||
_unit addPrimaryWeaponItem _opt;
|
||||
_unit selectWeapon (secondaryWeapon _unit);
|
||||
|
||||
_loadoutsAssigned = 7},{_loadoutsAssigned = 4}];
|
||||
|
||||
//spawn additional hunters
|
||||
for "_i" from _loadoutsAssigned to (count units _group -1) step 1 do{
|
||||
private "_unit";
|
||||
call compile format ["
|
||||
_unit = units _group select %1;
|
||||
_unit setSkill 1;
|
||||
if (surfaceiswater (getpos _unit)) then {
|
||||
_unit forceAddUniform 'U_O_Wetsuit';
|
||||
_unit addVest 'V_19_EPOCH';
|
||||
_unit addMagazines ['30Rnd_556x45_Stanag_Tracer_Red', 3];
|
||||
_unit addWeapon 'Arifle_SDAR_F';
|
||||
}
|
||||
else {
|
||||
_unit forceAddUniform (%2 select (random (count %2 -1)));
|
||||
_unit addVest 'V_%3_EPOCH';
|
||||
_unit addMagazines [(%5 select 1),(3+(random 3))];
|
||||
_unit addWeapon (%5 select 0);
|
||||
};
|
||||
_unit addHeadgear 'H_%4_EPOCH';
|
||||
_unit addPrimaryWeaponItem (%6 select (random (count %6 -1)));
|
||||
|
||||
", _i, _Uguer, ceil(random 40), ceil(random 104), (_rifles select (random (count _rifles -1))), _rifleOptics];
|
||||
};
|
||||
};
|
||||
|
||||
{_x setskill ["courage",1]}count (units _group);
|
||||
_group allowFleeing 0;
|
||||
|
||||
_group selectLeader (units _group select 0);
|
||||
|
||||
_group
|
9
sem/scripts/ai/fn_stripUnit.sqf
Normal file
9
sem/scripts/ai/fn_stripUnit.sqf
Normal file
@ -0,0 +1,9 @@
|
||||
if (!isnull _this) then {
|
||||
removeVest _this;
|
||||
removeUniform _this;
|
||||
removeBackpack _this;
|
||||
removeHeadgear _this;
|
||||
removeGoggles _this;
|
||||
removeAllItems _this;
|
||||
removeAllWeapons _this;
|
||||
};
|
25
sem/scripts/fn_attachToVeh.sqf
Normal file
25
sem/scripts/fn_attachToVeh.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/* KiloSwiss */
|
||||
private ["_obj","_veh","_attachOffset"];
|
||||
|
||||
_obj = _this select 0;
|
||||
_veh = _this select 1;
|
||||
|
||||
_attachOffset = switch(typeOf _obj)do{
|
||||
case "Box_NATO_Wps_F" :{ (switch(typeOf _veh)do{
|
||||
case "I_G_Van_01_transport_F" :{[0, -2.8, -.3]};
|
||||
case "I_Truck_02_transport_F" :{[0, -3, -.3]};
|
||||
case "I_G_Offroad_01_F" :{[0, -2.5, -.1]};
|
||||
})
|
||||
};
|
||||
|
||||
case "C_supplyCrate_F" :{ (switch(typeOf _veh)do{
|
||||
case "I_G_Van_01_transport_F" :{[0, -2.8, .3]};
|
||||
case "I_Truck_02_transport_F" :{[0, -3, .3]};
|
||||
case "I_G_Offroad_01_F" :{[0, -2.4, .3]};
|
||||
})
|
||||
};
|
||||
|
||||
default{[0,-2.5,0]};
|
||||
};
|
||||
|
||||
_obj attachto [_veh, _attachOffset];
|
71
sem/scripts/fn_convoyRoute.sqf
Normal file
71
sem/scripts/fn_convoyRoute.sqf
Normal file
@ -0,0 +1,71 @@
|
||||
/* KiloSwiss */
|
||||
private["_startPos","_endPos","_defaultCenterPos","_worldSize","_locations","_worldRadius","_searchRadius","_blockRadius","_blockPos","_found"];
|
||||
|
||||
_defaultCenterPos = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
|
||||
|
||||
_worldSize = SEM_worldData select 0;
|
||||
_worldCenterPos = SEM_worldData select 1;
|
||||
_locations = SEM_worldData select 2;;
|
||||
|
||||
_worldRadius = (1500 max (_worldSize/2));
|
||||
_searchRadius = (150 max (_worldRadius/5) min 300);
|
||||
_blockRadius = (500 max (_worldRadius/3) min 3000);
|
||||
|
||||
_blockPos = [];
|
||||
{_blockPos pushBack _x}forEach SEM_lastMissionPositions;
|
||||
{_blockPos pushBack (getMarkerPos _x)}forEach SEM_blockMarker;
|
||||
|
||||
/* Convoy start position */
|
||||
waitUntil{ private["_dir","_searchDist","_posX","_posY","_checkPos","_roads"]; sleep .1; _found = false;
|
||||
/* Randomize the search area */
|
||||
_dir = random 360;
|
||||
_searchDist = (_worldRadius/2 max random(_worldRadius - _searchRadius));
|
||||
_posX = (_worldCenterPos select 0) + sin(_dir) * _searchDist;
|
||||
_posY = (_worldCenterPos select 1) + cos(_dir) * _searchDist;
|
||||
_checkPos = [_posX, _posY, 0];
|
||||
|
||||
_roads = _checkPos nearRoads _searchRadius;
|
||||
if(count _roads > 0)then{
|
||||
{ private "_checkPos";
|
||||
_checkPos = getPos (_roads select _forEachIndex);
|
||||
_startPos = _checkPos findEmptyPosition [0,0,"ProtectionZone_F"];
|
||||
if(count _startPos > 0)exitWith{_found = true};
|
||||
}forEach _roads;
|
||||
};
|
||||
if(_found)then{
|
||||
{if(_x distance _startPos < _blockRadius)exitWith{_found = false}}forEach _blockPos;
|
||||
|
||||
if(_found)then{
|
||||
{if(isPlayer _x)then[{if(_x distance _startPos < _blockRadius)exitWith{_found = false}},{UIsleep .05}]}forEach (if(isMultiplayer)then[{allplayers},{allUnits}]);
|
||||
};
|
||||
};
|
||||
|
||||
(_found)
|
||||
};
|
||||
|
||||
/* Convoy destination */
|
||||
_found = false;
|
||||
while{!_found}do{ UIsleep .1; private["_randomLocation","_locationPos","_locationSize"];
|
||||
|
||||
/* Select a random location */
|
||||
_randomLocation = _locations select random(count _locations -1);
|
||||
_locationPos = locationPosition _randomLocation;
|
||||
|
||||
/* Let's suppose this position is a valid convoy destination */
|
||||
_found = true;
|
||||
|
||||
/* Now check this position */
|
||||
if(_locationPos distance _startPos < (_worldRadius))then{_found = false};
|
||||
|
||||
if(_found)then{ /* Check it again */
|
||||
_locationSize = (if(size _randomLocation select 0 > size _randomLocation select 1)then[{size _randomLocation select 0},{size _randomLocation select 1}]);
|
||||
_endPos = _locationPos findEmptyPosition [0,_locationSize,"ProtectionZone_F"];
|
||||
if(count _endPos == 0)then{_found = false};
|
||||
//_endPos = [_locationPos,0,(50 max _locationSize*1.5 min 200),30,0,0.7,0] call BIS_fnc_findSafePos;
|
||||
//if(_endPos isEqualTo _defaultCenterPos)then{_found = false};
|
||||
};
|
||||
};
|
||||
_endPos set [2,0];
|
||||
_convoyRoute = [_startPos, _endPos];
|
||||
|
||||
_convoyRoute
|
914
sem/scripts/fn_crateLoot.sqf
Normal file
914
sem/scripts/fn_crateLoot.sqf
Normal file
@ -0,0 +1,914 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
/*
|
||||
[_box,1] call SEM_fnc_crateLoot;
|
||||
_box = crate where the loot should be added
|
||||
1 = selected loadout
|
||||
leadouts configure at the bottom of this file!
|
||||
*/
|
||||
|
||||
private ["_crate","_loadout"];
|
||||
_crate = _this select 0;
|
||||
if (count _this > 1) then {
|
||||
_loadout = _this select 1
|
||||
}
|
||||
else {
|
||||
_loadout = round(random 1)
|
||||
};
|
||||
|
||||
|
||||
_crate call SEM_fnc_emptyGear;
|
||||
|
||||
|
||||
_Backpacks_Assault = [
|
||||
"B_AssaultPack_cbr",
|
||||
"B_AssaultPack_dgtl",
|
||||
"B_AssaultPack_khk",
|
||||
"B_AssaultPack_mcamo",
|
||||
"B_AssaultPack_ocamo",
|
||||
"B_AssaultPack_rgr",
|
||||
"B_AssaultPack_sgg"
|
||||
];
|
||||
|
||||
_Backpacks_Carryall = [
|
||||
"B_Carryall_cbr",
|
||||
"B_Carryall_khk",
|
||||
"B_Carryall_mcamo",
|
||||
"B_Carryall_ocamo",
|
||||
"B_Carryall_oli",
|
||||
"B_Carryall_oucamo"
|
||||
];
|
||||
|
||||
_Backpacks_Field = [
|
||||
"B_FieldPack_blk",
|
||||
"B_FieldPack_cbr",
|
||||
"B_FieldPack_khk",
|
||||
"B_FieldPack_ocamo",
|
||||
"B_FieldPack_oli",
|
||||
"B_FieldPack_oucamo"
|
||||
];
|
||||
|
||||
_Backpacks_Kit = [
|
||||
"B_Kitbag_cbr",
|
||||
"B_Kitbag_mcamo",
|
||||
"B_Kitbag_rgr",
|
||||
"B_Kitbag_sgg"
|
||||
];
|
||||
|
||||
_Backpacks_Tactical = [
|
||||
"B_TacticalPack_blk",
|
||||
"B_TacticalPack_mcamo",
|
||||
"B_TacticalPack_ocamo",
|
||||
"B_TacticalPack_oli",
|
||||
"B_TacticalPack_rgr"
|
||||
];
|
||||
|
||||
_Backpacks_Small = [
|
||||
"smallbackpack_red_epoch",
|
||||
"smallbackpack_green_epoch",
|
||||
"smallbackpack_teal_epoch",
|
||||
"smallbackpack_pink_epoch"
|
||||
];
|
||||
|
||||
_Backpacks_Other = ["B_Parachute"];
|
||||
_Backpacks_All = _Backpacks_Carryall +
|
||||
_Backpacks_Field +
|
||||
_Backpacks_Kit +
|
||||
_Backpacks_Tactical +
|
||||
_Backpacks_Small +
|
||||
_Backpacks_Other;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
_Explosives = [
|
||||
"DemoCharge_Remote_Mag",
|
||||
"SatchelCharge_Remote_Mag",
|
||||
"ATMine_Range_Mag",
|
||||
"ClaymoreDirectionalMine_Remote_Mag",
|
||||
"APERSMine_Range_Mag",
|
||||
"APERSBoundingMine_Range_Mag",
|
||||
"SLAMDirectionalMine_Wire_Mag",
|
||||
"APERSTripMine_Wire_Mag"
|
||||
];
|
||||
|
||||
_Paint = [
|
||||
"PaintCanBlk",
|
||||
"PaintCanBlu",
|
||||
"PaintCanBrn",
|
||||
"PaintCanGrn",
|
||||
"PaintCanOra",
|
||||
"PaintCanPur",
|
||||
"PaintCanRed",
|
||||
"PaintCanTeal",
|
||||
"PaintCanYel"
|
||||
];
|
||||
|
||||
/*
|
||||
_Keys = [
|
||||
"ItemKey",
|
||||
"ItemKeyBlue",
|
||||
"ItemKeyGreen",
|
||||
"ItemKeyRed",
|
||||
"ItemKeyYellow",
|
||||
"ItemKeyKit"
|
||||
];
|
||||
*/
|
||||
|
||||
/*
|
||||
_Documents = [
|
||||
"ItemDoc1",
|
||||
"ItemDoc2",
|
||||
"ItemDoc3",
|
||||
"ItemDoc4",
|
||||
"ItemDoc5",
|
||||
"ItemDoc6",
|
||||
"ItemDoc7",
|
||||
"ItemDoc8",
|
||||
"ItemVehDoc1",
|
||||
"ItemVehDoc2",
|
||||
"ItemVehDoc3",
|
||||
"ItemVehDoc4"
|
||||
];
|
||||
*/
|
||||
|
||||
_Gems = [
|
||||
"ItemTopaz",
|
||||
"ItemOnyx",
|
||||
"ItemSapphire",
|
||||
"ItemAmethyst",
|
||||
"ItemEmerald",
|
||||
"ItemCitrine",
|
||||
"ItemRuby",
|
||||
"ItemQuartz",
|
||||
"ItemJade",
|
||||
"ItemGarnet"
|
||||
];
|
||||
|
||||
_RareMetal = [
|
||||
//"ItemBriefcaseGold100oz",
|
||||
"ItemAluminumBar",
|
||||
"ItemCopperBar",
|
||||
"ItemTinBar",
|
||||
"PartOreGold",
|
||||
"PartOreSilver",
|
||||
"ItemGoldBar",
|
||||
"ItemSilverBar",
|
||||
"ItemGoldBar10oz"
|
||||
];
|
||||
|
||||
_Medical = [
|
||||
"FAK",
|
||||
"HeatPack",
|
||||
"ColdPack"
|
||||
];
|
||||
|
||||
_Food_Canned = [
|
||||
"FoodBioMeat",
|
||||
"FoodWalkNSons",
|
||||
"sardines_epoch",
|
||||
"meatballs_epoch",
|
||||
"scam_epoch",
|
||||
"sweetcorn_epoch"
|
||||
];
|
||||
|
||||
_Food_Other = [
|
||||
"FoodMeeps",
|
||||
"FoodSnooter",
|
||||
"honey_epoch"
|
||||
];
|
||||
|
||||
_Food_Cooked = [
|
||||
"CookedSheep_EPOCH",
|
||||
"CookedGoat_EPOCH",
|
||||
"SnakeMeat_EPOCH",
|
||||
"CookedRabbit_EPOCH",
|
||||
"CookedChicken_EPOCH"
|
||||
];
|
||||
|
||||
_Food_Craft = [
|
||||
"SnakeCarcass_EPOCH",
|
||||
"RabbitCarcass_EPOCH",
|
||||
"ChickenCarcass_EPOCH",
|
||||
"GoatCarcass_EPOCH",
|
||||
"SheepCarcass_EPOCH"
|
||||
];
|
||||
|
||||
_Food_Fish = [
|
||||
"ItemTrout",
|
||||
"ItemSeaBass",
|
||||
"ItemTuna"
|
||||
];
|
||||
|
||||
_Food_All = _Food_Canned +
|
||||
_Food_Other +
|
||||
_Food_Cooked +
|
||||
_Food_Fish +
|
||||
_Food_Craft;
|
||||
|
||||
_Drink = [
|
||||
"WhiskeyNoodle",
|
||||
"ItemSodaOrangeSherbet",
|
||||
"ItemSodaPurple",
|
||||
"ItemSodaMocha",
|
||||
"ItemSodaBurst",
|
||||
"ItemSodaRbull"
|
||||
];
|
||||
|
||||
_OtherItems = [
|
||||
// "ItemBriefcaseE",
|
||||
"ItemCoolerE",
|
||||
"ItemDocument",
|
||||
"lighter_epoch",
|
||||
"JackKit"
|
||||
];
|
||||
|
||||
_BuildingKits = [
|
||||
"ItemLockbox",
|
||||
"KitStudWall",
|
||||
"KitWoodFloor",
|
||||
"KitWoodStairs",
|
||||
"KitWoodRamp",
|
||||
"KitFirePlace",
|
||||
"KitShelf",
|
||||
"KitFoundation",
|
||||
"KitCinderWall",
|
||||
"KitSolarGen",
|
||||
"KitWorkbench",
|
||||
"KitWoodTower"
|
||||
];
|
||||
|
||||
_BuildingComponents = [
|
||||
// "PartPlankPack",
|
||||
// "WoodLog_EPOCH",
|
||||
"CinderBlocks",
|
||||
"MortarBucket",
|
||||
"ItemScraps",
|
||||
"ItemCorrugated",
|
||||
"ItemCorrugatedLg"
|
||||
];
|
||||
|
||||
_CraftingTools = [
|
||||
"ChainSaw",
|
||||
"VehicleRepairLg",
|
||||
"Hatchet",
|
||||
"MultiGun",
|
||||
"MeleeSledge"
|
||||
];
|
||||
|
||||
_CraftingComponents = [
|
||||
// "ItemHotwire",
|
||||
// "ItemComboLock",
|
||||
// "ItemPipe",
|
||||
// "ItemBulb",
|
||||
// "ItemBurlap",
|
||||
"CircuitParts",
|
||||
"VehicleRepair",
|
||||
"ItemMixOil",
|
||||
"emptyjar_epoch",
|
||||
"jerrycan_epoch",
|
||||
"ItemBarrelF",
|
||||
"ItemBarrelE",
|
||||
"EnergyPack",
|
||||
"EnergyPackLg",
|
||||
"Heal_EPOCH",
|
||||
"Defib_EPOCH",
|
||||
"Repair_EPOCH",
|
||||
"ItemSolar",
|
||||
"ItemCables",
|
||||
"ItemBattery",
|
||||
"ItemPlywoodPack"
|
||||
];
|
||||
|
||||
_Grenades_Hand = [
|
||||
"HandGrenade",
|
||||
"MiniGrenade"
|
||||
];
|
||||
|
||||
_Grenades_Smoke = [
|
||||
"SmokeShell",
|
||||
"SmokeShellYellow",
|
||||
"SmokeShellGreen",
|
||||
"SmokeShellRed",
|
||||
"SmokeShellPurple",
|
||||
"SmokeShellOrange",
|
||||
"SmokeShellBlue"
|
||||
];
|
||||
|
||||
_Grenades_Light = [
|
||||
"Chemlight_green",
|
||||
"Chemlight_red",
|
||||
"Chemlight_yellow",
|
||||
"Chemlight_blue"
|
||||
];
|
||||
|
||||
_Grenades_ALL = _Grenades_Hand +
|
||||
_Grenades_Smoke +
|
||||
_Grenades_Light;
|
||||
|
||||
_Shell_Smokes = [
|
||||
// "1Rnd_Smoke_Grenade_shell",
|
||||
// "1Rnd_SmokeRed_Grenade_shell",
|
||||
// "1Rnd_SmokeGreen_Grenade_shell",
|
||||
// "1Rnd_SmokeYellow_Grenade_shell",
|
||||
// "1Rnd_SmokePurple_Grenade_shell",
|
||||
// "1Rnd_SmokeBlue_Grenade_shell",
|
||||
// "1Rnd_SmokeOrange_Grenade_shell",
|
||||
"3Rnd_Smoke_Grenade_shell",
|
||||
"3Rnd_SmokeRed_Grenade_shell",
|
||||
"3Rnd_SmokeGreen_Grenade_shell",
|
||||
"3Rnd_SmokeYellow_Grenade_shell",
|
||||
"3Rnd_SmokePurple_Grenade_shell",
|
||||
"3Rnd_SmokeBlue_Grenade_shell",
|
||||
"3Rnd_SmokeOrange_Grenade_shell"
|
||||
];
|
||||
|
||||
_Shell_Flares = [
|
||||
// "UGL_FlareWhite_F",
|
||||
// "UGL_FlareGreen_F",
|
||||
// "UGL_FlareRed_F",
|
||||
// "UGL_FlareYellow_F",
|
||||
// "UGL_FlareCIR_F",
|
||||
"3Rnd_UGL_FlareWhite_F",
|
||||
"3Rnd_UGL_FlareGreen_F",
|
||||
"3Rnd_UGL_FlareRed_F",
|
||||
"3Rnd_UGL_FlareYellow_F",
|
||||
"3Rnd_UGL_FlareCIR_F"
|
||||
];
|
||||
|
||||
_Shell_Grenade = [
|
||||
"3Rnd_HE_Grenade_shell",
|
||||
"1Rnd_HE_Grenade_shell",
|
||||
"1Rnd_HE_Grenade_shell"
|
||||
];
|
||||
|
||||
_Shell_ALL = _Shell_Smokes +
|
||||
_Shell_Flares +
|
||||
_Shell_Grenade;
|
||||
|
||||
_Radios = [
|
||||
"EpochRadio0",
|
||||
"EpochRadio1",
|
||||
"EpochRadio2",
|
||||
"EpochRadio3",
|
||||
"EpochRadio4",
|
||||
"EpochRadio5",
|
||||
"EpochRadio6",
|
||||
"EpochRadio7",
|
||||
"EpochRadio8",
|
||||
"EpochRadio9"
|
||||
];
|
||||
|
||||
_BeltItems = [
|
||||
"ItemCompass",
|
||||
"ItemGPS",
|
||||
"ItemWatch",
|
||||
"Binocular",
|
||||
"NVG_EPOCH",
|
||||
"Rangefinder"
|
||||
];
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
_Ammo762 = [
|
||||
"20Rnd_762x51_Mag",
|
||||
"10Rnd_762x54_Mag",
|
||||
"30Rnd_762x39_Mag",
|
||||
"20rnd_762_magazine",
|
||||
"150Rnd_762x54_Box",
|
||||
"150Rnd_762x54_Box_Tracer"
|
||||
];
|
||||
|
||||
_Ammo127 = [
|
||||
"5Rnd_127x108_Mag",
|
||||
"5Rnd_127x108_APDS_Mag"
|
||||
];
|
||||
|
||||
_Ammo65 = [
|
||||
"30Rnd_65x39_caseless_green",
|
||||
"30Rnd_65x39_caseless_green_mag_Tracer",
|
||||
"30Rnd_65x39_caseless_mag",
|
||||
"30Rnd_65x39_caseless_mag_Tracer",
|
||||
"200Rnd_65x39_cased_Box",
|
||||
"100Rnd_65x39_caseless_mag",
|
||||
"200Rnd_65x39_cased_Box_Tracer",
|
||||
"100Rnd_65x39_caseless_mag_Tracer"
|
||||
];
|
||||
|
||||
_Ammo556 = [
|
||||
"20Rnd_556x45_UW_mag",
|
||||
"30Rnd_556x45_Stanag",
|
||||
"30Rnd_556x45_Stanag_Tracer_Red",
|
||||
"30Rnd_556x45_Stanag_Tracer_Green",
|
||||
"30Rnd_556x45_Stanag_Tracer_Yellow",
|
||||
"200Rnd_556x45_M249"
|
||||
];
|
||||
|
||||
_AmmoMarks = [
|
||||
"10Rnd_338_Mag",
|
||||
"20Rnd_762x51_Mag",
|
||||
"10Rnd_127x54_Mag",
|
||||
"10Rnd_93x64_DMR_05_Mag"
|
||||
];
|
||||
_AmmoMarksMMG = [
|
||||
"150Rnd_93x64_Mag",
|
||||
"130Rnd_338_Mag"
|
||||
];
|
||||
|
||||
_AmmoOther = [
|
||||
"7Rnd_408_Mag",
|
||||
"spear_magazine",
|
||||
"5Rnd_rollins_mag"
|
||||
];
|
||||
|
||||
_AmmoHandGun = [
|
||||
"30Rnd_45ACP_Mag_SMG_01",
|
||||
"30Rnd_45ACP_Mag_SMG_01_Tracer_Green",
|
||||
"9Rnd_45ACP_Mag",
|
||||
"11Rnd_45ACP_Mag",
|
||||
"6Rnd_45ACP_Cylinder",
|
||||
"16Rnd_9x21_Mag",
|
||||
"30Rnd_9x21_Mag",
|
||||
"10rnd_22X44_magazine",
|
||||
"9rnd_45X88_magazine",
|
||||
"6Rnd_GreenSignal_F",
|
||||
"6Rnd_RedSignal_F"
|
||||
];
|
||||
|
||||
_Ammo_ALL = _Ammo762 +
|
||||
_Ammo127 +
|
||||
_Ammo65 +
|
||||
_Ammo556 +
|
||||
_AmmoMarks +
|
||||
// _AmmoMarksMMG +
|
||||
_AmmoOther +
|
||||
_AmmoHandGun;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
_Pistols = [
|
||||
["hgun_PDW2000_F", "30Rnd_9x21_Mag"],
|
||||
["hgun_ACPC2_F", "9Rnd_45ACP_Mag"],
|
||||
["hgun_Rook40_F", "30Rnd_9x21_Mag"],
|
||||
["hgun_P07_F", "30Rnd_9x21_Mag"],
|
||||
["hgun_Pistol_heavy_01_F", "11Rnd_45ACP_Mag"],
|
||||
["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"],
|
||||
["ruger_pistol_epoch", "10rnd_22X44_magazine"],
|
||||
["1911_pistol_epoch", "9rnd_45X88_magazine"],
|
||||
["hgun_Pistol_Signal_F", "6Rnd_RedSignal_F0"]
|
||||
];
|
||||
|
||||
_RifleSniper762 = [
|
||||
["srifle_EBR_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_01_F", "20Rnd_762x51_Mag"],
|
||||
["M14_EPOCH", "20Rnd_762x51_Mag"],
|
||||
["M14Grn_EPOCH", "20Rnd_762x51_Mag"]
|
||||
];
|
||||
|
||||
_RifleSniper127 = [
|
||||
["srifle_GM6_F", "5Rnd_127x108_Mag"],
|
||||
["m107Tan_EPOCH", "5Rnd_127x108_Mag"],
|
||||
["m107_EPOCH", "5Rnd_127x108_Mag"]
|
||||
];
|
||||
|
||||
_RifleSniper408 = [
|
||||
["srifle_LRR_F", "7Rnd_408_Mag"]
|
||||
];
|
||||
|
||||
_RifleSniper65 = [
|
||||
["arifle_MXM_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MXM_Black_F", "30Rnd_65x39_caseless_mag_Tracer"]
|
||||
];
|
||||
|
||||
_RifleLMG762 = [
|
||||
["LMG_Zafir_F", "150Rnd_762x54_Box_Tracer"]
|
||||
];
|
||||
|
||||
_RifleLMG65 = [
|
||||
["LMG_Mk200_F", "200Rnd_65x39_cased_Box_Tracer"],
|
||||
["arifle_MX_SW_F", "100Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MX_SW_Black_F", "100Rnd_65x39_caseless_mag_Tracer"]
|
||||
];
|
||||
|
||||
_RifleLMG556 = [
|
||||
["m249_EPOCH", "200Rnd_556x45_M249"],
|
||||
["m249Tan_EPOCH", "200Rnd_556x45_M249"]
|
||||
];
|
||||
_RifleMarksMMG = [
|
||||
["MMG_01_hex_F", "150Rnd_93x64_Mag"],
|
||||
["MMG_01_tan_F", "150Rnd_93x64_Mag"],
|
||||
["MMG_02_camo_F", "130Rnd_338_Mag"],
|
||||
["MMG_02_black_F", "130Rnd_338_Mag"],
|
||||
["MMG_02_sand_F", "130Rnd_338_Mag"]
|
||||
];
|
||||
_Rifle65Lnchr = [
|
||||
["arifle_Katiba_GL_F", "30Rnd_65x39_caseless_green_mag_Tracer"],
|
||||
["arifle_MX_GL_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MX_GL_Black_F", "30Rnd_65x39_caseless_mag_Tracer"]
|
||||
];
|
||||
|
||||
_Rifle556Lnchr = [
|
||||
["arifle_Mk20_GL_F", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["arifle_Mk20_GL_plain_F", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["arifle_TRG21_GL_F", "30Rnd_556x45_Stanag_Tracer_Green"]
|
||||
];
|
||||
|
||||
_RifleAssault762 = [
|
||||
["AKM_EPOCH", "30Rnd_762x39_Mag"]
|
||||
];
|
||||
|
||||
_RifleAssault65 = [
|
||||
["arifle_Katiba_C_F", "30Rnd_65x39_caseless_green_mag_Tracer"],
|
||||
["arifle_Katiba_F", "30Rnd_65x39_caseless_green_mag_Tracer"],
|
||||
["arifle_MXC_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MX_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MX_Black_F", "30Rnd_65x39_caseless_mag_Tracer"],
|
||||
["arifle_MXC_Black_F", "30Rnd_65x39_caseless_mag_Tracer"]
|
||||
];
|
||||
|
||||
_RifleAssault556 = [
|
||||
["arifle_TRG21_F", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["arifle_TRG20_F", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["arifle_Mk20_plain_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["arifle_Mk20C_plain_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["arifle_Mk20C_F", "30Rnd_556x45_Stanag_Tracer_Red"],
|
||||
["arifle_Mk20_F", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["m16_EPOCH", "30Rnd_556x45_Stanag_Tracer_Yellow"],
|
||||
["m16Red_EPOCH", "30Rnd_556x45_Stanag_Tracer_Green"],
|
||||
["m4a3_EPOCH", "30Rnd_556x45_Stanag_Tracer_Red"]
|
||||
];
|
||||
|
||||
_RifleMarks = [
|
||||
["srifle_DMR_02_F", "10Rnd_338_Mag"],
|
||||
["srifle_DMR_02_camo_F", "10Rnd_338_Mag"],
|
||||
["srifle_DMR_02_sniper_F", "10Rnd_338_Mag"],
|
||||
["srifle_DMR_03_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_03_khaki_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_03_tan_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_03_multicam_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_03_woodland_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_06_camo_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_06_olive_F", "20Rnd_762x51_Mag"],
|
||||
["srifle_DMR_04_Tan_F", "10Rnd_127x54_Mag"],
|
||||
["srifle_DMR_05_blk_F", "10Rnd_93x64_DMR_05_Mag"],
|
||||
["srifle_DMR_05_hex_F", "10Rnd_93x64_DMR_05_Mag"],
|
||||
["srifle_DMR_05_tan_F", "10Rnd_93x64_DMR_05_Mag"]
|
||||
];
|
||||
|
||||
_RifleSniper = _RifleSniper762 +
|
||||
_RifleSniper127 +
|
||||
_RifleSniper408 +
|
||||
_RifleSniper65 +
|
||||
_RifleMarks;
|
||||
|
||||
_RifleLMG = _RifleLMG762 +
|
||||
_RifleLMG65 +
|
||||
// _RifleMarksMMG +
|
||||
_RifleLMG556;
|
||||
|
||||
_RifleLnchr = _Rifle65Lnchr +
|
||||
_Rifle556Lnchr;
|
||||
|
||||
_RifleAssault = _RifleAssault762 +
|
||||
_RifleAssault65 +
|
||||
_RifleAssault556 +
|
||||
_RifleLnchr;
|
||||
|
||||
_Rifle_Mid = _RifleAssault +
|
||||
_RifleLnchr;
|
||||
|
||||
_Rifle_Heavy = _RifleSniper +
|
||||
_RifleLMG;
|
||||
|
||||
_Rifle_ALL = _RifleSniper +
|
||||
_RifleLMG +
|
||||
_RifleLnchr +
|
||||
_RifleAssault;
|
||||
|
||||
_WeaponAttachments_Optics =[
|
||||
// "optic_Nightstalker",
|
||||
"optic_Arco",
|
||||
"optic_Hamr",
|
||||
"optic_Aco",
|
||||
"optic_ACO_grn",
|
||||
"optic_Aco_smg",
|
||||
"optic_ACO_grn_smg",
|
||||
"optic_Holosight",
|
||||
"optic_Holosight_smg",
|
||||
"optic_SOS",
|
||||
"optic_MRCO",
|
||||
"optic_DMS",
|
||||
"optic_Yorris",
|
||||
"optic_MRD",
|
||||
"optic_LRPS",
|
||||
"optic_NVS",
|
||||
"optic_tws",
|
||||
"optic_tws_mg"
|
||||
];
|
||||
|
||||
_WeaponAttachments_Muzzle =[
|
||||
"muzzle_snds_H", // 6.5mm
|
||||
"muzzle_snds_L", // 9mm
|
||||
"muzzle_snds_M", // 556mm
|
||||
"muzzle_snds_B", // 7.62mm
|
||||
"muzzle_snds_H_MG", // 6.5 LMG
|
||||
"muzzle_snds_acp" // 45 cal
|
||||
];
|
||||
|
||||
_WeaponAttachments_Other = [
|
||||
"acc_flashlight",
|
||||
"acc_pointer_IR"
|
||||
];
|
||||
|
||||
_out = switch (_loadout) do {
|
||||
case 0:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 1:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 2:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 3:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 4:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 5:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 6:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 7:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 8:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 9:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
case 10:{
|
||||
[
|
||||
[_Backpacks_All,[2,0]],
|
||||
[_Food_All,[2,1]],
|
||||
[_Drink,[2,1]],
|
||||
[_BeltItems,[0,1]],
|
||||
[_OtherItems,[0,1]],
|
||||
[_Medical,[0,1]],
|
||||
[_Gems,[0,1]],
|
||||
[_Explosives,[0,1]],
|
||||
[_Grenades_ALL,[0,3]],
|
||||
[_Rifle_ALL,[1,3]],
|
||||
[_Ammo_ALL,[1,3]],
|
||||
[_Shell_ALL,[0,3]],
|
||||
[_WeaponAttachments_Optics,[0,2]],
|
||||
[_WeaponAttachments_Muzzle,[0,2]],
|
||||
[_WeaponAttachments_Other,[0,2]],
|
||||
[_BuildingKits,[1,4]],
|
||||
[_BuildingComponents,[1,5]],
|
||||
[_CraftingTools,[0,2]],
|
||||
[_CraftingComponents,[0,1]],
|
||||
["FAK",[1,3]]
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
{
|
||||
_objArr = _x select 0;
|
||||
_countarr = _x select 1;
|
||||
_min = _countarr select 0;
|
||||
_add = round (random (_countarr select 1));
|
||||
if (_objArr isequaltype "") then {
|
||||
_crate additemcargoGlobal [_objArr, _min + _add];
|
||||
}
|
||||
else {
|
||||
for "_i" from 1 to (_min + _add) do {
|
||||
_item = selectrandom _objArr;
|
||||
_objArr = _objArr - [_item];
|
||||
if (_item isequaltype []) then {
|
||||
_crate addWeaponCargoGlobal [(_item select 0), 1];
|
||||
_crate addMagazineCargoGlobal [(_item select 1), 2];
|
||||
}
|
||||
else {
|
||||
if (_item iskindof "Bag_Base") then {
|
||||
_crate addbackpackcargoGlobal [_item,1];
|
||||
}
|
||||
else {
|
||||
_crate additemcargoGlobal [_item, 1];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} foreach _out;
|
||||
|
101
sem/scripts/fn_createComposition.sqf
Normal file
101
sem/scripts/fn_createComposition.sqf
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
_script = _this select 0;
|
||||
_azi = _this select 1;
|
||||
_pos = _this select 2;
|
||||
|
||||
_objs = [];
|
||||
_objs = call (compile (preprocessFileLineNumbers format [SEM_staticMissionsPath + "compositions\%1.sqf",_script]));
|
||||
private ["_posX", "_posY"];
|
||||
|
||||
_anchorBldg = _objs select 0;
|
||||
_xShift = (_anchorBldg select 1) select 0;
|
||||
_yShift = (_anchorBldg select 1) select 1;
|
||||
_zShift = (_anchorBldg select 1) select 2;
|
||||
{
|
||||
(_x select 1) set [0,((_x select 1 select 0) - _xShift)];
|
||||
(_x select 1) set [1,((_x select 1 select 1) - _yShift)];
|
||||
(_x select 1) set [2,(_x select 1 select 2)];
|
||||
} forEach _objs;
|
||||
|
||||
_posX = _pos select 0;
|
||||
_posY = _pos select 1;
|
||||
_newObjs = [];
|
||||
private ["_multiplyMatrixFunc"];
|
||||
_multiplyMatrixFunc =
|
||||
{
|
||||
private ["_array1", "_array2", "_result"];
|
||||
_array1 = _this select 0;
|
||||
_array2 = _this select 1;
|
||||
_result =
|
||||
[
|
||||
(((_array1 select 0) select 0) * (_array2 select 0)) + (((_array1 select 0) select 1) * (_array2 select 1)),
|
||||
(((_array1 select 1) select 0) * (_array2 select 0)) + (((_array1 select 1) select 1) * (_array2 select 1))
|
||||
];
|
||||
_result
|
||||
};
|
||||
for "_i" from 0 to ((count _objs) - 1) do
|
||||
{
|
||||
private ["_obj", "_type", "_relPos", "_azimuth", "_fuel", "_damage", "_newObj"];
|
||||
_obj = _objs select _i;
|
||||
_type = _obj select 0;
|
||||
_relPos = _obj select 1;
|
||||
_azimuth = _obj select 2;
|
||||
|
||||
private ["_rotMatrix", "_newRelPos", "_newPos"];
|
||||
_rotMatrix =[[cos _azi, sin _azi],[-(sin _azi), cos _azi]];
|
||||
_newRelPos = [_rotMatrix, _relPos] call _multiplyMatrixFunc;
|
||||
private ["_z"];
|
||||
if ((count _relPos) > 2) then {
|
||||
_z = _relPos select 2
|
||||
}
|
||||
else {
|
||||
_z = 0
|
||||
};
|
||||
_newPos = [_posX + (_newRelPos select 0), _posY + (_newRelPos select 1), _z];
|
||||
_newObj = createVehicle [_type, _newPos, [], 0, "CAN_COLLIDE"];
|
||||
_newObj setDir (_azi + _azimuth);
|
||||
if (surfaceiswater _newPos) then {
|
||||
_newObj setPosASL _newPos;
|
||||
}
|
||||
else {
|
||||
_newObj setPosATL _newPos;
|
||||
};
|
||||
_newObj allowdamage false;
|
||||
if !(_type in ["Box_NATO_AmmoVeh_F","Land_MetalCase_01_large_F"]) then {
|
||||
if !(_newObj iskindof "house") then {
|
||||
_newObj enablesimulationglobal false;
|
||||
};
|
||||
};
|
||||
|
||||
if (count _obj > 3) then {
|
||||
if (typename (_obj select 3) == "ARRAY") then {
|
||||
// _newObj setvectordirandup (_obj select 3);
|
||||
};
|
||||
if (typename (_obj select 3) == "STRING") then {
|
||||
_newObj call compile format ["%1",(_obj select 3)];
|
||||
};
|
||||
if (typename (_obj select 3) == "SCALAR") then {
|
||||
_newObj setFuel (_obj select 3);
|
||||
};
|
||||
};
|
||||
if (count _obj > 4) then {
|
||||
if (typename (_obj select 4) == "STRING") then {
|
||||
_newObj call compile format ["%1",(_obj select 4)];
|
||||
};
|
||||
if (typename (_obj select 4) == "SCALAR") then {
|
||||
_newObj setDamage (_obj select 4);
|
||||
};
|
||||
};
|
||||
if (count _obj > 5) then {
|
||||
if (typename (_obj select 5) == "STRING") then {
|
||||
_newObj call compile format ["%1",(_obj select 5)];
|
||||
};
|
||||
};
|
||||
_newObjs pushBack _newObj;
|
||||
};
|
||||
|
||||
_newObjs
|
4
sem/scripts/fn_emptyGear.sqf
Normal file
4
sem/scripts/fn_emptyGear.sqf
Normal file
@ -0,0 +1,4 @@
|
||||
clearItemCargoGlobal _this;
|
||||
clearWeaponCargoGlobal _this;
|
||||
clearMagazineCargoGlobal _this;
|
||||
clearBackPackCargoGlobal _this;
|
69
sem/scripts/fn_endCondition.sqf
Normal file
69
sem/scripts/fn_endCondition.sqf
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
EMS Mission end condition
|
||||
|
||||
_return = [_pos,_units,_start,_timeout,[_obj1,_obj2,_obj3]]call SEM_fnc_endCondition;
|
||||
|
||||
Returns:
|
||||
0 = false (default when no condition is met)
|
||||
1 = time is up and no player is nearby
|
||||
2 = All objects (vehicles) are destroyed
|
||||
3 = AI is dead
|
||||
|
||||
*/
|
||||
private["_pos","_units","_start","_timeOut","_missionID","_objects","_return","_playerPresent"];
|
||||
|
||||
_pos = _this select 0;
|
||||
_units = _this select 1;
|
||||
_start = _this select 2;
|
||||
_timeOut = _this select 3;
|
||||
_missionID = _this select 4;
|
||||
if (count _this > 5) then {
|
||||
_objects = _this select 5
|
||||
}
|
||||
else {
|
||||
_objects = []
|
||||
};
|
||||
|
||||
|
||||
_return = 0;
|
||||
_playerPresent = false;
|
||||
|
||||
if (_timeOut > 0) then { //Mission time out possible
|
||||
if (time - _start > _timeOut) then { //Time is up
|
||||
/* Check for players in the area */
|
||||
{
|
||||
uisleep 0.1;
|
||||
if(isPlayer _x && _x distance _pos < (500 max SEM_AIsniperDamageDistance)) exitwith {
|
||||
_playerPresent = true
|
||||
};
|
||||
} forEach (if(isMultiplayer)then[{allplayers},{allUnits}]);
|
||||
if (!_playerPresent) then {_return = 1};
|
||||
};
|
||||
};
|
||||
|
||||
if (_return < 1 && count _objects > 0) then {
|
||||
if ({alive _x}count _objects == 0) then {
|
||||
_return = 2
|
||||
};
|
||||
};
|
||||
|
||||
if (_return < 2) then {
|
||||
if({alive _x} count _units < 1)then{
|
||||
_return = 3
|
||||
};
|
||||
};
|
||||
|
||||
if (_return < 3) then{
|
||||
{
|
||||
if(_x isKindOf "Car" || _x isKindOf "tank")then{
|
||||
_y = _x;
|
||||
{
|
||||
if(isPlayer _x && alive _x) exitWith {
|
||||
_return = 3
|
||||
}
|
||||
} count crew _y;
|
||||
};
|
||||
}forEach _objects;
|
||||
};
|
||||
|
||||
_return
|
64
sem/scripts/fn_findMissionPos.sqf
Normal file
64
sem/scripts/fn_findMissionPos.sqf
Normal file
@ -0,0 +1,64 @@
|
||||
/* KiloSwiss */
|
||||
private["_defaultCenterPos","_worldsize","_worldRadius","_worldCenterPos","_blockPos","_searchDist","_searchRadius","_blockRadius","_found","_dir","_posX","_posY","_searchPos","_newPos"];
|
||||
|
||||
_defaultCenterPos = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
|
||||
|
||||
_worldsize = SEM_worldData select 0;
|
||||
_worldCenterPos = SEM_worldData select 1;
|
||||
|
||||
_worldRadius = (1500 max ((_worldsize*0.9)/2));
|
||||
_searchRadius = (150 max (_worldRadius/5) min 300);
|
||||
_blockRadius = (500 max (_worldRadius/3) min 1200);
|
||||
|
||||
|
||||
while{count SEM_lastMissionPositions > 5}do{SEM_lastMissionPositions deleteAt 0};
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["#SEM DEBUG: previous mission pos: %1 %2",count SEM_lastMissionPositions, SEM_lastMissionPositions]};
|
||||
|
||||
_blockPos = [];
|
||||
{_blockPos pushBack _x}forEach SEM_lastMissionPositions;
|
||||
{_blockPos pushBack (getMarkerPos _x)}forEach SEM_blockMarker;
|
||||
{_blockPos pushBack _x}forEach SEM_blockPos;
|
||||
|
||||
_found = false;
|
||||
while{!_found}do{
|
||||
uisleep 0.5;
|
||||
|
||||
/* Randomize the search area */
|
||||
_dir = random 360;
|
||||
_searchDist = (_searchRadius max (random _worldRadius) min (_worldRadius - _searchRadius));
|
||||
_posX = (_worldCenterPos select 0) + sin(_dir) * _searchDist;
|
||||
_posY = (_worldCenterPos select 1) + cos(_dir) * _searchDist;
|
||||
_searchPos = [_posX, _posY, 0];
|
||||
/* Get a position using "BIS_fnc_findSafePos" */
|
||||
_newPos = [_searchPos,0,_searchRadius,45,0,0.5,0] call BIS_fnc_findSafePos;
|
||||
/* Let's suppose this position is ready to spawn a mission on it */
|
||||
_found = true;
|
||||
|
||||
/* Now check this position */
|
||||
if(_newPos isEqualTo _defaultCenterPos)then{_found = false};
|
||||
|
||||
if(_found)then{ /* Check it again */
|
||||
{if(_x distance _newPos < _blockRadius)exitWith{_found = false}}forEach _blockPos;
|
||||
|
||||
if(_found)then{ /* And again */
|
||||
for "_i" from 0 to 300 step 60 do{ _dir = _i;
|
||||
_posX = (_newPos select 0) + sin (_dir) * 40;
|
||||
_posY = (_newPos select 1) + cos (_dir) * 40;
|
||||
if(surfaceIsWater [_posX, _posY])exitWith{_found = false};
|
||||
};
|
||||
|
||||
if(_found)then{ /* And do a last check */
|
||||
{if(isPlayer _x)then[{if(_x distance _newPos < _blockRadius)exitWith{_found = false}},{UIsleep .05}]}forEach (if(isMultiplayer)then[{allplayers},{allUnits}]);
|
||||
};
|
||||
if(_found) then {
|
||||
_plotpoles = nearestobjects [_newPos, ["PlotPole_EPOCH"],_blockRadius];
|
||||
if !(_plotpoles isequalto []) exitwith {
|
||||
_found = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
_newPos set [2,0];
|
||||
|
||||
_newPos;
|
84
sem/scripts/fn_getWorldData.sqf
Normal file
84
sem/scripts/fn_getWorldData.sqf
Normal file
@ -0,0 +1,84 @@
|
||||
private["_mapSize","_mapCenter","_worldData","_locations"];
|
||||
/*
|
||||
_return = [] call SEM_fnc_getWorldData;
|
||||
|
||||
Returns the following:
|
||||
_return select 0 = World size
|
||||
_return select 1 = World center position
|
||||
_return select 2 = Locations
|
||||
|
||||
|
||||
06.02.2015 by KiloSwiss
|
||||
*/
|
||||
|
||||
_mapSize = getNumber(configFile >> "CfgWorlds" >> worldName >> "MapSize");
|
||||
if(_mapSize > 0)then{
|
||||
_worldData = [_mapSize, [(_mapSize/2), (_mapSize/2), 0]];
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["#SEM DEBUG: WorldData get MapSize (%1) for island %2 from config", _mapSize, str worldName]};
|
||||
}else{
|
||||
if((getMarkerPos "center" select 0) > (getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition") select 0))then[{
|
||||
_mapSize = (getMarkerPos "center" select 0) * 2;
|
||||
_mapCenter = getMarkerPos "center";
|
||||
_worldData = [_mapSize, _mapCenter];
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["#SEM DEBUG: WorldData get MapSize (%1) for island %2 from center Marker", _mapSize, str worldName]};
|
||||
},{
|
||||
_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
|
||||
_mapCenter set [2,0];
|
||||
_mapSize = (_mapCenter select 0) * 2;
|
||||
_worldData =[_mapSize, _mapCenter];
|
||||
if(SEM_debug in ["log","full"])then{diag_log format["#SEM DEBUG: WorldData get MapSize (%1) for island %2 from default center position", _worldData select 0, str worldName]};
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
_locations = nearestLocations [_worldData select 1, ["NameCityCapital","NameCity","NameVillage","NameLocal","CityCenter","Airport"], ((_worldData select 0)/2)];
|
||||
|
||||
//_locations = (configfile >> "CfgWorlds" >> worldName >> "Names") call BIS_fnc_returnChildren;
|
||||
|
||||
_worldData pushBack _locations;
|
||||
|
||||
_worldData
|
||||
|
||||
/* To check size on different islands, use this code:
|
||||
private["_worldRadius","_worldCenterPos","_marker"];
|
||||
deleteMarkerLocal "Center";
|
||||
_worldRadius = (getNumber(configFile >> "CfgWorlds" >> worldName >> "MapSize")/2);
|
||||
_worldCenterPos = [ _worldRadius, _worldRadius, 0];
|
||||
_marker = createMarkerLocal ["Center", _worldCenterPos];
|
||||
_marker setMarkerPosLocal _worldCenterPos;
|
||||
_marker setMarkerShapeLocal "ELLIPSE";
|
||||
_marker setMarkerSizeLocal [_worldRadius, _worldRadius];
|
||||
_marker setMarkerColorLocal "ColorBlack";
|
||||
_marker setMarkerAlphaLocal 0.5;
|
||||
_marker setMarkerBrushLocal "SolidFull";
|
||||
copytoClipboard format["%1 / %2 / %3", toLower worldName, _worldRadius*2, _worldCenterPos];
|
||||
hint format["Copy to clipboard\nUse %4 to paste this information:\n\nWorldName: %1\nSize: %2\nCenter: %3", worldName, _worldRadius*2, _worldCenterPos, str (ctrl+v)];
|
||||
*/
|
||||
|
||||
/* To create coloured markers on all found locations use:
|
||||
_worldRadius = (getNumber(configFile >> "CfgWorlds" >> worldName >> "MapSize")/2);
|
||||
_worldCenterPos = [ _worldRadius, _worldRadius, 0];
|
||||
_allLocations = nearestLocations [_centerPos, ["NameCityCapital","NameCity","NameVillage","NameLocal","CityCenter","Airport","NameMarine","Strategic","ViewPoint","RockArea","StrongpointArea","FlatArea","FlatAreaCity","FlatAreaCitySmall"], _worldRadius * 2];
|
||||
{ private ["_marker","_markerName","_marker2","_markerName2"];
|
||||
_markerName = format["Marker_%1", _forEachIndex];
|
||||
deleteMarkerLocal _markerName;
|
||||
_marker = createMarkerLocal [_markerName, position _x];
|
||||
_marker setMarkerShapeLocal "ELLIPSE";
|
||||
_marker setMarkerSizeLocal [size _x select 0, size _x select 1];
|
||||
_marker setMarkerTextLocal format["%1 %2", _forEachIndex, type _x];
|
||||
|
||||
if ((type _x) in ["NameCityCapital","NameCity","NameVillage","NameLocal","CityCenter","Airport"])then{ _marker setMarkerColorLocal "ColorWhite"; };
|
||||
if ((type _x) in ["NameMarine"])then{ _marker setMarkerColorLocal "ColorBlue"; };
|
||||
if ((type _x) in ["Strategic","StrongpointArea"])then{ _marker setMarkerColorLocal "ColorOrange"; };
|
||||
if ((type _x) in ["ViewPoint","RockArea"])then{ _marker setMarkerColorLocal "ColorGreen"; };
|
||||
if ((type _x) in ["FlatArea"])then{ _marker setMarkerColorLocal "ColorRed"; };
|
||||
if ((type _x) in ["FlatAreaCity","FlatAreaCitySmall"])then{ _marker setMarkerColorLocal "ColorYellow"; };
|
||||
|
||||
_markerName2 = format["#Marker_%1", _forEachIndex];
|
||||
deleteMarkerLocal _markerName2;
|
||||
_marker2 = createMarkerLocal [_markerName2, position _x];
|
||||
_marker2 setMarkerTypeLocal "mil_dot";
|
||||
_marker2 setMarkerTextLocal format["%1 %2", _forEachIndex, type _x];
|
||||
_marker2 setMarkerColorLocal "ColorBlack";
|
||||
}forEach _allLocations;
|
||||
*/
|
32
sem/scripts/fn_missionCleanup.sqf
Normal file
32
sem/scripts/fn_missionCleanup.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/* KiloSwiss */
|
||||
_this spawn {
|
||||
private ["_pos","_objs","_sGren"];
|
||||
_pos = _this select 0;
|
||||
_objs = _this select 1;
|
||||
|
||||
uisleep (SEM_MissionCleanup *60);
|
||||
|
||||
for "_i" from 30 to 360 step 30 do {
|
||||
private ["_dist","_posX","_posY","_sGren"];
|
||||
_dist = (10+(random 15));
|
||||
_posX = (_pos select 0) + sin (_i) * _dist;
|
||||
_posY = (_pos select 1) + cos (_i) * _dist;
|
||||
_sGren = createVehicle["SmokeShellOrange", [_posX,_posY,-.1], [], 0, "CAN_COLLIDE"];
|
||||
_objs pushBack _sGren;
|
||||
};
|
||||
sleep 30;
|
||||
{
|
||||
if (!isnull _x) then {
|
||||
if (_x isKindOf "Man") then {
|
||||
removeFromRemainsCollector [_x];
|
||||
deletevehicle _x;
|
||||
}
|
||||
else {
|
||||
if (_x distance _pos < 250) then {
|
||||
deleteVehicle _x
|
||||
};
|
||||
};
|
||||
uisleep 0.1;
|
||||
};
|
||||
} forEach _objs;
|
||||
};
|
115
sem/scripts/fn_missionController.sqf
Normal file
115
sem/scripts/fn_missionController.sqf
Normal file
@ -0,0 +1,115 @@
|
||||
private["_this","_x","_forEachIndex"];
|
||||
|
||||
|
||||
{
|
||||
[_x,_forEachIndex] spawn {
|
||||
private["_missionsArr","_missionPath","_missionType","_lastMission","_playerOnline","_minPlayers","_randomMission","_runningMission","_runningMissionID","_missionStart","_missionTime","_missionPos","_markerPos"];
|
||||
_missionsArr = _this select 0 select 0;
|
||||
_missionPath = _this select 0 select 1;
|
||||
_missionType = _this select 0 select 2;
|
||||
_minPlayers = ( switch(_missionType)do{
|
||||
case "static": {SEM_MinPlayerStatic};
|
||||
case "dynamic": {SEM_MinPlayerDynamic};
|
||||
default {1};
|
||||
});
|
||||
|
||||
|
||||
for "_i" from 0 to (count _missionsArr -1) step 1 do{ // Remove inactive missions
|
||||
if((_missionsArr select _i) select 3 < 1)then[{_missionsArr set [_i, "delete"]},{
|
||||
if(((_missionsArr select _i) select 2) > 0)then{
|
||||
(_missionsArr select _i) set [2, (((_missionsArr select _i) select 2) * 60)];
|
||||
};
|
||||
(_missionsArr select _i) set [3, 1 max ((_missionsArr select _i) select 3) min 100];
|
||||
}];
|
||||
}; _missionsArr = _missionsArr - ["delete"];
|
||||
|
||||
if(SEM_debug isEqualTo "full")then{
|
||||
{
|
||||
_x set [2, (10*60)]
|
||||
}forEach _missionsArr
|
||||
}; // Set mission time out to 10
|
||||
|
||||
_lastMission = "";
|
||||
while {true} do {
|
||||
_playerOnline = playersNumber civilian;
|
||||
if (SEM_debug in ["log","full"]) then {
|
||||
diag_log format["#SEM DEBUG: Online players: %1", playersNumber civilian]
|
||||
};
|
||||
if (_playerOnline < _minPlayers || _playerOnline > SEM_MaxPlayers) then {
|
||||
diag_log format ["#SEM: Waiting for players (%1/%2) to start %3 Missions", _playerOnline, _minPlayers, _missionType];
|
||||
waitUntil {
|
||||
uisleep 5;
|
||||
if(playersNumber civilian != _playerOnline) then {
|
||||
_playerOnline = playersNumber civilian;
|
||||
diag_log format ["#SEM: Waiting for players (%1/%2) to start %3 Missions", _playerOnline, _minPlayers, _missionType];
|
||||
};
|
||||
(_playerOnline >= _minPlayers && _playerOnline <= SEM_MaxPlayers)
|
||||
};
|
||||
diag_log format ["#SEM: Online players: (%1/%2) - Starting next %3 Mission", _playerOnline, _minPlayers, _missionType];
|
||||
};
|
||||
|
||||
_start = time;
|
||||
if (SEM_debug isEqualTo "full") then {
|
||||
uisleep 10
|
||||
}
|
||||
else {
|
||||
if (!isnil "SEM_TimerStart") then {
|
||||
_wait = SEM_TimerStart*60;
|
||||
waitUntil {uisleep 1; (time - _start) >= _wait};
|
||||
SEM_TimerStart = nil;
|
||||
}
|
||||
else {
|
||||
_wait = SEM_MissionTimerMin*60 + random(SEM_MissionTimerMax*60-SEM_MissionTimerMin*60);
|
||||
waitUntil {uisleep 1; (time - _start) >= _wait};
|
||||
}
|
||||
};
|
||||
|
||||
_randomMission = [_missionsArr, _lastMission] call SEM_fnc_selectMission;
|
||||
_lastMission = _randomMission select 0;
|
||||
|
||||
if (_missionType == "static")then{
|
||||
_missionPos = [] call SEM_fnc_findMissionPos;
|
||||
SEM_lastMissionPositions pushBack _missionPos
|
||||
};
|
||||
if (_missionType == "dynamic") then {
|
||||
_missionPos = [] call SEM_fnc_convoyRoute;
|
||||
{
|
||||
SEM_lastMissionPositions pushBack _x
|
||||
} forEach _missionPos
|
||||
};
|
||||
|
||||
SEM_MissionID = SEM_MissionID + 1;
|
||||
_runningMissionID = SEM_MissionID;
|
||||
_runningMission = [_missionPos, _randomMission, _runningMissionID, _missionType] execVM format["%1%2.sqf", _missionPath, _randomMission select 0];
|
||||
_missionStart = time;
|
||||
|
||||
diag_log format ["#SEM: Start %1 mission %2: %3 %4.", _missionType, _runningMissionID, str(_randomMission select 1),
|
||||
if (_missionType == "static") then {
|
||||
"at position " + str(_missionPos)
|
||||
}
|
||||
else {
|
||||
"from position " + str(_missionPos select 0) + " to " + str(_missionPos select 1)
|
||||
}
|
||||
];
|
||||
|
||||
if (_missionType == "static") then {
|
||||
_markerPos = _missionPos call SEM_fnc_randomPos
|
||||
}
|
||||
else {
|
||||
_markerPos = _missionPos select 0
|
||||
};
|
||||
SEM_globalMissionMarker = [true,_markerPos,_runningMissionID,_randomMission select 1, _randomMission select 4, _missionType];
|
||||
SEM_globalMissionMarker call SEM_createMissionMarker;
|
||||
|
||||
waitUntil {uisleep 1; scriptDone _runningMission};
|
||||
_missionTime = (time - _missionStart);
|
||||
diag_log format["#SEM: Finished %1 mission %2: %3 after %4.", _missionType, _runningMissionID, str(_randomMission select 1), str(floor (_missionTime/60)) + "m " + str(_missionTime-(floor(_missionTime/60)*60)) + "s"];
|
||||
};
|
||||
};
|
||||
if (SEM_debug isEqualTo "full") then {
|
||||
uisleep 10
|
||||
}
|
||||
else {
|
||||
uisleep 180
|
||||
};
|
||||
}forEach _this;
|
12
sem/scripts/fn_randomPos.sqf
Normal file
12
sem/scripts/fn_randomPos.sqf
Normal file
@ -0,0 +1,12 @@
|
||||
/* KiloSwiss */
|
||||
private["_pos","_dir","_dist","_posX","_posY","_newPos"];
|
||||
|
||||
_pos = _this;
|
||||
|
||||
_dir = random 360;
|
||||
_dist = (100 + (random 200));
|
||||
_posX = (_pos select 0) + sin(_dir) * _dist;
|
||||
_posY = (_pos select 1) + cos(_dir) * _dist;
|
||||
_newPos = [_posX, _posY, 0];
|
||||
|
||||
_newPos;
|
26
sem/scripts/fn_safeDetach.sqf
Normal file
26
sem/scripts/fn_safeDetach.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/* KiloSwiss */
|
||||
_this spawn { private ["_obj","_radius","_safePos","_smoke"];
|
||||
_obj = _this;
|
||||
|
||||
_radius = 10;
|
||||
waitUntil{ sleep .1;
|
||||
_safePos = (getPos _obj) findEmptyPosition [0,_radius,(typeOf _obj)];
|
||||
_radius = _radius + 5;
|
||||
(count _safePos > 0)
|
||||
};
|
||||
detach _obj;
|
||||
_safePos set [2,0];
|
||||
_obj setPos _safePos;
|
||||
|
||||
if(sunOrMoon < 0.1)then[{ //Dark
|
||||
for "_i" from 120 to 360 step 120 do{ private ["_posX","_posY","_dist"];
|
||||
_dist = (3+(random 5));
|
||||
_posX = (_safePos select 0) + sin (_i) * _dist;
|
||||
_posY = (_safePos select 1) + cos (_i) * _dist;
|
||||
"Chemlight_blue" createVehicle [_posX, _posY, 0];
|
||||
};
|
||||
},{ //Bright
|
||||
_smoke = "SmokeShellBlue" createVehicle _safePos;
|
||||
_smoke setPos _safePos;
|
||||
}];
|
||||
};
|
18
sem/scripts/fn_saveVehicle.sqf
Normal file
18
sem/scripts/fn_saveVehicle.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/* KiloSwiss */
|
||||
private["_veh","_pos","_fuel","_damage","_direction","_searchRadius","_spawnPos"];
|
||||
|
||||
_veh = _this;
|
||||
|
||||
if !(_veh getVariable ["SEM_vehicle",false])exitWith{{_x setDamage 1}count (crew _veh + [_veh])};
|
||||
if (_veh getVariable ["saveEH",0] >= 0)exitWith{};
|
||||
if (!SEM_permanentVehicles)exitWith{};
|
||||
/*
|
||||
EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1;
|
||||
EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit);
|
||||
EPOCH_VehicleSlots=EPOCH_VehicleSlots - [(EPOCH_VehicleSlots select 0)];
|
||||
EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
|
||||
publicVariable "EPOCH_VehicleSlotCount";
|
||||
_veh setVariable ["VEHICLE_SLOT", (EPOCH_VehicleSlots select 0), true];
|
||||
*/
|
||||
/* Save Vehicle */
|
||||
_veh call EPOCH_server_save_vehicle;
|
21
sem/scripts/fn_selectClosest.sqf
Normal file
21
sem/scripts/fn_selectClosest.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
private["_pos","_arr","_sorted","_return"];
|
||||
/*
|
||||
Source: http://forums.bistudio.com/showthread.php?97602-Sort-Array-per-Distance
|
||||
Edited by KiloSwiss to directly return the closest element in the array that is a player
|
||||
*/
|
||||
|
||||
_pos = _this select 0;
|
||||
_arr = _this select 1;
|
||||
diag_log format["### Possible threads: %1", _arr];
|
||||
_sorted = [];
|
||||
{ private "_closest";
|
||||
_closest = _arr select 0; diag_log format["### A: %1", _closest];
|
||||
{if ((_x distance _pos) < (_closest distance _pos)) then {_closest = _x}} count _arr;
|
||||
_sorted pushBack _closest;
|
||||
_arr = _arr - [_closest];
|
||||
}forEach _arr;
|
||||
diag_log format["### B: %1", _sorted];
|
||||
_return = _sorted select 0;
|
||||
diag_log format["### C: %1", _return];
|
||||
|
||||
_return
|
20
sem/scripts/fn_selectMission.sqf
Normal file
20
sem/scripts/fn_selectMission.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
private["_arr","_last","_ran","_sel"];
|
||||
/*
|
||||
Source: http://forums.bistudio.com/showthread.php?97602-Sort-Array-per-Distance
|
||||
Edited by KiloSwiss to select a random mission, accorded to their probability setting.
|
||||
*/
|
||||
|
||||
|
||||
_arr = _this select 0;
|
||||
_last = _this select 1;
|
||||
|
||||
if(count _arr < 2)exitWith{_arr select 0};
|
||||
|
||||
if(count _this > 2)then[{_ran = 1 max (_this select 2) min 100},{_ran = 1 max ceil(random 100);}];
|
||||
|
||||
while{{_x select 3 >= _ran}count _arr == 0}do{_ran = _ran -1};
|
||||
|
||||
_sel = _arr select random (count _arr -1);
|
||||
while{_sel select 3 < _ran || _sel select 0 == _last}do{_sel = _arr select random (count _arr -1)};
|
||||
|
||||
_sel
|
50
sem/scripts/fn_spawnVehicle.sqf
Normal file
50
sem/scripts/fn_spawnVehicle.sqf
Normal file
@ -0,0 +1,50 @@
|
||||
/* KiloSwiss */
|
||||
private["_veh","_pos","_fuel","_damage","_direction","_searchRadius","_spawnPos"];
|
||||
|
||||
_veh = _this select 0;
|
||||
_pos = _this select 1; _pos set[2, 0];
|
||||
_fuel = if(count _this > 2)then[{_this select 2},{0.15 max (random .35)}];
|
||||
_damage = if(count _this > 3)then[{_this select 3},{0.35 max (random .75)}];
|
||||
_direction = if(count _this > 4)then[{_this select 4},{random 360}];
|
||||
|
||||
_searchRadius = 0;
|
||||
waitUntil{
|
||||
_spawnPos = _pos findEmptyPosition [0,_searchRadius,_veh];
|
||||
_searchRadius = _searchRadius + 10;
|
||||
(count _spawnPos > 0)
|
||||
};
|
||||
_veh = createVehicle[_veh, _spawnPos, [], 0, "NO_COLLIDE"];
|
||||
_veh setVariable ["BIS_enableRandomization", false];
|
||||
_veh allowDamage false;
|
||||
_veh setDir _direction;
|
||||
_veh setVectorUp (surfaceNormal (getPos _veh));
|
||||
|
||||
_veh call SEM_fnc_emptyGear;
|
||||
_veh call EPOCH_server_setVToken;
|
||||
_veh call EPOCH_server_vehicleInit;
|
||||
_veh setVariable ["SEM_vehicle", true];
|
||||
|
||||
_veh disableTIEquipment true;
|
||||
_veh lock 2;
|
||||
|
||||
_veh setFuel _fuel;
|
||||
_veh setDamage _damage;
|
||||
_veh allowDamage true;
|
||||
|
||||
_veh
|
||||
|
||||
/*
|
||||
_config=(configFile >> "CfgVehicles" >> _vehClass >> "availableColors");
|
||||
if(isArray(_config))then{_textureSelectionIndex=configFile >> "CfgVehicles" >> _vehClass >> "textureSelectionIndex";
|
||||
_selections=if(isArray(_textureSelectionIndex))then{getArray(_textureSelectionIndex)}else{[0]};
|
||||
_colors=getArray(_config);
|
||||
_textures=_colors select 0;
|
||||
_color=floor(random(count _textures));
|
||||
_count=(count _colors)-1;
|
||||
{if(_count >=_forEachIndex)then{_textures=_colors select _forEachIndex;
|
||||
};
|
||||
_veh setObjectTextureGlobal[_x,(_textures select _color)];
|
||||
}forEach _selections;
|
||||
_veh setVariable["VEHICLE_TEXTURE",_color];
|
||||
};
|
||||
*/
|
35
sem/scripts/fn_vehicleUnlock.sqf
Normal file
35
sem/scripts/fn_vehicleUnlock.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
/* KiloSwiss */
|
||||
private["_veh","_saveEH"];
|
||||
|
||||
_veh = _this;
|
||||
|
||||
if(SEM_permanentVehicles)then[{
|
||||
|
||||
if({isPlayer _x}count (crew _veh) > 0)exitWith{
|
||||
_veh setVariable ["saveEH",-1];
|
||||
_veh call SEM_fnc_saveVehicle;
|
||||
};
|
||||
|
||||
_saveEH = _veh addEventHandler ["getIn", {
|
||||
if(isPlayer (_this select 2))then{
|
||||
(_this select 0) removeEventHandler ["getIn", ((_this select 0) getVariable ["saveEH",0])];
|
||||
(_this select 0) setVariable ["saveEH",-1];
|
||||
(_this select 0) call SEM_fnc_saveVehicle;
|
||||
};
|
||||
}];
|
||||
_veh setVariable ["saveEH",_saveEH];
|
||||
_veh lock 0;
|
||||
|
||||
_veh spawn{ private ["_start","_vehicle"];
|
||||
_vehicle = _this;
|
||||
_start = time;
|
||||
waitUntil{ sleep 30;
|
||||
((time - _start > 1800) || (_vehicle getVariable ["saveEH",0] < 0))
|
||||
};
|
||||
if((_vehicle getVariable ["saveEH",0]) >= 0)then{_vehicle setDamage 1};
|
||||
};
|
||||
},{
|
||||
_veh lock 0;
|
||||
}];
|
||||
|
||||
true
|
57
sem/scripts/objectGrabber/objectGrabber.sqf
Normal file
57
sem/scripts/objectGrabber/objectGrabber.sqf
Normal file
@ -0,0 +1,57 @@
|
||||
scriptName "DynO\data\scripts\objectGrabber.sqf";
|
||||
/*
|
||||
File: objectGrabber.sqf
|
||||
Author: Joris-Jan van 't Land
|
||||
|
||||
Description:
|
||||
Converts a set of placed objects to an object array for the DynO mapper.
|
||||
Places this information in the debug output for processing.
|
||||
|
||||
Parameter(s):
|
||||
_this select 0: position of the anchor point
|
||||
_this select 1: size of the covered area
|
||||
|
||||
Returns:
|
||||
Success flag (Boolean)
|
||||
*/
|
||||
|
||||
//Validate parameter count
|
||||
if ((count _this) < 2) exitWith {debugLog "Log: [objectGrabber] Function requires at least 2 parameters!"; false};
|
||||
|
||||
private ["_anchorPos", "_anchorDim"];
|
||||
_anchorPos = _this select 0;
|
||||
_anchorDim = _this select 1;
|
||||
|
||||
//Validate parameters
|
||||
if ((typeName _anchorPos) != (typeName [])) exitWith {debugLog "Log: [objectGrabber] Anchor position (0) must be an Array!"; false};
|
||||
if ((typeName _anchorDim) != (typeName 0)) exitWith {debugLog "Log: [objectGrabber] Covered area size (1) must be an Number!"; false};
|
||||
|
||||
private ["_objs"];
|
||||
_objs = nearestObjects [_anchorPos, ["All"], _anchorDim];
|
||||
|
||||
for "_i" from 0 to ((count _objs) - 1) do
|
||||
{
|
||||
private ["_obj", "_type"];
|
||||
_obj = _objs select _i;
|
||||
|
||||
_type = typeOf _obj;
|
||||
|
||||
//Exclude human objects.
|
||||
private ["_sim"];
|
||||
_sim = getText (configFile >> "CfgVehicles" >> _type >> "simulation");
|
||||
if !(_sim in ["soldier"]) then
|
||||
{
|
||||
private ["_objPos", "_dX", "_dY", "_z", "_azimuth", "_fuel", "_damage"];
|
||||
_objPos = position _obj;
|
||||
_dX = (_objPos select 0) - (_anchorPos select 0);
|
||||
_dY = (_objPos select 1) - (_anchorPos select 1);
|
||||
_z = _objPos select 2;
|
||||
_azimuth = direction _obj;
|
||||
_fuel = fuel _obj;
|
||||
_damage = damage _obj;
|
||||
|
||||
diag_log (format ["Log: objectGrabber: %1", [_type, [_dX, _dY, _z], _azimuth, _fuel, _damage]]);
|
||||
};
|
||||
};
|
||||
|
||||
true
|
124
sem/sem_config.sqf
Normal file
124
sem/sem_config.sqf
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
SEM - "Simple Epoch Missions" configuration file
|
||||
By KiloSwiss
|
||||
*/
|
||||
/*
|
||||
Update 27.03.2017
|
||||
By [Ignatz] He-Man
|
||||
*/
|
||||
|
||||
/* Mission start/timer settings */
|
||||
|
||||
SEM_MinPlayerStatic = 1; // Minimum number of online players for basic missions to spawn.
|
||||
SEM_MinPlayerDynamic = 1; // Minimum number of online players for additional/parallel running missions.
|
||||
SEM_MaxPlayers = 40;
|
||||
|
||||
SEM_TimerStart = 5; // Minutes to start first Mission.
|
||||
|
||||
SEM_MissionTimerMin = 10; // Minimum minutes between missions.
|
||||
SEM_MissionTimerMax = 20; // Maximum minutes between missions.
|
||||
|
||||
/* Reward/punish settings */
|
||||
SEM_reward_AIkill = true; // Defines if players get some Krypto as reward for each AI they kill.
|
||||
SEM_punish_AIroadkill = true; // Defines if players should be punished for killing AI units by driving them over with cars.
|
||||
SEM_damage_AIroadkill = true; // Defines if the players car should be damaged when driving over an AI unit.
|
||||
SEM_Krypto_AIroadkill = 20; // How much Krypto will be removed by punishing players for AI roadkills.
|
||||
|
||||
|
||||
/* Advanced mission settings */
|
||||
|
||||
// Minutes after a finished mission where all mission objects (including AI) will be deleted.
|
||||
SEM_MissionCleanup = 10; // 0 or -1 equals never.
|
||||
|
||||
// Allow captured Vehicles do be permanent (saved to Database).
|
||||
SEM_permanentVehicles = false; // true or false
|
||||
|
||||
// Chance of AI dropping their guns and keeping their gear (vests, backpacks and magazines) when killed.
|
||||
SEM_AIdropGearChance = 40; // Values: 0-100% Where 0 means all gear gets removed from dead AI units.
|
||||
|
||||
// Disable Damage over a specific distance so players can't snipe the mission AI from safe distance.
|
||||
SEM_AIdisableSniperDamage = true; // Set to false to allow sniper damage from any distance.
|
||||
SEM_AIsniperDamageDistance = 700; // Max. distance (in meters) where AI takes damage (min. 300 - max. 1000).
|
||||
|
||||
|
||||
/* ################# */ /* ################# */ /* ################# */
|
||||
/* Advanced settings */ /* Advanced settings */ /* Advanced settings */
|
||||
/* ################# */ /* ################# */ /* ################# */
|
||||
|
||||
|
||||
SEM_removeWeaponsFromDeadAI = []; // Weapons that should be removed from killed AI
|
||||
SEM_removeMagazinesFromDeadAI = []; // Magazines that should be removed from killed AI
|
||||
|
||||
//Marker Names where mission spawning is blocked.
|
||||
SEM_blockMarker = [
|
||||
// "respawn_west"
|
||||
];
|
||||
SEM_blockPos = [
|
||||
[6717,19562,25],
|
||||
[19375,17620,25],
|
||||
[13323,14500,25],
|
||||
[9275,10857,25],
|
||||
[19359,9696,25]
|
||||
];
|
||||
|
||||
/* Static Missions */
|
||||
SEM_staticMissionsPath = "sem\missionsStatic\";
|
||||
SEM_staticMissions = [
|
||||
["bSupplyCrash", "Supply Van", 45, 15, 2, false],
|
||||
["bPlaneCrash", "Plane Crashsite", 45, 15, 2, false],
|
||||
["bHeliCrash", "Heli Crashsite", 45, 15, 2, false],
|
||||
["bCamp_big", "Bandit Base", 60, 50, 3, false],
|
||||
["bCamp_small", "Bandit Camp", 70, 50, 3, false],
|
||||
["bDevice", "Strange Device", 45, 15, 2, false],
|
||||
/* example */
|
||||
["file name", "marker name", -1, -1, 5, false] //NO COMMA AT THE LAST LINE!
|
||||
/* 1. 2. 3. 4. 5. 6.
|
||||
|
||||
1. "file name" MUST be equal to the sqf file name!
|
||||
2. "marker name" Name of the mission marker.
|
||||
3. time out, (Number) Minutes until running mission times out (0 or -1 equals no mission time out).
|
||||
4. probability (Number) Percentage of probability how often a mission will spawn: 1 - 100 (0 and -1 equals OFF).
|
||||
5. danger level (Number) Color for the mission marker (0=white, 1=yellow, 2=orange, 3=red, 4=violet, 5=black)
|
||||
6. static/dynamic Use dynamic (true) for convoys and static (false) for stationary missions.
|
||||
*/];
|
||||
|
||||
/* Dynamic Missions */
|
||||
SEM_dynamicMissionsPath = "sem\missionsDynamic\";
|
||||
SEM_dynamicMissions = [
|
||||
["convoySupply", "Supply Convoy", 90, -1, 0, true],
|
||||
["convoyRepair", "Repair Convoy", 90, -1, 1, true],
|
||||
["convoyStrider", "Strider Convoy", 90, -1, 2, true],
|
||||
["convoyWeapon", "Weapon Convoy", 90, -1, 3, true] //NO COMMA AT THE LAST LINE!
|
||||
/* 1. 2. 3. 4. 5. 6.
|
||||
|
||||
1. "file name" MUST be equal to the sqf file name!
|
||||
2. "marker name" Name of the mission marker.
|
||||
3. time out, (Number) Minutes until running mission times out (0 or -1 equals no mission time out).
|
||||
4. probability (Number) Percentage of probability how often a mission will spawn: 1 - 100 (0 and -1 equals OFF).
|
||||
5. danger level (Number) Colour for the mission marker (0=white, 1=yellow, 2=orange, 3=red, 4=violet, 5=black)
|
||||
6. static/dynamic Use dynamic (true) for convoys and static (false) for stationary missions.
|
||||
*/
|
||||
];
|
||||
|
||||
|
||||
SEM_debug = "off"; // Valid values: "off", "log" and "full" or 0, 1 and 2.
|
||||
/*Debug settings explained:
|
||||
|
||||
0 or "off" = Debug is off
|
||||
- This is the default setting.
|
||||
|
||||
1 or "log" = Only additional logging is active.
|
||||
- For debugging and proper error reports, please activate this!
|
||||
- Any RPT submitted for bug reports with debug off will be ignored!
|
||||
|
||||
2 or "full" = Many settings are changed + additional logging is active.
|
||||
- Missions time out after 10min.
|
||||
- Minimum players is set to 0 (for both static and dynamic missions).
|
||||
- Time between missions is 30sec.
|
||||
- Mission clean up happens after 2min.
|
||||
- AI only takes damage from below 100m.
|
||||
- More events and additional data is logged to the .rpt.
|
||||
*/
|
||||
|
||||
/* DO NOT EDIT BELOW THIS LINE */
|
||||
/**/SEM_config_loaded = true;/**/
|
Loading…
Reference in New Issue
Block a user