Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbolani77 committed Jul 29, 2018
1 parent 872b13f commit e0ad65d
Show file tree
Hide file tree
Showing 20 changed files with 206 additions and 118 deletions.
14 changes: 11 additions & 3 deletions A3-Antistasi/AI/attackDrillAI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ if (count _mgs == 1) then
_grupo setVariable ["movable",_movable];
_grupo setVariable ["baseOfFire",_baseOfFire];
_grupo setVariable ["flankers",_flankers];

if (side _grupo == buenos) then {_grupo setVariable ["autoRearmed",time + 300]};
while {true} do
{
if (({alive _x} count (_grupo setVariable ["movable",[]]) == 0) or (isNull _grupo)) exitWith {};
if (({alive _x} count (_grupo getVariable ["movable",[]]) == 0) or (isNull _grupo)) exitWith {};

_objetivos = _grupo call enemyList;
_grupo setVariable ["objetivos",_objetivos];
Expand Down Expand Up @@ -286,7 +286,15 @@ while {true} do
if (_grupo getVariable ["tarea","Patrol"] == "Hide") then {_grupo call recallGroup};
_grupo setVariable ["tarea","Patrol"];
};
if (side _grupo == buenos) then
{
if (time >= _grupo getVariable ["autoRearm",time]) then
{
_grupo setVariable ["autoRearm",time + 120];
{[_x] spawn autoRearm; sleep 1} forEach ((_grupo getVariable ["movable",[]]) select {[_x] call canFight and !(_x getVariable ["maniobrando",false])});
};
};
};

