diff --git a/A3-Antistasi/AI/Buildings/isInRoof.sqf b/A3-Antistasi/AI/Buildings/isInRoof.sqf new file mode 100644 index 0000000000..3d0815d31e --- /dev/null +++ b/A3-Antistasi/AI/Buildings/isInRoof.sqf @@ -0,0 +1,24 @@ +/**************************************************************** +File: UPSMON_Inbuilding.sqf +Author: Azroul13 + +Description: + Check if the AI is in a roof. + +Parameter(s): + <--- Unit +Returns: + boolean +****************************************************************/ + +private ["_onRoof","_Roof","_pos","_Down"]; +_pos = ATLToASL (_this select 0);//recuerda que tiene que ser posicion ATL +//if ((_pos select 2) == 0) then {_pos = ATLtoASL _pos}; +_onRoof = true; +_Roof = lineIntersectsWith [_pos, [(_pos select 0), (_pos select 1), (_pos select 2) + 20]]; +If (count _Roof > 0) then +{ + _onRoof = !((_Roof select 0) isKindOf "BUILDING"); +}; + +_onRoof \ No newline at end of file diff --git a/A3-Antistasi/AI/Buildings/isWindowPosition.sqf b/A3-Antistasi/AI/Buildings/isWindowPosition.sqf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/A3-Antistasi/AI/defendDrillAI.sqf b/A3-Antistasi/AI/defendDrillAI.sqf new file mode 100644 index 0000000000..6c10614529 --- /dev/null +++ b/A3-Antistasi/AI/defendDrillAI.sqf @@ -0,0 +1,318 @@ +private _grupo = _this select 0; +private _marcador = _this select 1; +private _modo = _this select 2; +_objetivos = _grupo call enemyList; +_grupo setVariable ["objetivos",_objetivos]; +private _size = [_marcador] call sizeMarker; +if (_modo != "FORTIFY") then {_grupo setVariable ["tarea","PatrolSoft"]} else {_grupo setVariable ["tarea","FORTIFY"]}; +private _lado = side _grupo; +private _friendlies = if (_lado == malos) then {[malos,civilian]} else {[_lado]}; +private _morteros = []; +private _mgs = []; +private _movable = [leader _grupo]; +private _baseOfFire = [leader _grupo]; + +{ +if (alive _x) then + { + _result = _x call typeOfSoldier; + _x setVariable ["maniobrando",false]; + if (_result == "Normal") then + { + _movable pushBack _x; + } + else + { + if (_result == "StaticMortar") then + { + _morteros pushBack _x; + } + else + { + if (_result == "StaticGunner") then + { + _mgs pushBack _x; + }; + _movable pushBack _x; + _baseOfFire pushBack _x; + }; + }; + }; +} forEach (units _grupo); + +if (count _morteros == 1) then + { + _morteros append ((units _grupo) select {_x getVariable ["typeOfSoldier",""] == "StaticBase"}); + if (count _morteros > 1) then + { + //_morteros spawn mortarDrill; + _morteros spawn staticMGDrill;//no olvides borrar la otra funciĆ³n si esto funciona + } + else + { + _movable pushBack (_morteros select 0); + }; + }; +if (count _mgs == 1) then + { + _mgs append ((units _grupo) select {_x getVariable ["typeOfSoldier",""] == "StaticBase"}); + if (count _mgs == 2) then + { + _mgs spawn staticMGDrill; + } + else + { + _movable pushBack (_mgs select 0); + }; + }; + +_grupo setVariable ["movable",_movable]; +_grupo setVariable ["baseOfFire",_baseOfFire]; +if (side _grupo == buenos) then {_grupo setVariable ["autoRearmed",time + 300]}; +_edificios = nearestTerrainObjects [getMarkerPos _marcador, ["House"],true]; +_edificios = _edificios select {((_x buildingPos -1) isEqualTo []) and !((typeof _bld) in UPSMON_Bld_remove) and (_x inAera _marcador)}; + +if (_modo == "FORTIFY") then + { + _edificios = _edificios call BIS_fnc_arrayShuffle; + _bldPos = []; + _cuenta = count _movable; + _exit = false; + { + _edificio = _x; + if (_exit) exitWith {}; + { + if ([_x] call isOnRoof) then + { + _bldPos pushBack _x; + if (count _bldPos == _cuenta) then {_exit = true}; + }; + } forEach (_edificio buildingPos -1); + } forEach _edificios; + }; +while {true} do + { + if (({alive _x} count (_grupo getVariable ["movable",[]]) == 0) or (isNull _grupo)) exitWith {}; + + _objetivos = _grupo call enemyList; + _grupo setVariable ["objetivos",_objetivos]; + if !(_objetivos isEqualTo []) then + { + _aire = objNull; + _tanques = objNull; + { + _eny = assignedVehicle (_x select 4); + if (_eny isKindOf "Tank") then + { + _tanques = _eny; + } + else + { + if (_eny isKindOf "Air") then + { + if (count (weapons _eny) > 1) then + { + _aire = _eny; + }; + }; + }; + if (!(isNull _aire) and !(isNull _tanques)) exitWith {}; + } forEach _objetivos; + _lider = leader _grupo; + _allNearFriends = allUnits select {(_x distance _lider < (distanciaSPWN/2)) and (side _x in _friendlies) and ([_x] call canFight)}; + { + _unit = _x; + { + _objetivo = _x select 4; + if (_lider knowsAbout _objetivo >= 1.4) then + { + _know = _unit knowsAbout _objetivo; + if (_know < 1.2) then {_unit reveal [_objetivo,(_know + 0.2)]}; + }; + } forEach _objetivos; + } forEach (_allNearFriends select {_x == leader _x}) - [_lider]; + _numNearFriends = count _allNearFriends; + _aire = objNull; + _tanques = objNull; + _numObjetivos = count _objetivos; + _tarea = _grupo getVariable ["tarea","Patrol"]; + _cercano = _grupo call enemigoCercano; + _soldados = ((units _grupo) select {[_x] call canFight}) - [_grupo getVariable ["mortero",objNull]]; + _numSoldados = count _soldados; + if !(isNull _aire) then + { + if ({(_x call typeOfSoldier == "AAMan") or (_x call typeOfSoldier == "StaticGunner")} count _allNearFriends == 0) then + { + if (_lado != buenos) then {[[getPosASL _lider,_lado,"Air",false],"patrolCA"] remoteExec ["scheduler",2]}; + }; + //_nuevaTarea = ["Hide",_soldados - (_soldados select {(_x call typeOfSoldier == "AAMan") or (_x getVariable ["typeOfSoldier",""] == "StaticGunner")})]; + _grupo setVariable ["tarea","Hide"]; + _tarea = "Hide"; + }; + if !(isNull _tanques) then + { + if ({_x call typeOfSoldier == "ATMan"} count _allFriendlies == 0) then + { + _mortero = _grupo getVariable ["morteros",objNull]; + if (!(isNull _mortero) and ([_mortero] call canFight)) then + { + if ({if (_x distance _tanques < 100) exitWith {1}} count _allNearFriends == 0) then {[_mortero,getPosASL _tanques,4] spawn mortarSupport}; + } + else + { + if (_lado != buenos) then {[[getPosASL _lider,_lado,"Tank",false],"patrolCA"] remoteExec ["scheduler",2]}; + }; + }; + //_nuevaTarea = ["Hide",_soldados - (_soldados select {(_x getVariable ["typeOfSoldier",""] == "ATMan")})]; + _grupo setVariable ["tarea","Hide"]; + _tarea = "Hide"; + }; + if (_numObjetivos > 2*_numNearFriends) then + { + if !(isNull _cercano) then + { + if (_lado != buenos) then {[[getPosASL _lider,_lado,"Normal",false],"patrolCA"] remoteExec ["scheduler",2]}; + _mortero = _grupo getVariable ["morteros",objNull]; + if (!(isNull _mortero) and ([_mortero] call canFight)) then + { + if ({if (_x distance _cercano < 100) exitWith {1}} count _allNearFriends == 0) then {[_mortero,getPosASL _cercano,1] spawn mortarSupport}; + }; + }; + _grupo setVariable ["tarea","Hide"]; + _tarea = "Hide"; + }; + + + if (_tarea == "Patrol") then + { + if ((_cercano distance _lider < 150) and !(isNull _cercano)) then + { + _grupo setVariable ["tarea","Assault"]; + _tarea = "Assault"; + } + else + { + if (_numObjetivos > 1) then + { + _mortero = _grupo getVariable ["morteros",objNull]; + if (!(isNull _mortero) and ([_mortero] call canFight)) then + { + if ({if (_x distance _cercano < 100) exitWith {1}} count _allNearFriends == 0) then {[_mortero,getPosASL _cercano,1] spawn mortarSupport}; + }; + }; + }; + }; + + if (_tarea == "Assault") then + { + if (_cercano distance _lider < 50) then + { + _grupo setVariable ["tarea","AssaultClose"]; + _tarea = "AssaultClose"; + } + else + { + if (_cercano distance _lider > 150) then + { + _grupo setVariable ["tarea","Patrol"]; + } + else + { + if !(isNull _cercano) then + { + { + [_x,_cercano] call fuegoSupresor; + } forEach ((_grupo getVariable ["baseOfFire",[]]) select {([_x] call canFight) and ((_x getVariable ["typeOfSoldier",""] == "MGMan") or (_x getVariable ["typeOfSoldier",""] == "StaticGunner"))}); + _mortero = _grupo getVariable ["morteros",objNull]; + if (!(isNull _mortero) and ([_mortero] call canFight)) then + { + if ({if (_x distance _cercano < 100) exitWith {1}} count _allNearFriends == 0) then {[_mortero,getPosASL _cercano,1] spawn mortarSupport}; + }; + }; + }; + }; + }; + + if (_tarea == "AssaultClose") then + { + if (_cercano distance _lider > 150) then + { + _grupo setVariable ["tarea","Patrol"]; + } + else + { + if (_cercano distance _lider > 50) then + { + _grupo setVariable ["tarea","Assault"]; + } + else + { + if !(isNull _cercano) then + { + _flankers = (_grupo getVariable ["flankers",[]]) select {([_x] call canFight) and !(_x getVariable ["maniobrando",false])}; + if (count _flankers != 0) then + { + { + [_x,_x,_cercano] spawn cubrirConHumo; + } forEach ((_grupo getVariable ["baseOfFire",[]]) select {([_x] call canFight) and (_x getVariable ["typeOfSoldier",""] == "Normal")}); + if ([getPosASL _cercano] call isBuildingPosition) then + { + _ingeniero = objNull; + _building = nearestBuilding _cercano; + if !(_building getVariable ["asaltado",false]) then + { + { + if ((_x call typeOfSoldier == "Engineer") and {_x != leader _x} and {!(_x getVariable ["maniobrando",true])} and {_x distance _cercano < 50} and {[_x] call canFight}) exitWith {_ingeniero = _x}; + } forEach (_grupo getVariable ["baseOfFire",[]]); + if !(isNull _ingeniero) then + { + [_ingeniero,_cercano,_building] spawn destroyBuilding; + } + else + { + [[_flankers,_cercano] call BIS_fnc_nearestPosition,_cercano,_building] spawn assaultBuilding; + }; + }; + } + else + { + [_flankers,_cercano] spawn doFlank; + }; + }; + }; + }; + }; + }; + + if (_tarea == "Hide") then + { + if ((isNull _tanques) and {isNull _aire} and {_numObjetivos <= 2*_numNearFriends}) then + { + _grupo setVariable ["tarea","Patrol"]; + } + else + { + _movable = (_grupo getVariable ["movable",[]]) select {[_x] call canFight and !(_x getVariable ["maniobrando",false])}; + _movable spawn hideInBuilding; + }; + }; + } + else + { + if (_grupo getVariable ["tarea","Patrol"] != "Patrol") then + { + 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; + }; diff --git a/A3-Antistasi/AI/hideInBuilding.sqf b/A3-Antistasi/AI/hideInBuilding.sqf index 92c46c2701..13d45817fa 100644 --- a/A3-Antistasi/AI/hideInBuilding.sqf +++ b/A3-Antistasi/AI/hideInBuilding.sqf @@ -30,7 +30,6 @@ _x disableAI "SUPPRESSION"; _x disableAI "CHECKVISIBLE"; _x disableAI "COVER"; _x disableAI "AUTOCOMBAT"; -doStop _ingeniero; _x doMove _pos; [_x,_pos] spawn { diff --git a/A3-Antistasi/CREATE/AAFroadPatrol.sqf b/A3-Antistasi/CREATE/AAFroadPatrol.sqf index d78209d262..59209b7470 100644 --- a/A3-Antistasi/CREATE/AAFroadPatrol.sqf +++ b/A3-Antistasi/CREATE/AAFroadPatrol.sqf @@ -32,7 +32,7 @@ _lado = malos; _tipoPatrol = "LAND"; if (lados getVariable [_base,sideUnknown] == malos) then { - if (_base in puertos) then + if ((_base in puertos) and ([vehNATOBoat] call vehAvailable)) then { _tipoCoche = vehNATOBoat; _tipoPatrol = "SEA"; @@ -53,7 +53,7 @@ if (lados getVariable [_base,sideUnknown] == malos) then else { _lado = muyMalos; - if (_base in puertos) then + if ((_base in puertos) and ([vehCSATBoat] call vehAvailable)) then { _tipoCoche = vehCSATBoat; _tipoPatrol = "SEA"; diff --git a/A3-Antistasi/CREATE/createAIpuestos.sqf b/A3-Antistasi/CREATE/createAIpuestos.sqf index 57407a47df..96b1d191ad 100644 --- a/A3-Antistasi/CREATE/createAIpuestos.sqf +++ b/A3-Antistasi/CREATE/createAIpuestos.sqf @@ -135,20 +135,23 @@ _roads = _posicion nearRoads _size; if ((_marcador in puertos) and (spawner getVariable _marcador!=2)) then { - _mrkMar = seaSpawn select {getMarkerPos _x inArea _marcador}; _tipoVeh = if (_lado == malos) then {vehNATOBoat} else {vehCSATBoat}; - _pos = (getMarkerPos (_mrkMar select 0)) findEmptyPosition [0,20,_tipoVeh]; - _vehicle=[_pos, 0,_tipoVeh, _lado] call bis_fnc_spawnvehicle; - _veh = _vehicle select 0; - [_veh] call AIVEHinit; - _vehCrew = _vehicle select 1; - {[_x,_marcador] call NATOinit} forEach _vehCrew; - _grupoVeh = _vehicle select 2; - _soldados = _soldados + _vehCrew; - _grupos pushBack _grupoVeh; - _vehiculos pushBack _veh; + if ([_tipoVeh] call vehAvailable) then + { + _mrkMar = seaSpawn select {getMarkerPos _x inArea _marcador}; + _pos = (getMarkerPos (_mrkMar select 0)) findEmptyPosition [0,20,_tipoVeh]; + _vehicle=[_pos, 0,_tipoVeh, _lado] call bis_fnc_spawnvehicle; + _veh = _vehicle select 0; + [_veh] call AIVEHinit; + _vehCrew = _vehicle select 1; + {[_x,_marcador] call NATOinit} forEach _vehCrew; + _grupoVeh = _vehicle select 2; + _soldados = _soldados + _vehCrew; + _grupos pushBack _grupoVeh; + _vehiculos pushBack _veh; + sleep 1; + }; {_caja addItemCargoGlobal [_x,2]} forEach swoopShutUp; - sleep 1; } else { diff --git a/A3-Antistasi/REINF/dismissPlayerGroup.sqf b/A3-Antistasi/REINF/dismissPlayerGroup.sqf index 4541579bdc..fa23bf48e1 100644 --- a/A3-Antistasi/REINF/dismissPlayerGroup.sqf +++ b/A3-Antistasi/REINF/dismissPlayerGroup.sqf @@ -8,7 +8,7 @@ _units = _this select 0; _units = _units - [player]; _units = _units select {!(isPlayer _x)}; if (_units isEqualTo []) exitWith {}; -if (_units findIf {[_x] call canFight} != -1) exitWith {hint "You cannot disband supressed, undercover or unconscious units"}; +if (_units findIf {!([_x] call canFight)} != -1) exitWith {hint "You cannot disband supressed, undercover or unconscious units"}; player globalChat "Get out of my sight you useless scum!"; _nuevoGrp = createGroup buenos; diff --git a/A3-Antistasi/Templates/A3-AA-BLUFORTemplate.Altis/mission.sqm b/A3-Antistasi/Templates/A3-AA-BLUFORTemplate.Altis/mission.sqm index 2c95ce1354..2f2427f77a 100644 --- a/A3-Antistasi/Templates/A3-AA-BLUFORTemplate.Altis/mission.sqm +++ b/A3-Antistasi/Templates/A3-AA-BLUFORTemplate.Altis/mission.sqm @@ -8,7 +8,7 @@ class EditorData toggles=1538; class ItemIDProvider { - nextID=1638; + nextID=1640; }; class MarkerIDProvider { @@ -20,10 +20,10 @@ class EditorData }; class Camera { - pos[]={8420.4658,154.61513,25053.641}; - dir[]={0.07429193,-0.59449989,0.80066264}; - up[]={0.054926567,0.80409461,0.59195727}; - aside[]={0.99572641,6.8401278e-008,-0.092391409}; + pos[]={3605.9678,40.043858,10231.861}; + dir[]={0.057827864,-0.43886495,0.89669102}; + up[]={0.028243909,0.89855289,0.43795595}; + aside[]={0.99792749,7.4942363e-010,-0.064356647}; }; }; binarizationWanted=0; @@ -435,7 +435,7 @@ class Mission class Item20 { dataType="Marker"; - position[]={3634.429,-185.97,4856.5918}; + position[]={11722.869,-186.03819,4256.5566}; name="NATO_carrier"; type="flag_AltisColonial"; id=23; @@ -3340,7 +3340,7 @@ class Mission position[]={8780.8975,35.592316,12043.754}; name="road_1"; type="hd_arrow"; - angle=223.508; + angle=223.50798; id=1441; }; class Item244 @@ -6927,6 +6927,7 @@ class Mission }; id=1573; type="O_T_Recon_TL_F"; + atlOffset=-7.6293945e-006; class CustomAttributes { class Attribute0 @@ -7071,6 +7072,7 @@ class Mission }; id=1579; type="O_T_Recon_JTAC_F"; + atlOffset=7.6293945e-006; }; class Item7 { @@ -7094,6 +7096,7 @@ class Mission { }; id=1572; + atlOffset=-7.6293945e-006; }; class Item326 { diff --git a/A3-Antistasi/Templates/A3-AATemplate.Altis/mission.sqm b/A3-Antistasi/Templates/A3-AATemplate.Altis/mission.sqm index bb284a7a1c..4c44817855 100644 --- a/A3-Antistasi/Templates/A3-AATemplate.Altis/mission.sqm +++ b/A3-Antistasi/Templates/A3-AATemplate.Altis/mission.sqm @@ -8,7 +8,7 @@ class EditorData toggles=1538; class ItemIDProvider { - nextID=1541; + nextID=1542; }; class MarkerIDProvider { @@ -443,10 +443,11 @@ class Mission class Item20 { dataType="Marker"; - position[]={3634.429,-185.97,4856.5918}; + position[]={12538.913,-185.97,4160.5513}; name="NATO_carrier"; type="flag_UN"; id=23; + atlOffset=-13.617798; }; class Item21 { @@ -6457,6 +6458,7 @@ class Mission }; id=1425; type="I_G_officer_F"; + atlOffset=-9.5367432e-007; class CustomAttributes { class Attribute0 @@ -6505,6 +6507,7 @@ class Mission { }; id=1424; + atlOffset=-9.5367432e-007; }; class Item280 { @@ -6896,6 +6899,7 @@ class Mission }; id=1437; type="I_G_officer_F"; + atlOffset=9.5367432e-007; class CustomAttributes { class Attribute0 @@ -6944,6 +6948,7 @@ class Mission { }; id=1436; + atlOffset=9.5367432e-007; }; class Item286 { @@ -7033,7 +7038,7 @@ class Mission position[]={8780.8975,35.592316,12043.754}; name="road_1"; type="hd_arrow"; - angle=223.50813; + angle=223.50812; id=1441; }; class Item289 @@ -7271,7 +7276,7 @@ class Mission position[]={21706.1,22.576994,17678.889}; name="road_27"; type="hd_arrow"; - angle=213.26996; + angle=213.26994; id=1470; }; class Item315 @@ -7379,7 +7384,7 @@ class Mission position[]={26280.432,40.25845,21788.68}; name="road_39"; type="hd_arrow"; - angle=52.545021; + angle=52.545017; id=1482; }; class Item327 @@ -7388,7 +7393,7 @@ class Mission position[]={26493.066,20.179955,21324.83}; name="road_40"; type="hd_arrow"; - angle=113.11628; + angle=113.11627; id=1483; }; class Item328 @@ -7442,6 +7447,7 @@ class Mission }; id=1488; type="O_T_Recon_TL_F"; + atlOffset=7.6293945e-006; class CustomAttributes { class Attribute0 @@ -7501,6 +7507,7 @@ class Mission }; id=1489; type="O_T_Recon_Medic_F"; + atlOffset=-7.6293945e-006; }; class Item2 { @@ -7609,6 +7616,7 @@ class Mission { }; id=1487; + atlOffset=7.6293945e-006; }; class Item332 { @@ -8529,6 +8537,7 @@ class Mission }; id=1522; type="I_G_Soldier_LAT_F"; + atlOffset=-9.5367432e-007; class CustomAttributes { class Attribute0 @@ -8577,6 +8586,7 @@ class Mission { }; id=1521; + atlOffset=-9.5367432e-007; }; class Item346 { diff --git a/A3-Antistasi/changelog.txt b/A3-Antistasi/changelog.txt index e10e4e80c7..d6643abf60 100644 --- a/A3-Antistasi/changelog.txt +++ b/A3-Antistasi/changelog.txt @@ -1081,4 +1081,9 @@ cambiar a inArea el undercover y revisar a qu - Removed debug message when AI captures an airbase. - Hopefully solved all the remaining HQ assets issues. - Fixed bug when AI tries to hide in a building. -- Reduced a lot the max distance between departure and targets for both land and air attacks (10Kmts and 3 Kmts). \ No newline at end of file +- Reduced a lot the max distance between departure and targets for both land and air attacks (10Kmts and 3 Kmts). +- Changed the position of the NATO Carrier in Altis. + +1.2.5 30/07/2018 + +- Seaport boat garrisons and patrols are subject to boat availability. diff --git a/A3-Antistasi/initFuncs.sqf b/A3-Antistasi/initFuncs.sqf index 61655a2764..f9e517c81b 100644 --- a/A3-Antistasi/initFuncs.sqf +++ b/A3-Antistasi/initFuncs.sqf @@ -1,6 +1,8 @@ call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; +//defendDrillAI = compile preProcessFileLineNumbers "AI\defendDrillAI.sqf"; +//isInRoof = compile preProcessFileLineNumbers "AI\buildings\isInRoof.sqf"; playerHasBeenPvPCheck = compile preProcessFileLineNumbers "playerHasBeenPvPCheck.sqf"; remoteBattle = compile preProcessFileLineNumbers "CREATE\remoteBattle.sqf"; spawnMissionGiver = compile preProcessFileLineNumbers "Missions\spawnMissionGiver.sqf"; diff --git a/A3-Antistasi/initVar.sqf b/A3-Antistasi/initVar.sqf index 625a38aa83..77e720431b 100644 --- a/A3-Antistasi/initVar.sqf +++ b/A3-Antistasi/initVar.sqf @@ -5,7 +5,7 @@ //Not commented lines cannot be changed. //Don't touch them. -antistasiVersion = "v 1.2.4"; +antistasiVersion = "v 1.2.5"; servidoresOficiales = ["A3-Antistasi Official EU 1","A3-Antistasi Official EU 2"];