diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf new file mode 100644 index 0000000..68a34c1 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf @@ -0,0 +1,107 @@ +/* + blck_fnc_spawnGroup + By Ghostrider [GRG] + Copyright 2016 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private["_numbertospawn","_groupSpawned","_safepos","_useLauncher","_launcherType"]; +// _newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,true,_isScubaGroup] +params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; + +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + private _params = ["_pos","_center","_numai1","_numai2","_skillLevel","_minDis","_maxDist","_configureWaypoints","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms","_scuba"]; + { + diag_log format["_fnc_spawnGroup: param %1 | value %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex,_forEachIndex]; + }forEach _this; +}; +#endif +//Spawns correct number of AI +if (_numai2 > _numai1) then +{ + _numbertospawn = floor( (random (_numai2 - _numai1) + _numai1 ) ); +} else { + _numbertospawn = _numai2; +}; + +#ifdef blck_debugMode +if (blck_debugLevel >= 1) then +{ + diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; +}; +#endif + +//_groupSpawned = createGroup [blck_AI_Side, true]; // true here causes any empty group to be automatically deleted within 1 sec or so. https://community.bistudio.com/wiki/createGroup +_groupSpawned = call blck_fnc_create_AI_Group; + +#ifdef blck_debugMode +if (blck_debugLevel >= 1) then +{ + diag_log format["spawnGroup.sqf: _groupSpawned = %1",_groupSpawned]; +}; +#endif +if !(isNull _groupSpawned) then +{ + + //diag_log format["spawnGroup:: group is %1",_groupSpawned]; + _useLauncher = blck_useLaunchers; + if (_weaponList isEqualTo []) then + { + _weaponList = [_skillLevel] call blck_fnc_selectAILoadout; + }; + + //Spawns the correct number of AI Groups, each with the correct number of units + //Counter variable + _i = 0; + while {_i < _numbertospawn} do { + _i = _i + 1; + if (blck_useLaunchers && _i <= blck_launchersPerGroup) then + { + _launcherType = selectRandom blck_launcherTypes; + } else { + _launcherType = "none"; + }; + + //Finds a safe positon to spawn the AI in the area given + //_safepos = [_pos,0,30,2,0,20,0] call BIS_fnc_findSafePos; + + //Spawns the AI unit + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["spawnGroup:: spawning unit #%1",_i]; + }; + #endif + //params["_pos","_aiGroup",_skillLevel,_uniforms, _headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms,_scuba]; + [_pos,_groupSpawned,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit; + }; + _groupSpawned selectLeader (units _groupSpawned select 0); + // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_pattern",["MOVE","SAD"]]]; + if (_configureWaypoints) then + { + if (_scuba) then {_infantryType = "scuba"} else {_infantryType = "infantry"}; + [_pos,_minDist,_maxDist,_groupSpawned,"random","SAD","infantry"] spawn blck_fnc_setupWaypoints; + }; + //[_pos,_minDist,_maxDist,_groupSpawned,"random","SENTRY"] spawn blck_fnc_setupWaypoints; + //diag_log format["_fnc_spawnGroup: blck_fnc_setupWaypoints called for group %1",_groupSpawned]; + #ifdef blck_debugMode + if (blck_debugLevel >= 1) then + { + diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned]; + }; + #endif + +} else +{ + diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED"; +}; +_groupSpawned diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf index 68a34c1..0d2946b 100644 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf +++ b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf @@ -14,7 +14,7 @@ private["_numbertospawn","_groupSpawned","_safepos","_useLauncher","_launcherType"]; // _newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,true,_isScubaGroup] -params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; +params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false]]; #ifdef blck_debugMode if (blck_debugLevel >= 2) then @@ -62,7 +62,8 @@ if !(isNull _groupSpawned) then //Spawns the correct number of AI Groups, each with the correct number of units //Counter variable _i = 0; - while {_i < _numbertospawn} do { + while {_i < _numbertospawn} do + { _i = _i + 1; if (blck_useLaunchers && _i <= blck_launchersPerGroup) then { @@ -82,7 +83,7 @@ if !(isNull _groupSpawned) then }; #endif //params["_pos","_aiGroup",_skillLevel,_uniforms, _headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms,_scuba]; - [_pos,_groupSpawned,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit; + [_pos,_groupSpawned,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba, _antiGlitch] call blck_fnc_spawnUnit; }; _groupSpawned selectLeader (units _groupSpawned select 0); // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_pattern",["MOVE","SAD"]]]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols - Copy.sqf new file mode 100644 index 0000000..9da35c4 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols - Copy.sqf @@ -0,0 +1,122 @@ +/* + blck_fnc_spawnMissionVehiclePatrols + by Ghostrider [GRG] + 3/17/17 + returns [] if no groups could be created + returns [_AI_Vehicles,_missionAI] otherwise; + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +// params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; +params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_isScubaGroup",false]]; +if (count _uniforms == 0) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms}; +if (count _headGear == 0) then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear}; +if (count _vests == 0) then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests}; +if (count _backpacks == 0) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks}; +if (count _weaponList == 0) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; +if (count _sideArms == 0) then {[_aiDifficultyLevel] call blck_fnc_selectAISidearms}; + +#ifdef blck_debugMode +if (blck_debugLevel >=2) then +{ + private _params = ["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles","_useRelativePos","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms","_isScubaGroup"]; + { + diag_log format["_fnc_spawnMissionVehiclePatrols:: param %1 | isEqualTo %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex, _forEachIndex]; + }forEach _this; +}; +#endif + +private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_vehicle","_return","_abort","_spawnPos","_v"]; +_vehicles = []; +_missionAI = []; +_abort = false; +//_useRelativePos = false; +if (_missionPatrolVehicles isEqualTo []) then +{ + _useRelativePos = false; + _vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; + { + _v = [_aiDifficultyLevel] call blck_fnc_selectPatrolVehicle; + //diag_log format["_fnc_spawnMissionVehiclePatrols (36):: position = %1 and vehicle = %2",_x, _v]; + _missionPatrolVehicles pushBack [_v, _x]; + }forEach _vehiclePatrolSpawns; +}; +#define configureWaypoints false +{ + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["_fnc_spawnMissionVehiclePatrols:: _x = %1 and _coords = %2",_x,_coords]; + }; + #endif + + if (_useRelativePos) then + { + _spawnPos = _coords vectorAdd (_x select 1) + } else { + _spawnPos = _x select 1; + }; + _vehicle = _x select 0; + // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ]; + _vehGroup = [_spawnPos,_coords,3,3,_aiDifficultyLevel,1,2,false,_uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup; + if (isNull _vehGroup) exitWith + { + _abort = true; + }; + if !(isNull _vehGroup) then + { + blck_monitoredMissionAIGroups pushBack _vehGroup; + }; + + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["_fnc_spawnMissionVehiclePatrols (73): group spawned = %1",_vehGroup]; + //diag_log format["_fnc_spawnMissionVehiclePatrols (74):: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType]; + }; + #endif + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["_fnc_spawnMissionVehiclePatrols(66): will spawn vehicle %1 at position %2",_vehicle,_spawnPos]; + }; + #endif + + //params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]]; + _patrolVehicle = [_coords,_spawnPos,_vehicle,30,45,_vehGroup,true] call blck_fnc_spawnVehiclePatrol; + _vehGroup setVariable["groupVehicle",_vehicle]; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["_fnc_spawnMissionVehiclePatrols (76):: - > patrol vehicle spawned was %1",_patrolVehicle]; + }; + #endif + + if !(isNull _patrolVehicle) then + { + _patrolVehicle setVariable["vehicleGroup",_vehGroup]; + _vehicles pushback _patrolVehicle; + _missionAI append (units _vehGroup); + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["_fnc_spawnMissionVehiclePatrols(91):: -- > _vehicles updated to %1",_vehicles]; + }; + #endif + +} forEach _missionPatrolVehicles; + +blck_monitoredVehicles append _vehicles; +_return = [_vehicles, _missionAI, _abort]; + +_return diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf new file mode 100644 index 0000000..4d53f0b --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf @@ -0,0 +1,210 @@ +/* + blck_fnc_spawnUnit + Original Code by blckeagls + Modified by Ghostrider + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private ["_i","_weap","_skin","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"]; +params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; + +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + private _params = ["_pos","_aiGroup","_skillLevel","_uniforms","_headGear","_vests","_backpacks","_Launcher","_weaponList","_sideArms","_scuba"]; //"_weaponList", "_Launcher" + { + diag_log format["_fnc_spawnUnit::-> _this select %1 (%2) = %3",_forEachIndex, _params select _forEachIndex, _this select _forEachIndex]; + }forEach _this; +}; +#endif +if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"}; + +_unit = ObjNull; + +if (blck_modType isEqualTo "Epoch") then +{ + "I_Soldier_EPOCH" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + _unit setVariable ["LAST_CHECK",28800,true]; + switch(_skillLevel) do + { + case "blue":{_unit setVariable["Crypto",2 + floor(random(blck_maxMoneyBlue)),true];}; + case "red":{_unit setVariable["Crypto",4 + floor(random(blck_maxMoneyRed)),true];}; + case "green":{_unit setVariable["Crypto",6 + floor(random(blck_maxMoneyGreen)),true];}; + case "orange":{_unit setVariable["Crypto",8 + floor(random(blck_maxMoneyOrange)),true];}; + }; +}; +if (blck_modType isEqualTo "Exile") then +{ + "i_g_soldier_unarmed_f" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + switch(_skillLevel) do + { + case "blue":{_unit setVariable["ExileMoney",2 + floor(random(blck_maxMoneyBlue)),true];}; + case "red":{_unit setVariable["ExileMoney",4 + floor(random(blck_maxMoneyRed)),true];}; + case "green":{_unit setVariable["ExileMoney",6 + floor(random(blck_maxMoneyGreen)),true];}; + case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];}; + }; +}; +// findEmptyPosition [minDistance, maxDistance, vehicleType] + +_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]); +_posUnit = getPosATL _unit; +_start = +_posUnit; +_start set [2, 100]; +while { (lineIntersects [ATLToASL _start, ATLToASL _posUnit]) } do { + _pos set [2, ((_pos select 2) + 0.25)]; + _posUnit set[1,((_posUnit select 1) + 0.25)]; +}; +_unit setPosATL _pos; + +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + diag_log format["_fnc_spawnUnit::-->> unit spawned = %1",_unit]; +}; +#endif +[_unit] call blck_fnc_removeGear; +if (_scuba) then +{ + _unit swiminDepth (_pos select 2); + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then + { + diag_log format["_fnc_spawnUnit:: -- >> unit depth = %1 and underwater for unit = %2",_pos select 2, underwater _unit]; + }; + #endif +}; +_skin = ""; +_counter = 1; +//diag_log format["_fnc_spawnUnit: _uniforms = %1",_uniforms]; +while {_skin isEqualTo "" && _counter < 10} do +{ + _unit forceAddUniform (selectRandom _uniforms); + _skin = uniform _unit; + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["_fnc_spawnUnit::-->> for unit _unit % uniform is %2",_unit, uniform _unit]; + }; + #endif + _counter =+1; +}; +//Sets AI Tactics +_unit enableAI "ALL"; +_unit allowDammage true; +_unit setBehaviour "COMBAT"; +_unit setunitpos "AUTO"; + +if !(_headGear isEqualTo []) then +{ + _unit addHeadgear (selectRandom _headGear); + //diag_log format["Headgear for unit %1 = %2",_unit, headgear _unit]; +}; +if !(_vests isEqualTo []) then +{ + _unit addVest (selectRandom _vests); + //diag_log format["Vest for unit %1 = %2",_unit, vest _unit]; +}; + +if (_weaponList isEqualTo []) then {_weaponList = call blck_fnc_selectAILoadout}; +_weap = selectRandom _weaponList; +_unit addWeaponGlobal _weap; +_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); +_optics = getArray (configfile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems"); +_pointers = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems"); +_muzzles = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems"); +_underbarrel = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "UnderBarrelSlot" >> "compatibleItems"); +_legalOptics = _optics - blck_blacklistedOptics; + +_unit addMagazines [selectRandom _ammoChoices, 3]; + +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _legalOptics)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _pointers)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _underbarrel)}; +if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then +{ + _unit addMagazine "1Rnd_HE_Grenade_shell"; +}; + +if !(_sideArms isEqualTo []) then +{ + _weap = selectRandom _sideArms; + //diag_log format["[spawnUnit.sqf] _weap os %1",_weap]; + _unit addWeaponGlobal _weap; + _ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); + _unit addMagazines [selectRandom _ammoChoices, 2]; +}; +for "_i" from 1 to (1+floor(random(4))) do +{ + _unit addItem (selectRandom blck_ConsumableItems); +}; + +// Add First Aid or Grenade 50% of the time +if (round(random 10) <= 5) then +{ + //diag_log format["spawnUnit.sqf] -- Item is %1", _item]; + _unit addItem selectRandom blck_specialItems; +}; +//diag_log format["_spawnUnit: _Launcher = %1",_Launcher]; +if ( !(_Launcher isEqualTo "none") && !(_backpacks isEqualTo [])) then +{ + _unit addWeaponGlobal _Launcher; + _unit addBackpack (selectRandom _backpacks); + for "_i" from 1 to 3 do + { + _unit addItemToBackpack (getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines") select 0); // call BIS_fnc_selectRandom; + }; + _unit setVariable["Launcher",_launcher,true]; +} else { + if ( random (1) < blck_chanceBackpack && !(_backpacks isEqualTo [])) then + { + _unit addBackpack selectRandom _backpacks; + }; +}; + +if(sunOrMoon < 0.2 && blck_useNVG)then +{ + _unit addWeapon selectRandom blck_NVG; + _unit setVariable ["hasNVG", true,true]; +} +else +{ + _unit setVariable ["hasNVG", false,true]; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["_fnc_spawnUnit:: --> unit loadout = %1", getUnitLoadout _unit]; +}; +#endif + +_unit addEventHandler ["Reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]; +_unit addMPEventHandler ["MPKilled", {[(_this select 0), (_this select 1)] call compile preprocessfilelinenumbers blck_EH_AIKilled;}]; // changed to reduce number of concurrent threads, but also works as spawn blck_AIKilled; }]; +_unit addMPEventHandler ["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIHit;}]; + +switch (_skillLevel) do +{ + case "blue": {_index = 0;_aiSkills = blck_SkillsBlue;}; + case "red": {_index = 1;_aiSkills = blck_SkillsRed;}; + case "green": {_index = 2;_aiSkills = blck_SkillsGreen;}; + case "orange": {_index = 3;_aiSkills = blck_SkillsOrange;}; + default {_index = 0;_aiSkills = blck_SkillsBlue;}; +}; + +[_unit,_aiSkills] call blck_fnc_setSkill; +_unit setVariable ["alertDist",blck_AIAlertDistance select _index,true]; +_unit setVariable ["intelligence",blck_AIIntelligence select _index,true]; +_unit setVariable ["GMS_AI",true,true]; + +_unit + + diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf index 4d53f0b..6849c63 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf @@ -27,10 +27,10 @@ if (blck_debugLevel >= 2) then if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"}; _unit = ObjNull; - +private _unitType = ""; if (blck_modType isEqualTo "Epoch") then { - "I_Soldier_EPOCH" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + _unitType = "I_Soldier_EPOCH"; // createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; _unit setVariable ["LAST_CHECK",28800,true]; switch(_skillLevel) do { @@ -42,7 +42,7 @@ if (blck_modType isEqualTo "Epoch") then }; if (blck_modType isEqualTo "Exile") then { - "i_g_soldier_unarmed_f" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + _unitType = "i_g_soldier_unarmed_f"; // createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; switch(_skillLevel) do { case "blue":{_unit setVariable["ExileMoney",2 + floor(random(blck_maxMoneyBlue)),true];}; @@ -51,9 +51,10 @@ if (blck_modType isEqualTo "Exile") then case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];}; }; }; -// findEmptyPosition [minDistance, maxDistance, vehicleType] +_unit = _aiGroup createUnit[_unitType,_pos,[],5,"FORM"]; -_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]); +//_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]); +/* _posUnit = getPosATL _unit; _start = +_posUnit; _start set [2, 100]; @@ -62,7 +63,7 @@ while { (lineIntersects [ATLToASL _start, ATLToASL _posUnit]) } do { _posUnit set[1,((_posUnit select 1) + 0.25)]; }; _unit setPosATL _pos; - +*/ #ifdef blck_debugMode if (blck_debugLevel >= 2) then { diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle - Copy.sqf new file mode 100644 index 0000000..2435b33 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle - Copy.sqf @@ -0,0 +1,39 @@ +/* + Spawn a vehicle and protect it against cleanup by Epoch + Returns the object (vehicle) created. + By Ghostrider [GRG] + Last modified 1-27-17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private["_veh"]; +params["_vehType","_pos",["_clearInventory",true]]; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then {diag_log format["spawnVehicle.sqf: _vehType = %1 | _pos = %2",_vehType,_pos];}; +#endif + +_veh = createVehicle[_vehType, _pos, [], 0, "NONE"]; +_veh allowDamage true; +_veh enableRopeAttach true; +_veh setVariable["blck_vehicle",true]; +[_veh] call blck_fnc_protectVehicle; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then {diag_log format["spawnVehicle.sqf:: vehicle spawned is %1",_veh];}; +#endif +// params["_veh",["_clearInventory",true]]; +[_veh,_clearInventory] call blck_fnc_configureMissionVehicle; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then {diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh];}; +#endif + +_veh + diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf index 2435b33..ac9caca 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf @@ -20,6 +20,7 @@ if (blck_debugLevel > 1) then {diag_log format["spawnVehicle.sqf: _vehType = %1 #endif _veh = createVehicle[_vehType, _pos, [], 0, "NONE"]; +_veh setVectorUp surfaceNormal position _veh; _veh allowDamage true; _veh enableRopeAttach true; _veh setVariable["blck_vehicle",true]; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol - Copy.sqf new file mode 100644 index 0000000..3124f14 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol - Copy.sqf @@ -0,0 +1,79 @@ +/* + By Ghostrider [GRG] + Copyright 2016 + Last updated 3-17-17 + + spawns a vehicle of _vehType and mans it with units in _group. + returns _veh, the vehicle spawned. + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private["_vehType","_safepos","_veh","_unitNumber"]; +params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull],["_setWaypoints",true]]; +#ifdef blck_debugMode +if (blck_debugLevel > 1) then +{ + private _params = ["_center","_pos","_vehType","_minDis","_maxDis","_group","_setWaypoints"]; + { + diag_log format["_fnc_spawnMissionVehiclePatrol:: param %1 | isEqualTo %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex, _forEachIndex]; + }forEach _this; +}; +#endif + +//_center Center of the mission area - this is usuall the position treated as the center by the mission spawner. Vehicles will patrol the perimeter of the mission area. +// _pos the approximate spawn point for the vehicle +//_vehType = [_this,1,"I_G_Offroad_01_armed_F"] call BIS_fnc_param; +//_minDis = minimum distance from the center of the mission for vehicle waypoints +//_maxDis = maximum distance from the center of the mission for vehicle waypoints +//_groupForVehiclePatrol = The group with which to man the vehicle + + + +if !(isNull _group) then +{ // exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;}; + _veh = [_vehType,_pos] call blck_fnc_spawnVehicle; +// _veh addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; + _veh addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleHit}]; + _group setVariable["groupVehicle",_veh]; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["spawnVehiclePatrol:: vehicle spawned is %1 of typeof %2",_veh, typeOf _veh]; + }; + #endif + + _unitNumber = 0; + + { + switch (_unitNumber) do + { + case 0: {_x moveingunner _veh;}; + case 1: {_x moveindriver _veh;}; + default {_x moveInCargo _veh;}; + }; + _unitNumber = _unitNumber + 1; + }forEach (units _group); + + // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAD"],["_soldierType","null"] ]; + _group setcombatmode "RED"; + _group setBehaviour "COMBAT"; + if (_setWaypoints) then + { + [_center,_minDis,_maxDis,_group,"perimeter","SAD","vehicle"] spawn blck_fnc_setupWaypoints; + }; +}; +#ifdef blck_debugMode +if (blck_debugLevel > 1) then +{ + diag_log format["_fnc_spawnVehiclePatrol::->> _veh = %1",_veh]; +}; +#endif +_veh + + diff --git a/@GMS/addons/custom_server/Configs/blck_defines.hpp b/@GMS/addons/custom_server/Configs/blck_defines.hpp index a22f1b3..17e4008 100644 --- a/@GMS/addons/custom_server/Configs/blck_defines.hpp +++ b/@GMS/addons/custom_server/Configs/blck_defines.hpp @@ -29,5 +29,6 @@ #define groupSpawned 2 #define timesSpawned 3 #define respawnAt 4 +#define antiGlitchOn 1 diff --git a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf index b5b8ab0..d672418 100644 --- a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf +++ b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf @@ -15,8 +15,8 @@ private ["_staticMissions"]; _staticMissions = [ // [mod (Epoch, Exile), map (Altis, Tanoa etc), mission center, eg [10445,2014,0], filename.sqf (name of static mission template for that mission)]; - //["Epoch","Altis","staticMissionExample2_Epoch.sqf"], - //["Exile","Altis","staticMissionExample2_Exile.sqf"] + ["Epoch","Altis","staticMissionExample2_Epoch.sqf"], + ["Exile","Altis","staticMissionExample2_Exile.sqf"] ]; //diag_log "[blckeagls] GMS_StaticMissions_Lists.sqf "; diff --git a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf index eba05a4..165749f 100644 --- a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf +++ b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf @@ -55,20 +55,20 @@ _missionLandscapeMode = "precise"; // acceptable values are "random","precise" // In precise mode objects will be spawned at the relative positions specified. // In the random mode, objects will be randomly spawned within the mission area. _missionLandscape = [ // Paste appropriate lines from M3EDEN output here. - ["Land_Cargo_HQ_V2_F",[22894.7,16766,3.19],[[0,1,0],[0,0,1]],[true,false]], - ["Land_Cargo_HQ_V1_F",[22918.1,16761.9,3.18151],[[0,1,0],[0,0,1]],[true,false]], - ["Land_Cargo_HQ_V3_F",[22907.6,16740.3,3.17544],[[0,1,0],[0,0,1]],[true,false]], - ["Land_Dome_Small_F",[22908.2,16808.8,3.19],[[0,1,0],[0,0,1]],[true,false]] + //["Land_Cargo_HQ_V2_F",[22894.7,16766,3.19],[[0,1,0],[0,0,1]],[true,false]], + //["Land_Cargo_HQ_V1_F",[22918.1,16761.9,3.18151],[[0,1,0],[0,0,1]],[true,false]], + //["Land_Cargo_HQ_V3_F",[22907.6,16740.3,3.17544],[[0,1,0],[0,0,1]],[true,false]], + //["Land_Dome_Small_F",[22908.2,16808.8,3.19],[[0,1,0],[0,0,1]],[true,false]] ]; // list of objects to spawn as landscape using output from M3EDEN editor. _missionLootBoxes = [ // Paste appropriate lines from M3EDEN editor output here, then add the appropriate lootArray // [["box_classname1",_customLootArray1,[px,py,pz],...,_customLootArray1],["box_classname2",,[px2,py2,pz2],...,_customLootArray2] // where _customLootArray follows the same format as blck_BoxLoot_Red and the other pre-defined arrays and // where _customlootcountsarray1 also follows the same format as the predefined arrays like blck_lootCountsRed - [selectRandom blck_crateTypes,[22917.4,16763,6.30803],[[0,1,0],[0,0,1]],[true,false], _crateLoot, [[1,2],[4,6],[2,6],[5,8],6,1] ], - [selectRandom blck_crateTypes,[22893,16766.8,6.31652],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts], + //[selectRandom blck_crateTypes,[22917.4,16763,6.30803],[[0,1,0],[0,0,1]],[true,false], _crateLoot, [[1,2],[4,6],[2,6],[5,8],6,1] ], + //[selectRandom blck_crateTypes,[22893,16766.8,6.31652],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts], // 0 1 2 3 4 5 - [selectRandom blck_crateTypes,[22904.8,16742.5,6.30195],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts] + //[selectRandom blck_crateTypes,[22904.8,16742.5,6.30195],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts] ]; // If this array is empty a single loot chest will be added at the center. If you add items loot chest(s) will be spawned in specific positions. @@ -87,7 +87,7 @@ _noEmplacedWeapons = blck_SpawnEmplaced_Red; // Modified as needed; can be a num // Note that this value is ignored if you define static weapon positions and types in the array below. _missionEmplacedWeapons = [ //["B_G_Mortar_01_F",[22867.3,16809.1,3.17968],"red",0,0], - //["B_HMG_01_high_F",[22825.3,16923.5,3.14243],"blue",0,0] + ["B_HMG_01_high_F",[22825.3,16923.5,3.14243],"blue",0,10] ]; // example [ ["emplacedClassName",[px, py, pz] /* position to spawn weapon */, difficulty /* difficulty of AI manning weapon (blue, red etc)] ]; // can be used to define the precise placement of static weapons [[1,2,3] /*loc 1*/, [2,3,4] /*loc 2*/]; if blank random locations will be used // If the number of possible locations exceeds the number of emplaced weapons specified above then only some of the locations in the array will have emplaced weapons spawned. @@ -105,14 +105,14 @@ _aiGroupParameters = [ //[[22832.9,16805.6,4.59315],"red",4, 75,900], //[[22909.8,16778.6,3.19144],"red",4, 75,900], //[[22809.4,16929.5,5.33892],"blue",1, 75,0], - //[[22819.4,16929.5,5.33892],"red",1, 75, 0] + [[22819.4,16929.5,0],"red",1, 75, 10] ]; _noVehiclePatrols = blck_SpawnVeh_Red; // Modified as needed; can be a numberic value (e.g. 3) or range presented as [2,4]; // Note that this value is ignored if you define vehicle patrols in the array below. _vehiclePatrolParameters = [ //["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"green",600,0], - //["B_G_Offroad_01_armed_F",[22809.5,16699.2,8.78706],"blue",600,0] + ["B_G_Offroad_01_armed_F",[22809.5,16699.2,0],"blue",600,10] ]; //[ ["vehicleClassName",[px,py,pz] /* center of patrol area */, difficulty /* blue, red etc*/, patrol radius] ] // When this array is empty, vehicle patrols will be scattered randomely around the mission. // Allows you to define the location of the center of the patrol, vehicle type spawned, radius to patrol, and AI difficulty (blue, red, green etc).