diag_log format ["Tarea:%1.Movable:%2.Base:%3.Flankers:%4",_grupo getVariable "tarea",_grupo getVariable "movable",_grupo getVariable "baseOfFire",_grupo getVariable "flankers"];
sleep 30;
};
108 changes: 26 additions & 82 deletions A3-Antistasi/AI/autoRearm.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ private ["_unit","_Pweapon","_Sweapon","_cuenta","_magazines","_hayCaja","_dista

_unit = _this select 0;

if ((isPlayer _unit) or (player != leader group player)) exitWith {};
if (isPlayer _unit) exitWith {};
if !([_unit] call canFight) exitWith {};
_inPlayerGroup = (isPlayer (leader _unit));
//_ayudando = _unit getVariable "ayudando";
if (_unit getVariable ["ayudando",false]) exitWith {_unit groupChat "I cannot rearm right now. I'm healing a comrade"};
if (_unit getVariable ["ayudando",false]) exitWith {if (_inPlayerGroup) then {_unit groupChat "I cannot rearm right now. I'm healing a comrade"}};
_rearming = _unit getVariable ["rearming",false];
if (_rearming) exitWith {_unit groupChat "I am currently rearming. Cancelling."; _unit setVariable ["rearming",false]};

if (_rearming) exitWith {if (_inPlayerGroup) then {_unit groupChat "I am currently rearming. Cancelling."; _unit setVariable ["rearming",false]}};
if (vehicle _unit != _unit) exitWith {};
_unit setVariable ["rearming",true];

_Pweapon = primaryWeapon _unit;
Expand Down Expand Up @@ -57,7 +58,7 @@ if ((_Pweapon in initialRifles) or (_Pweapon == "")) then
_unit stop false;
if ((!alive _target) or (not(_target isKindOf "ReammoBox_F"))) then {_target setVariable ["busy",true]};
_unit doMove (getPosATL _target);
_unit groupChat "Picking a better weapon";
if (_inPlayerGroup) then {_unit groupChat "Picking a better weapon"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if ((unitReady _unit) and ([_unit] call canFight) and (_unit distance _target > 3) and (_target isKindOf "ReammoBox_F") and (!isNull _target)) then {_unit setPos position _target};
Expand All @@ -67,20 +68,11 @@ if ((_Pweapon in initialRifles) or (_Pweapon == "")) then
sleep 5;
if (primaryWeapon _unit == _arma) then
{
_unit groupChat "I have a better weapon now";
if (_inPlayerGroup) then {_unit groupChat "I have a better weapon now"};
if (_target isKindOf "ReammoBox_F") then {_unit action ["rearm",_target]};
}
else
{
_unit groupChat "Couldn't take this weapon";
};
}
else
{
_unit groupChat "Cannot take a better weapon";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
_distancia = 51;
_Pweapon = primaryWeapon _unit;
Expand Down Expand Up @@ -125,7 +117,7 @@ if ((_hayCaja) and (_unit getVariable "rearming")) then
_unit stop false;
if ((!alive _target) or (not(_target isKindOf "ReammoBox_F"))) then {_target setVariable ["busy",true]};
_unit doMove (getPosATL _target);
_unit groupChat "Rearming";
if (_inPlayerGroup) then {_unit groupChat "Rearming"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if ((unitReady _unit) and ([_unit] call canFight) and (_unit distance _target > 3) and (_target isKindOf "ReammoBox_F") and (!isNull _target)) then {_unit setPos position _target};
Expand All @@ -134,23 +126,18 @@ if ((_hayCaja) and (_unit getVariable "rearming")) then
_unit action ["rearm",_target];
if ({_x in _magazines} count (magazines _unit) >= _cuenta) then
{
_unit groupChat "Rearmed";
if (_inPlayerGroup) then {_unit groupChat "Rearmed"};
}
else
{
_unit groupChat "Partially Rearmed";
if (_inPlayerGroup) then {_unit groupChat "Partially Rearmed"};
};
}
else
{
_unit groupChat "Cannot rearm";
};
_target setVariable ["busy",false];
_unit doFollow player;
}
else
{
_unit groupChat "No source to rearm my primary weapon";
if (_inPlayerGroup) then {_unit groupChat "No source to rearm my primary weapon"};
};
_hayCaja = false;
if ((_Sweapon == "") and (loadAbs _unit < 340)) then
Expand Down Expand Up @@ -184,7 +171,7 @@ if ((_Sweapon == "") and (loadAbs _unit < 340)) then
_unit stop false;
if ((!alive _target) or (not(_target isKindOf "ReammoBox_F"))) then {_target setVariable ["busy",true]};
_unit doMove (getPosATL _target);
_unit groupChat "Picking a secondary weapon";
if (_inPlayerGroup) then {_unit groupChat "Picking a secondary weapon"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if ((unitReady _unit) and ([_unit] call canFight) and (_unit distance _target > 3) and (_target isKindOf "ReammoBox_F") and (!isNull _target)) then {_unit setPos position _target};
Expand All @@ -194,20 +181,11 @@ if ((_Sweapon == "") and (loadAbs _unit < 340)) then
sleep 3;
if (secondaryWeapon _unit == _arma) then
{
_unit groupChat "I have a secondary weapon now";
if (_inPlayerGroup) then {_unit groupChat "I have a secondary weapon now"};
if (_target isKindOf "ReammoBox_F") then {sleep 3;_unit action ["rearm",_target]};
}
else
{
_unit groupChat "Couldn't take this weapon";
};
}
else
{
_unit groupChat "Cannot take a secondary weapon";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
_Sweapon = secondaryWeapon _unit;
_distancia = 51;
Expand Down Expand Up @@ -253,7 +231,7 @@ if (_Sweapon != "") then
_unit stop false;
if (!alive _target) then {_target setVariable ["busy",true]};
_unit doMove (position _target);
_unit groupChat "Rearming";
if (_inPlayerGroup) then {_unit groupChat "Rearming"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if ((unitReady _unit) and ([_unit] call canFight) and (_unit distance _target > 3) and (_target isKindOf "ReammoBox_F") and (!isNull _target)) then {_unit setPos position _target};
Expand All @@ -274,22 +252,18 @@ if (_Sweapon != "") then

if ({_x in _magazines} count (magazines _unit) >= 2) then
{
_unit groupChat "Rearmed";
if (_inPlayerGroup) then {_unit groupChat "Rearmed"};
}
else
{
_unit groupChat "Partially Rearmed";
if (_inPlayerGroup) then {_unit groupChat "Partially Rearmed"};
};
}
else
{
_unit groupChat "Cannot rearm";
};
_target setVariable ["busy",false];
}
else
{
_unit groupChat "No source to rearm my secondary weapon.";
if (_inPlayerGroup) then {_unit groupChat "No source to rearm my secondary weapon"};
};
sleep 3;
};
Expand All @@ -314,21 +288,16 @@ if ((not("ItemRadio" in assignedItems _unit)) and !haveRadio) then
_unit stop false;
_target setVariable ["busy",true];
_unit doMove (getPosATL _target);
_unit groupChat "Picking a Radio";
if (_inPlayerGroup) then {_unit groupChat "Picking a Radio"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
{
_unit action ["rearm",_target];
_unit linkItem "ItemRadio";
_target unlinkItem "ItemRadio";
}
else
{
_unit groupChat "Cannot pick the Radio";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
};
_hayCaja = false;
Expand All @@ -354,21 +323,16 @@ if (hmd _unit == "") then
_target setVariable ["busy",true];
_hmd = hmd _target;
_unit doMove (getPosATL _target);
_unit groupChat "Picking NV Googles";
if (_inPlayerGroup) then {_unit groupChat "Picking NV Googles"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
{
_unit action ["rearm",_target];
_unit linkItem _hmd;
_target unlinkItem _hmd;
}
else
{
_unit groupChat "Cannot pick those NV Googles";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
};
_hayCaja = false;
Expand All @@ -393,21 +357,16 @@ if (not(headgear _unit in cascos)) then
_target setVariable ["busy",true];
_casco = headgear _target;
_unit doMove (getPosATL _target);
_unit groupChat "Picking a Helmet";
if (_inPlayerGroup) then {_unit groupChat "Picking a Helmet"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
{
_unit action ["rearm",_target];
_unit addHeadgear _casco;
removeHeadgear _target;
}
else
{
_unit groupChat "Cannot pick this Helmet";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
};
_hayCaja = false;
Expand All @@ -433,7 +392,7 @@ if ({_x == "FirstAidKit"} count (items _unit) < _minFA) then
_unit stop false;
_target setVariable ["busy",true];
_unit doMove (getPosATL _target);
_unit groupChat "Picking a First Aid Kit";
if (_inPlayerGroup) then {_unit groupChat "Picking a First Aid Kit"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
Expand All @@ -444,14 +403,9 @@ if ({_x == "FirstAidKit"} count (items _unit) < _minFA) then
_unit addItem "FirstAidKit";
_target removeItem "FirstAidKit";
if ("FirstAidKit" in items _muerto) then {sleep 3};
}
}
else
{
_unit groupChat "Cannot pick this Kit";
};
};
_target setVariable ["busy",false];
_unit doFollow player;
};
};
_hayCaja = false;
Expand All @@ -472,7 +426,7 @@ if ((_hayCaja) and (_unit getVariable "rearming")) then
_unit stop false;
_target setVariable ["busy",true];
_unit doMove (getPosATL _target);
_unit groupChat "Picking a a better vest";
if (_inPlayerGroup) then {_unit groupChat "Picking a a better vest"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
Expand All @@ -489,13 +443,8 @@ if ((_hayCaja) and (_unit getVariable "rearming")) then
{_cosa addItemCargoGlobal [_x,1]} forEach (vestItems _target);
};
removeVest _target;
}
else
{
_unit groupChat "Cannot pick this vest";
};
_target setVariable ["busy",false];
_unit doFollow player;
};

