diff --git a/Sources/epoch_code/compile/EPOCH_supportCopter.sqf b/Sources/epoch_code/compile/EPOCH_supportCopter.sqf index 6f6d9f21..62b3a16b 100644 --- a/Sources/epoch_code/compile/EPOCH_supportCopter.sqf +++ b/Sources/epoch_code/compile/EPOCH_supportCopter.sqf @@ -22,16 +22,29 @@ _grp = createGroup RESISTANCE; _grp setBehaviour "COMBAT"; _grp setCombatMode "RED"; -// TODO: make configized -_arrUnits = ["I_Soldier_EPOCH", "I_Soldier2_EPOCH", "I_Soldier3_EPOCH"]; +_minAISkill = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minAISkill"); +_arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes"); +_unitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum"); _arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]; +_arrVals = [ +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingAccuracy"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingShake"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingSpeed"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxEndurance"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotDistance"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotTime"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCourage"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxReloadSpeed"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCommanding"), +getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxGeneral") +]; _units = []; -for "_i" from 0 to ((count _arrUnits)-1) do { +for "_i" from 0 to (_unitCount - 1) do { - _unit = _grp createUnit[(_arrUnits select _i), _pos, [], 0, "FORM"]; + _unit = _grp createUnit[selectRandom _arrUnits, _pos, [], 0, "FORM"]; _units pushBack _unit; - _unit setSkill 0.6; + //_unit setSkill 0.6; _unit setRank "Private"; _unit enableAI "TARGET"; @@ -41,9 +54,9 @@ for "_i" from 0 to ((count _arrUnits)-1) do { _unit disableAI "FSM"; for "_i" from 0 to ((count _arrSkills)-1) do { - _aiskill = ((floor(random 10))+1)/10; - if (_aiskill<0.6) then {_aiskill=0.6}; - _unit setSkill [_arrSkills select _i,_aiskill]; + _aiskill = floor random (_arrVals select _i); + if (_aiskill<_minAISkill) then {_aiskill=_minAISkill}; + _unit setSkill [_arrSkills select _i,_arrVals select _i]; }; if (_i == 0) then { diff --git a/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf b/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf index eddf17e5..d81cd04b 100644 --- a/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf +++ b/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf @@ -1,7 +1,7 @@ /* Author: Aaron Clark - EpochMod.com - Contributors: + Contributors: Andrew Gregory Description: Antagonist spawn function @@ -12,15 +12,19 @@ Github: https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf */ -private ["_unit","_sapperNum","_config","_bomb","_targetPos","_grp","_driver","_index","_nonJammer","_nonTrader","_jammers","_jammerRange","_restricted","_disableAI"]; -params ["_unitClass"]; - +private ["_unit","_sapperNum","_config","_targetPos","_grp","_driver","_index","_nonJammer","_nonTrader","_jammers","_jammerRange","_restricted","_disableAI"]; +params ["_unitClass","_trgt","_doVariable"]; +private _bomb = objNull; +if(isNil "_doVariable")then{_doVariable=false;}; +if(isNil "_trgt")then{_trgt=player;}; +diag_log format["Epoch: ADMIN: Antagonist %1 Spawning on %2. Do variable: %3.", _unitClass, _trgt, _doVariable]; if(random 100 < 6)then{ [] execFSM "\x\addons\a3_epoch_code\System\Event_Air_Drop.fsm"; }; +if(_doVariable)then{_unitClass call EPOCH_unitSpawnIncrease;};//Assumes Antagonist is required. _index = EPOCH_spawnIndex find _unitClass; -if (count(player nearEntities[_unitClass, 800]) >= (EPOCH_playerSpawnArray select _index)) exitWith{}; +if (!_doVariable && (count(_trgt nearEntities[_unitClass, 800]) >= (EPOCH_playerSpawnArray select _index))) exitWith{}; _nonJammer = ["CfgEpochClient", "nonJammerAI", ["B_Heli_Transport_01_F","PHANTOM","Epoch_Cloak_F"]] call EPOCH_fnc_returnConfigEntryV2; _nonTrader = ["CfgEpochClient", "nonTraderAI", ["B_Heli_Transport_01_F","PHANTOM","Epoch_Cloak_F","GreatWhite_F"]] call EPOCH_fnc_returnConfigEntryV2; @@ -28,18 +32,22 @@ _nonTraderAIRange = ["CfgEpochClient", "nonTraderAIRange", 150] call EPOCH_fnc_r _unit = objNull; -_targetPos = getPosATL player; +_targetPos = getPosATL _trgt; _targetPos set [2,0]; _jammers = []; _config = 'CfgEpochClient' call EPOCH_returnConfig; _jammerRange = getNumber(_config >> "buildingJammerRange"); _jammers = nearestObjects[_targetPos, ["PlotPole_EPOCH"], _jammerRange]; -if(count _jammers > 0 && (_unitClass in _nonJammer))exitWith{}; +if(count _jammers > 0 && (_unitClass in _nonJammer))exitWith{ + if(_doVariable)then{["Not allowed near a base - Please respawn !", 5] call Epoch_dynamicText;}; +}; _restricted = []; _restricted = nearestObjects [_targetPos, ["ProtectionZone_Invisible_F"], _nonTraderAIRange]; -if(count _restricted > 0 && (_unitClass in _nonTrader))exitWith{}; +if(count _restricted > 0 && (_unitClass in _nonTrader))exitWith{ + if(_doVariable)then{["Not allowed near a trader - Please respawn !", 5] call Epoch_dynamicText;}; +}; _disableAI = { {_this disableAI _x}forEach["TARGET","AUTOTARGET","FSM"]; @@ -49,11 +57,11 @@ switch _unitClass do { case "Epoch_Cloak_F": { _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _unit call _disableAI; - [_unit] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm"; + [_unit,_trgt] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm"; }; case "GreatWhite_F": { if (surfaceIsWater _targetPos) then{ - if (((_targetPos vectorDiff getPosASL player) select 2) > 25) then{ + if (((_targetPos vectorDiff getPosASL _trgt) select 2) > 25) then{ _unit = createAgent[_unitClass, _targetPos, [], 120, "FORM"]; _unit call _disableAI; [_unit] execFSM "\x\addons\a3_epoch_code\System\Shark_Brain.fsm"; @@ -61,19 +69,19 @@ switch _unitClass do { }; }; case "Epoch_Sapper_F": { - if(random 100 < 6)then{ + if(random 100 < 6 && isNull _trgt)then{ _config = 'CfgEpochSapper' call EPOCH_returnConfig; _sapperNum = 8; if(getNumber(_config >> "sapperMigrationCount") > 0)then{ _sapperNum = getNumber(_config >> "sapperMigrationCount"); }; - [player,_sapperNum] execVM "epoch_code\compile\EPOCH_callSapperMigration.sqf"; + [_trgt,_sapperNum] execVM "epoch_code\compile\EPOCH_callSapperMigration.sqf"; }else{ _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _bomb = createVehicle ["Sapper_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"]; _bomb attachTo [_unit, [0,0,0],"Pelvis"]; _unit call _disableAI; - sapperHndl = [_unit, _bomb] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain.fsm"; + sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain.fsm"; _unit addEventHandler ["FiredNear", "sapperHndl setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];"]; _unit addEventHandler ["Hit", "sapperHndl setFSMVariable [""_sHit"",[_this select 1, _this select 2]];"]; }; @@ -83,12 +91,12 @@ switch _unitClass do { _bomb = createVehicle["SapperB_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"]; _bomb attachTo[_unit, [0, 0, 0], "Pelvis"]; _unit call _disableAI; - sapperHndl = [_unit, _bomb] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain2.fsm"; + sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain2.fsm"; _unit addEventHandler["FiredNear", "sapperHndl setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];"]; _unit addEventHandler["Hit", "sapperHndl setFSMVariable [""_sHit"",[_this select 1, _this select 2]];"]; }; case "I_UAV_01_F": { - _targetPos = getPosATL player; + _targetPos = getPosATL _trgt; _targetPos = [_targetPos, 600, 1200, 5, 0, 400, 0] call BIS_fnc_findSafePos; _targetPos set[2, 600]; _unit = createVehicle["I_UAV_01_F", _targetPos, [], 0, "FLY"]; @@ -97,7 +105,7 @@ switch _unitClass do { _grp = createGroup RESISTANCE; _driver = _grp createUnit["I_UAV_AI", position _unit, [], 0, "CAN_COLLIDE"]; _driver moveInAny _unit; - [_unit, player] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm"; + [_unit, _trgt] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm"; }; case "PHANTOM": { [] execFSM "\x\addons\a3_epoch_code\System\Phantom_Brain.fsm"; @@ -107,6 +115,12 @@ switch _unitClass do { }; }; +if(_doVariable && (!isNull _unit) && (!isNull _trgt))then{ +_trgt setVariable ["EPOCH_antagObj", _unit, true]; +if!(isNull _bomb)then{ +_trgt setVariable ["EPOCH_antagBomb", _bomb, true]; +}; +}; if !(isNull _unit) then { // send to server [_unit] remoteExec ["EPOCH_localCleanup",2]; diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_dirToFuzzy.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_dirToFuzzy.sqf index ab19c739..9db92ecd 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_dirToFuzzy.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_dirToFuzzy.sqf @@ -4,7 +4,7 @@ Contributors: Description: - Epoch cursorTarget anywhere + Direction from one object to another plus a degree value to chose a random direction within. Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike @@ -18,7 +18,7 @@ Parameter(s): _this select 0: (ARRAY or OBJECT) - position1 _this select 1: (ARRAY or OBJECT) - position2 - _this select 2: NUMBER - random spread [optional: default 32] + _this select 2: NUMBER - random spread [optional: default 32] max 360 Returns: SCALAR - (direction 0-360) diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerAttachToAntagonist.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerAttachToAntagonist.sqf new file mode 100644 index 00000000..c2b78477 --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerAttachToAntagonist.sqf @@ -0,0 +1,65 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + Switch player camera to antagonist. Currently only for use after player death. Return to player body when finished or revived. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_playerAttachToAntagonist.sqf + + Example: + [_antagonistObj,_plyrObj] call EPOCH_fnc_playerAttachToAntagonist; + + Parameter(s): + _this select 0: OBJECT - Antagonist Object + _this select 1: OBJECT - Player Object + + Returns: + +*/ +params ["_player", "_antagonist", "_bomb","_killer"]; +private _tapDiag = "TapOut"; +if (visibleMap) then {openMap [false, true];}; +_antagonist switchCamera "Internal"; +if(isNil "_bomb")then{_bomb = objNull;}; +if(typeOf _antagonist == "Epoch_Sapper_F" || typeOf _antagonist == "Epoch_SapperB_F")then{_tapDiag = "TapOut3";}; +createDialog _tapDiag; + +diag_log format["Epoch: DEBUG: Attaching player %1 to %2, bomb found: %3",_player,_antagonist,_bomb]; +[_antagonist,_tapDiag,_player,_killer] spawn{ +_antagonist2 = _this select 0; +_tapDiag2 = _this select 1; +_player2 = _this select 2; +_killer2 = _this select 3; +private _doingGroan = false; +private _doingBoom = false; +private _groanTime = diag_tickTime; + while {!alive _player2} do { + if (playerRespawnTime <= 1) exitWith{ (findDisplay 46) closeDisplay 0; }; + if (playerRespawnTime > 15 && !dialog) then {createDialog _tapDiag2;}; + if (isObjectHidden _player2) exitWith {[_player2,Epoch_personalToken,_killer2, "EPOCH_antagObj", objNull, true] remoteExec ["EPOCH_server_playerSetVariable",2];closeDialog 2;};//revivial + if((!alive _antagonist2)) exitWith { + [_player2,Epoch_personalToken,_killer2, "EPOCH_antagObj", objNull, true] remoteExec ["EPOCH_server_playerSetVariable",2]; + uiSleep 3;(findDisplay 46) closeDisplay 0;}; + if(_player2 getVariable["EPOCH_callGroan",false])then{ + _player2 setVariable["EPOCH_callGroan",false]; + _doingGroan = true; + _groanTime = diag_tickTime; + [_player2,Epoch_personalToken,_killer2, "EPOCH_callGroan", true, false] remoteExec ["EPOCH_server_playerSetVariable",2]; + }; + if(_player2 getVariable["EPOCH_callBoom",false])then{ + _player2 setVariable["EPOCH_callBoom",false]; + _doingBoom = true; + [_player2,Epoch_personalToken,_killer2, "EPOCH_callBoom", true, false] remoteExec ["EPOCH_server_playerSetVariable",2]; + }; + if(_doingGroan && ctrlEnabled 1602)then{ctrlEnable[1602,false];}; + if(_doingGroan && !(ctrlEnabled 1602) && diag_tickTime - _groanTime > 16)then{ctrlEnable[1602,true];_doingGroan=false;}; + if(_doingBoom && ctrlEnabled 1601)then{ctrlEnable[1601,false];}; + uiSleep 0.1; + }; +}; diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf index 61644cbc..6e6e46d0 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeath.sqf @@ -1,7 +1,7 @@ /* Author: Aaron Clark - EpochMod.com - Contributors: + Contributors: Andrew Gregory Description: Player death handler @@ -22,6 +22,8 @@ Returns: BOOL */ +private _tapDiag = "TapOut"; +private _doRevenge = false; params ["_unit", "_killer"]; // test ejecting unit from vehicle if dead client side @@ -36,21 +38,26 @@ EPOCH_buildMode = 0; EPOCH_snapDirection = 0; EPOCH_Target = objNull; +if(player != _killer && (isPlayer _killer || isPlayer (effectiveCommander _killer)))then{_tapDiag = "TapOut2";};//TODO: vehicle check may not always be reliable + if (Epoch_canBeRevived) then { setPlayerRespawnTime 600; - createDialog "TapOut"; + createDialog _tapDiag; } else { setPlayerRespawnTime 15; ["You can be just revived once per life!", 5] call Epoch_dynamicText; }; -[] spawn{ +[_killer, _tapDiag] spawn{ + _killer2 = _this select 0; + _tapDiag2 = _this select 1; while {!alive player} do { if (playerRespawnTime <= 1) exitWith{ (findDisplay 46) closeDisplay 0; }; - if (playerRespawnTime > 15 && !dialog) then { - createDialog "TapOut"; - }; + if (playerRespawnTime > 15 && !dialog) then {createDialog _tapDiag2;}; + if (isObjectHidden player) then {closeDialog 2;}; + if(player getVariable["EPOCH_doBoom",false])exitWith{player setVariable ["EPOCH_doBoom",nil];[player] call EPOCH_fnc_playerDeathDetonate;}; + if(player getVariable["EPOCH_doMorph",false])exitWith{player setVariable ["EPOCH_doMorph",nil];[selectRandom (getArray (getMissionConfig "CfgEpochClient" >> "deathMorphClass")),player,_killer2] call EPOCH_fnc_playerDeathMorph;}; uiSleep 0.1; }; }; diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathDetonate.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathDetonate.sqf new file mode 100644 index 00000000..770f9bde --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathDetonate.sqf @@ -0,0 +1,36 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + Detonate player body. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathDetonate.sqf + + Example: + [] call EPOCH_fnc_playerDeathDetonate; + + Parameter(s): + + Returns: + BOOM +*/ +params ["_player"]; +openmap [false,false]; +closeDialog 2; +[_player, Epoch_personalToken] remoteExec ["EPOCH_server_deadPlayerDetonate",2]; +deleteVehicle player; +player setVariable ["doneBoom", true]; + +[] spawn{ + while {!alive player} do { + //Handle clean up + if(player getVariable["doneBoom",false])exitWith{player setVariable ["doneBoom",nil]; uiSleep 5; (findDisplay 46) closeDisplay 0;}; + uiSleep 0.1; + }; +}; \ No newline at end of file diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathMorph.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathMorph.sqf new file mode 100644 index 00000000..1b06337e --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathMorph.sqf @@ -0,0 +1,38 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + Morph dead player body into an antagonist, called from player death GUI. Dead player camera will attach to antagonist. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_playerDeathMorph.sqf + + Example: + [] call EPOCH_fnc_playerDeathMorph; + + Parameter(s): + _this select 0: STRING - Antagonist class + _this select 1: OBJECT - Player (Victim) + _this select 2: OBJECT - Target Player (Killer) + + Returns: +*/ +params ["_antagonistClass", "_player", "_killer"]; + +openmap [false,false]; +[_killer,_antagonistClass,true,_player, Epoch_personalToken] remoteExec ["EPOCH_server_triggerAntagonist",2]; + +[_killer,_player] spawn{ +_killer2 = _this select 0; +_player2 = _this select 1; + while {!alive player} do { + if (isObjectHidden _player2) then {closeDialog 2;}; + if!(isNull (_killer2 getVariable["EPOCH_antagObj",objNull])) exitWith {closeDialog 2;[_player2,(_killer2 getVariable["EPOCH_antagObj",objNull]),(_killer2 getVariable["EPOCH_antagBomb",objNull]),_killer2] call EPOCH_fnc_playerAttachToAntagonist;}; + uiSleep 0.1; + }; +}; diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_playerSetVariable.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerSetVariable.sqf new file mode 100644 index 00000000..8630d935 --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_playerSetVariable.sqf @@ -0,0 +1,30 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + call setVariable from client. Allows the server to call and set a local variable on an object via a player without broadcasting. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_playerSetVariable.sqf + + Example: + [_obj,_var,_value,_local] call EPOCH_fnc_playerSetVariable; + + Parameter(s): + _this select 0: OBJECT - Object to attach variable to + _this select 1: STRING - Variable Name + _this select 2: ANYTHING - Variable Value + _this select 3: BOOLEAN - Broadcast ? + Returns: + +*/ + +params ["_obj", "_var", "_value", "_local"]; +if(isNil "_local")then{_local = false;}; +diag_log format["Epoch: ADMIN: Attempting Set variable [%2,%3,%4] on %1.", _obj, _var, _value,_local]; +_obj setVariable [_var,_value,_local]; \ No newline at end of file diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_triggerAntagonist.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_triggerAntagonist.sqf new file mode 100644 index 00000000..f8613241 --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_triggerAntagonist.sqf @@ -0,0 +1,27 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: Aaron Clark + + Description: + Send server message to trigger antagonist on another client. Server returns antagonist object where required. Designed to support additional tap out options (Morphing). + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/functions/EPOCH_fnc_triggerAntagonist.sqf + + Example: + [_killer, "Epoch_Sapper_F", player, true] call EPOCH_fnc_triggerAntagonist; + + Parameter(s): + _this select 0: Target client to trigger antagonist on. (Killer) + _this select 1: Antagonist class to spawn, e.g. "Epoch_Sapper_F", see EPOCH_unitSpawn.sqf for full list + _this select 2: On target, set variable containing antagonist object. Allows other players / requesting player to attach to antagonist object. + + Returns: + +*/ +params ["_target","_antagonist","_doVariable"]; +[_target,_antagonist,_doVariable,player,Epoch_personalToken] remoteExec ["EPOCH_server_triggerAntagonist",2]; \ No newline at end of file diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 0cf9c1aa..4bd0dfc3 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -1,6 +1,6 @@ /* Author: Aaron Clark - EpochMod.com - Contributors: + Contributors: Andrew Gregory Description: Main Client side configs for the Epoch gamemode @@ -23,6 +23,7 @@ class CfgEpochClient buildingJammerRange = 75; // jammer range in meters disableRemoteSensors = true; // disableRemoteSensors true EPOCH_news[] = {"Word is that Sappers have a new boss.","Dogs will often lure them monsters away.","My dog was blown up. I miss him.."}; + deathMorphClass[] = {"Epoch_Sapper_F","Epoch_SapperB_F","I_UAV_01_F","Epoch_Cloak_F"};//Random selection of these classes when player morphs after death. Currently available: Epoch_Cloak_F, Epoch_SapperB_F, Epoch_Sapper_F, I_UAV_01_F antagonistSpawnIndex[] = { {"Epoch_Cloak_F", 1}, // {"type", limit} {"GreatWhite_F", 2}, @@ -57,16 +58,16 @@ class CfgEpochClient // Event handler code displayAddEventHandler[] = {"keyDown","keyUp"}; - keyDown = "(_this call EPOCH_KeyDown)"; - keyUp = "(_this call EPOCH_KeyUp)"; + keyDown = "(_this call EPOCH_KeyDown)"; + keyUp = "(_this call EPOCH_KeyUp)"; addEventHandler[] = {"Respawn","Put","Take","InventoryClosed","InventoryOpened","Fired","Killed","HandleRating","GetInMan","GetOutMan"}; Respawn = "(_this select 0) call EPOCH_clientRespawn"; Put = "(_this select 1) call EPOCH_interact;_this call EPOCH_PutHandler"; - Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck"; - Fired = "_this call EPOCH_fnc_playerFired;"; - InventoryClosed = "if !(EPOCH_arr_interactedObjs isEqualTo[]) then {[EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2]; EPOCH_arr_interactedObjs = [];};"; + Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck"; + Fired = "_this call EPOCH_fnc_playerFired;"; + InventoryClosed = "if !(EPOCH_arr_interactedObjs isEqualTo[]) then {[EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2]; EPOCH_arr_interactedObjs = [];};"; InventoryOpened = "_this spawn EPOCH_initUI;_container = _this select 1;_lockedNear = false;if (_container isKindOf 'GroundWeaponHolder' || _container isKindOf 'WeaponHolderSimulated') then {{if (locked _x in [2, 3] ||_x getVariable['EPOCH_Locked', false]) exitWith {_lockedNear = true}} forEach (player nearSupplies 10);};if (locked _container in [2, 3] || _container getVariable['EPOCH_Locked', false] || _lockedNear) then {[] spawn {disableSerialization;waitUntil {!isNull findDisplay 602};_display = findDisplay 602;_ctrl_cargo = _display displayCtrl 6401;_ctrl_ground = _display displayCtrl 6321;_ctrl_cargo ctrlEnable false;ctrlSetFocus _ctrl_ground;ctrlActivate _ctrl_ground;};};"; - Killed = "_this call EPOCH_fnc_playerDeath;"; + Killed = "_this call EPOCH_fnc_playerDeath;"; HandleRating = "EPOCH_playerKarma = EPOCH_playerKarma + (_this select 1);0"; HandleDamage = ""; HandleHeal = ""; @@ -108,6 +109,10 @@ class CfgEpochSapper groanTrig = 16; //Percentage chance of a groan. Min value = 4 sRange = 300; //Distance from target over which sapper will dispose. Range within which sapper code will be aware of targets. Distance up to which sapper will attempt to find a spot to hide in. Min Value = 150. smellDist = 24; //Distance up to which sapper can smell. Used to decide if sapper can see target when deciding to charge and influences target selection. Is influenced by wind direction. Min Value = 8. + reflexSpeed = 0.25; //Sapper brain will pause for this time when checking for new stimulus during each thought process. Lower number equals a more reactive sapper. (Guide Min 0.25 - Max 2.5). + nestChance = 2; //Every time a sapper spawns apply this percentage chance that sapper will create a nest. + hideLevel = 72; //(Emotion) Sapper fear increases by several factors, higher number of armed player(s) in area / being shot at. Set fear level (out of 100) at which he will go into a 'hide / evade mode'.. temporarily. + chargeLevel = 52; //(Emotion) Sapper anger increases by smelling / sensing players, being shot at / hit, too many players on his turf. Set level (Out of 100) at which he is triggered to charge on the current target. }; class CfgEpochUAV { @@ -115,6 +120,22 @@ class CfgEpochUAV UAVMaxDist = 180; //Maximum distance to choose next position when roaming. Min Value = 42 / Max Value = 400. UAVHeight = 100; //Set height when roaming, slight randomness is applied to this value. UAV will choose own height when locked onto target. Min Value = 42 / Max Value = 280. UAV can still spot targets from height ! }; +class CfgEpochUAVSupport +{ + unitTypes[] = {"I_Soldier_EPOCH", "I_Soldier2_EPOCH", "I_Soldier3_EPOCH"};//Selects from randomly + maxUnitNum = 2; //Maximum number of units spawned when UAV spots target. + minAISkill = 0.2; //Minumum AI Skill. Skills are chosen randomly between this minimum overall AI skill value and the following max AI skill values, for each of the next skills: + maxAimingAccuracy = 0.7; + maxAimingShake = 0.9; + maxAimingSpeed = 0.6; + maxEndurance = 0.4; + maxSpotDistance = 0.4; + maxSpotTime = 0.3; + maxCourage = 0.3; + maxReloadSpeed = 0.5; + maxCommanding = 0.4; + maxGeneral = 0.4; +}; class CfgEpochAirDrop { AirDropFreq = 1200; //AirDropChance, to decide if Air drop occurs, will only be checked once per AirDropFreq time period, for each player. Min value = 120. diff --git a/Sources/epoch_config/Configs/CfgRemoteExec.hpp b/Sources/epoch_config/Configs/CfgRemoteExec.hpp index e780ee73..fbef7146 100644 --- a/Sources/epoch_config/Configs/CfgRemoteExec.hpp +++ b/Sources/epoch_config/Configs/CfgRemoteExec.hpp @@ -1,7 +1,7 @@ /* Author: Aaron Clark - EpochMod.com - Contributors: + Contributors: Andrew Gregory Description: RemoteExec whitelist for Epoch sandbox gamemode. This also blacklists default A3 remoteExec commands. @@ -197,6 +197,19 @@ class CfgRemoteExec allowedTargets=2; jip = 0; }; + class EPOCH_server_triggerAntagonist { + allowedTargets=2; + jip = 0; + }; + class EPOCH_server_deadPlayerDetonate { + allowedTargets=2; + jip = 0; + }; + class epoch_server_playersetvariable { + allowedTargets=2; + jip = 0; + }; + }; class Commands {mode=0;}; }; diff --git a/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_triggerAntagonist.sqf b/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_triggerAntagonist.sqf new file mode 100644 index 00000000..7a498c79 --- /dev/null +++ b/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_triggerAntagonist.sqf @@ -0,0 +1,24 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: Aaron Clark + + Description: + Trigger an antagonist on a client. Option to add antagonist object to target as a variable. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_triggerAntagonist.sqf +*/ +params ["_target","_antagonistClass","_doVariable","_player","_token"]; +diag_log format["Epoch: ADMIN: Attempting antagonist (%3) trigger from %1 for %2.", getPlayerUID _player, _target, _antagonistClass]; +if !([_player,_token]call EPOCH_server_getPToken)exitWith{}; + +if(!isNull _target)then{ +diag_log format["Epoch: ADMIN: Calling antagonist (%3) trigger from %1 for %2.", getPlayerUID _player, _target, _antagonistClass]; + +[_antagonistClass, _target, _doVariable] remoteExec ["EPOCH_unitSpawn",_target]; +//if(!isNull _player)then{hideObjectGlobal _player;};//Do elsewhere, allow revival +}; diff --git a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_airDropCrate.sqf b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_airDropCrate.sqf index adf85075..50e80763 100644 --- a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_airDropCrate.sqf +++ b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_airDropCrate.sqf @@ -1,7 +1,7 @@ /* - Author: Aaron Clark - EpochMod.com + Author: Andrew Gregory - EpochMod.com - Contributors: + Contributors: Aaron Clark Description: Creates air drop crate diff --git a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createAirDrop.sqf b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createAirDrop.sqf index 9d445df6..d988bd83 100644 --- a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createAirDrop.sqf +++ b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createAirDrop.sqf @@ -1,7 +1,7 @@ /* - Author: Aaron Clark - EpochMod.com + Author: Andrew Gregory - EpochMod.com - Contributors: + Contributors: Aaron Clark Description: Creates helicopter air drop diff --git a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf index 61da45db..2adc6d47 100644 --- a/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf +++ b/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf @@ -1,7 +1,7 @@ /* - Author: Aaron Clark - EpochMod.com + Author: Andrew Gregory - EpochMod.com - Contributors: + Contributors: Aaron Clark Description: Server side spawing of shipwreck loots diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayerDetonate.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayerDetonate.sqf new file mode 100644 index 00000000..941e9fcf --- /dev/null +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_deadPlayerDetonate.sqf @@ -0,0 +1,22 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: Aaron Clark + + Description: + Detonate a boss sapper bomb at player position. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_playerDeathOptions.sqf +*/ +params ["_player", "_token"]; +diag_log format["Epoch: ADMIN: Attempting player detonate on %1.", getPlayerUID _player]; +if !([_player,_token]call EPOCH_server_getPToken)exitWith{}; + +_pos = getPosATL _player; +_bomb = createVehicle["SapperB_Charge_Ammo", _pos, [], 0, "CAN_COLLIDE"]; +_bomb setDamage 1; +hideObjectGlobal _player; \ No newline at end of file diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_playerSetVariable.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_playerSetVariable.sqf new file mode 100644 index 00000000..bb05deac --- /dev/null +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_playerSetVariable.sqf @@ -0,0 +1,18 @@ +/* + Author: Andrew Gregory - EpochMod.com + + Contributors: + + Description: + Call setVariable on specific client. + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_antagonists/EPOCH_server_playerSetVariable.sqf +*/ +params ["_player","_token","_obj", "_var", "_value", "_local"]; +if !([_player,_token]call EPOCH_server_getPToken)exitWith{}; +diag_log format["Epoch: ADMIN: Attempting Set variable [%2,%3,%4] on %1.", _obj, _var, _value,_local]; +[_obj, _var,_value,_local] remoteExec ['EPOCH_fnc_playerSetVariable', _obj]; \ No newline at end of file diff --git a/Sources/epoch_server/config.cpp b/Sources/epoch_server/config.cpp index 9128d65a..17bb7f86 100644 --- a/Sources/epoch_server/config.cpp +++ b/Sources/epoch_server/config.cpp @@ -71,13 +71,14 @@ class CfgServerFunctions class server_savePlayer {}; class server_loadPlayer {}; class server_checkPlayer {}; - // class server_respawnPlayer {}; class server_onPlayerDisconnect {}; class server_deadPlayer {}; class server_revivePlayer {}; class server_storeCrypto {}; class server_equippedItem {}; class server_unpackBackpack {}; + class server_deadPlayerDetonate{}; + class server_playerSetVariable{}; }; class epoch_traders { class server_loadTraders {}; @@ -132,6 +133,7 @@ class CfgServerFunctions class server_handle_say3D {}; class server_handle_switchMove {}; class server_handle_sapperObjs {}; + class server_triggerAntagonist{}; }; }; };