if (backpack _unit == "") then
Expand All @@ -518,7 +467,7 @@ if (backpack _unit == "") then
_unit stop false;
_target setVariable ["busy",true];
_unit doMove (getPosATL _target);
_unit groupChat "Picking a Backpack";
if (_inPlayerGroup) then {_unit groupChat "Picking a Backpack"};
_timeOut = time + 60;
waitUntil {sleep 1; !([_unit] call canFight) or (isNull _target) or (_unit distance _target < 3) or (_timeOut < time) or (unitReady _unit)};
if (_unit distance _target < 3) then
Expand All @@ -533,15 +482,10 @@ if (backpack _unit == "") then
{_cosa addItemCargoGlobal [_x,1]} forEach (backpackItems _target);
};
removeBackpackGlobal _target;
}
else
{
_unit groupChat "Cannot pick this Pack";
};
_target setVariable ["busy",false];
_unit doFollow player;
};
};

if (!_necesita) then {_unit groupChat "No need to rearm"} else {_unit groupChat "Rearming Done"};
_unit doFollow (leader _unit);
if (!_necesita) then {if (_inPlayerGroup) then {_unit groupChat "No need to rearm"}} else {if (_inPlayerGroup) then {_unit groupChat "Rearming Done"}};
_unit setVariable ["rearming",false];
4 changes: 2 additions & 2 deletions A3-Antistasi/CREATE/wavedCA.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ _nombreorig = [_mrkOrigen] call localizar;
_lado = lados getVariable [_mrkOrigen,sideUnknown];
_ladosTsk = [buenos,civilian,muyMalos];
_ladosTsk1 = [malos];
_nombreEny = "NATO";
_nombreEny = nameMalos;
//_config = cfgNATOInf;
if (_lado == muyMalos) then
{
_nombreEny = "CSAT";
_nombreEny = nameMuyMalos;
//_config = cfgCSATInf;
_ladosTsk = [buenos,civilian,malos];
_ladosTsk1 = [muyMalos];
Expand Down
5 changes: 3 additions & 2 deletions A3-Antistasi/Missions/LOG_Suministros.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ _taskDescription = format ["%1 population is in need of supplies. We may improve

[[buenos,civilian],"LOG",[_taskDescription,"City Supplies",_marcador],_posicion,false,0,true,"Heal",true] call BIS_fnc_taskCreate;
misiones pushBack ["LOG","CREATED"]; publicVariable "misiones";
_pos = [];
_pos = (getMarkerPos respawnBuenos) findEmptyPosition [1,50,"C_Van_01_box_F"];
/*_pos = [];
if (!_dificil) then
{
Expand All @@ -98,7 +99,7 @@ else
};
_pos = [_posroad, 3, _dirveh + 90] call BIS_Fnc_relPos;
};

*/
//Creating the box
_camion = "Land_PaperBox_01_open_boxes_F" createVehicle _pos;
_camion allowDamage false;
Expand Down
20 changes: 14 additions & 6 deletions A3-Antistasi/REINF/NATOQuadbike.sqf
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
_marcador = [marcadores,player] call BIS_fnc_nearestPosition;

_lado = side player;
_nombre = if (_lado == malos) then {nameMalos} else {nameMuyMalos};

if (((_lado == malos) and (not(lados getVariable [_marcador,sideUnknown] == malos))) or ((_lado == muyMalos) and (not(lados getVariable [_marcador,sideUnknown] == muyMalos)))) exitWith {hint "You need to be close to an Airbase, Seaport or Outpost of your side in order to request a bike"};
if ((!(_marcador in aeropuertos)) and (!(_marcador in puertos)) and (!(_marcador in puestos))) exitWith {hint "You need to be close to an Airbase, Seaport or Outpost of your side in order to request a bike"};
if (not(player inArea _marcador)) exitWith {hint "You need to be close to an Airbase, Seaport or Outpost in order to request a bike"};
if (lados getVariable [_marcador,sideUnknown] != _lado) exitWith {hint format ["You need to be close to a zone belonging to %1 in order to request a vehicle",_nombre]};
if ((!(_marcador in aeropuertos)) and (!(_marcador in puertos)) and (!(_marcador in puestos))) exitWith {hint "You need to be close to an Airbase, Seaport or Outpost of your side in order to request a vehicle"};
if (not(player inArea _marcador)) exitWith {hint "You need to be close to an Airbase, Seaport or Outpost in order to request a vehicle"};

_tipoBike = if (_lado == malos) then {vehNATOBike} else {vehCSATBike};
_tipoBike = if (_lado == malos) then {selectRandom vehNATOLightUnarmed} else {selectRandom vehCSATLightUnarmed};

if (!isNull moto) then
{
if (moto distance player < 100) then {deleteVehicle moto};
};

hint "Quadbike available";
moto = createVehicle [_tipoBike, position player, [], 10, "NONE"];
hint "Vehicle available";
_pos = [];
_radius = 10;
while {_pos isEqualTo []} do
{
_pos = (position player) findEmptyPosition [5,_radius,"I_Truck_02_covered_F"];
_radius = _radius + 10;
};
moto = createVehicle [_tipoBike,_pos, [], 10, "NONE"];

[moto] call AIVEHinit;
Loading

0 comments on commit e0ad65d

Please sign in to comment.