Code optimization and 1 bug fix (partial)

first part of a fix for the reward player bug when player is in a vehicle.

Optiimized a bunch of code - small tweaks only.
This commit is contained in:
Chris Cardozo 2019-05-18 14:05:16 -04:00
parent ac2f57aeee
commit 47e7a780de
32 changed files with 250 additions and 213 deletions

View File

@ -12,18 +12,8 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format ["_fnc_cleanEmptyGroups:: -- >> group count = %1 ",(count allGroups)];
diag_log format ["_fnc_cleanEmptyGroups:: -- >> Group count AI side = %1", call blck_fnc_groupsOnAISide];
};
#endif
private _grp = +allGroups;
{
//diag_log format["_fnc_cleanEmptyGroups:: - >> type of object _x = %1",typeName _x];
if ((count units _x) isEqualTo 0) then {deleteGroup _x};
}forEach _grp;
if (blck_debugLevel > 2) then {diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function";};

View File

@ -0,0 +1,14 @@
for "_i" from 1 to (count blck_temporaryMarkers) do
{
if (_i > (count blck_temporaryMarkers)) exitWith {};
private _m = blck_temporaryMarkers deleteAt 0;
_m params["_marker","_deleteAt"];
//diag_log format["_cleanupTemporaryMarkers: _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
if (diag_tickTime > _deleteAt) then
{
deleteMarker _marker;
} else {
blck_temporaryMarkers pushBack _m;
//diag_log format["_cleanupTemporaryMarkers: wait longer before deleting _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
};
};

View File

@ -14,7 +14,7 @@ params["_data"];
_value = 0;
if (typeName _data isEqualTo "ARRAY") then
{
params["_min","_max"];
_data params["_min","_max"];
if (_max > _min) then
{
_value = _min + round(random(_max - _min));

View File

@ -1,6 +1,12 @@
/*
Credit for this method goes to He-Man who first suggested it.
*/
diag_log format["_fnc_giveTakeCrypto: _this = %1",_this];
_object = _this select 0;
diag_log format["_giveTakeCrypto: _object data = %1 | _object = %2",_object call BIS_fnc_objectType, _object];
if (_object isKindOf "Man") then
{
_this call EPOCH_server_effectCrypto;
};

View File

@ -29,23 +29,10 @@
params["_loadout","_crate",["_addAmmo",0]];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["blck_fnc_loadLootFromItemsArray:: _this %1",_this];
diag_log format["blck_fnc_loadLootFromItemsArray:: _crate %1 | _addAmmo %2 | _loadout %3",_crate,_addAmmo,_loadout];
};
#endif
if ((_loadout select 0) isEqualTo []) exitWith {};
{
private["_tries","_q","_item"];
_tries = 0;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["blck_fnc_loadLootFromItemsArray:: -- >> now loading for %1",_x];
};
#endif
_q = _x select 1; // this can be a number or array.
_tries = [_q] call blck_fnc_getNumberFromRange;
for "_i" from 1 to _tries do

View File

@ -43,6 +43,8 @@ while {true} do
[] call blck_fnc_cleanupObjects;
[] call blck_fnc_cleanupDeadAI;
[] call blck_fnc_scanForPlayersNearVehicles;
[] call GMS_fnc_cleanupTemporaryMarkers;
[] call GMS_fnc_updateCrateSignals;
//[] call blck_fnc_cleanEmptyGroups;
_timer20sec = diag_tickTime + 20;
};

View File

@ -19,6 +19,7 @@ _MainMarker = createMarker [_name, _location];
_MainMarker setMarkerColor "ColorBlack";
_MainMarker setMarkerType "n_hq";
_MainMarker setMarkerText "Mission Cleared";
uiSleep 300;
deleteMarker _MainMarker;
//uiSleep 300;
//deleteMarker _MainMarker;
blck_temporaryMarkers pushBack [_MainMarker, diag_tickTime + 300];
//diag_log format["missionCompleteMarker complete script for _this = %1",_this];

View File

@ -15,24 +15,19 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
/////////////////////////////////////////////////////
private ["_result","_players"];
params["_pos","_dist",["_onFootOnly",false]];
_players = call blck_fnc_allPlayers;
_result = false;
//diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2 and _result = %3",_pos,_dist,_result];
if !(_onFootOnly) then
{
{
//diag_log format["_fnc_playerInRange:: !_onFootOnly -> _pos = %1 and _player = %2 and distance = %3",_pos,_x, _pos distance _x];
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach _players;
} else {
{
//diag_log format["_fnc_playerInRange:: onfootOnly -> _pos = %1 and _player = %2 and distance = %3",_pos,_x, _pos distance2d _x];
if ( ((_x distance2D _pos) < _dist) && (vehicle _x isEqualTo _x)) exitWith {_result = true;};
} forEach _players;
};
//diag_log format["_fnc_playerInRange:: returning with _result = %1",_result];
_result

View File

@ -15,7 +15,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
/////////////////////////////////////////////////////
private ["_result"];
params["_locations","_dist",["_onFootOnly",false]];

View File

@ -66,9 +66,7 @@ _blck_fn_configureIconMarker = {
params["_mArray"];
private["_marker"];
_mArray params["_missionMarkerName","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerTypeInfo"];
_markerTypeInfo params["_mShape",["_mSize",[0,0]],["_mBrush","GRID"]];
if (toUpper(_mShape) in ["ELIPSE","ELLIPSE","RECTANGLE"]) then // not an Icon ....
{
_marker = [_missionMarkerName,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;

View File

@ -0,0 +1,41 @@
for "_i" from 1 to (count blck_illuminatedCrates) do
{
if (_i > (count blck_illuminatedCrates)) exitWith {};
private _c = blck_illuminatedCrates deleteAt 0;
_c params["_crate","_smoke","_light","_smokeShell","_lightSource","_refreshTime","_endAt"];
//diag_log format["_unpdateCrateSignals: [_crate %1 | _smoke %2 | _light %3 |_smokeShell %4 | _lightSource %5 | curr time %8 | _refreshTime %6 |_endAt %7",_crate,_smoke,_light,_smokeShell,_lightSource,_refreshTime,_endAt,diag_tickTime];
if (diag_tickTime < _endAt) then
{
if (diag_tickTime > _refreshTime) then
{
if !(isNull _smoke) then
{
detach _smoke;
deleteVehicle _smoke;
};
if !(isNull _light) then
{
detach _light;
deleteVehicle _light;
};
_smoke = _smokeShell createVehicle getPosATL _crate;
_smoke setPosATL (getPosATL _crate);
_smoke attachTo [_crate,[0,0,(0.5)]]; // put the smoke a fixed distance above the top of any object to make it as visible as possible
if(sunOrMoon < 0.2) then
{
_light = _lightSource createVehicle getPosATL _crate;
_light setPosATL (getPosATL _crate);
_light attachTo [_crate,[0,0,(0.55)]];
};
blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,diag_tickTime + 120,_endAt];
} else {
//diag_log format["_updateCrateSignals: refresh light at %1",_refreshTime];
//blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,_refreshTime,_endAt];
blck_illuminatedCrates pushBack _c;
};
} else {
//diag_log format["_updateCrateSignals: crate has been illuminated for enough time, no need to continue"];
};
};

View File

@ -9,5 +9,4 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_marker","_rootText","_missionAI"];
//diag_log format["_fnc_updateMarkerAliveCount: _this = %1",_this];
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];

View File

@ -14,10 +14,6 @@ for "_i" from 0 to ((count blck_monitoredMissionAIGroups) - 1) do
{
if (_i >= (count blck_monitoredMissionAIGroups)) exitWith {};
_grp = blck_monitoredMissionAIGroups deleteat 0;
//if (!(_grp isEqualTo grpNull) then
//{
if ({alive _x} count units _grp > 0) then { blck_monitoredMissionAIGroups pushBack _grp};
//};
};

View File

@ -14,12 +14,8 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_wp"];
diag_log format["_fnc_changeToSADWaypoint:: -- :: _this = %1 and typName _this %2",_this, typeName _this];
_group = group _this;
diag_log format["_fnc_emplacedWeaponWaypoint:: -- >> group to update is %1 with typeName %2",_group, typeName _group];
_group setVariable["timeStamp",diag_tickTime];
_wp = [_group, 0];
_group setCurrentWaypoint _wp;
diag_log format["_fnc_emplacedWeaponWaypoint:: -- >> group to update is %1 waypoints updated at %2",_group, (_group getVariable["timeStamp",diag_tickTime])];

View File

@ -17,7 +17,6 @@ if (blck_modType == "Epoch") then {_units = (_pos) nearEntities ["I_Soldier_EPOC
if (blck_modType == "Exile") then {_units = (_pos) nearEntities ["i_g_soldier_unarmed_f", 100]};
_nearestGroup = group (_units select 0);
{
if ((group _x) != _group) then
{
if ( _x distance (leader _group) < ((leader _nearestGroup) distance (leader _group)) ) then

View File

@ -17,32 +17,16 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_fn_deleteObjects = {
params["_objects"];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log format["_fn_deleteObjects:: -> _objects = %1",_objects];};
#endif
{
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_fnc_cleanUpObjects: -> deleting object %1",_x];};
#endif
deleteVehicle _x;
} forEach _objects;
};
//diag_log format["_fnc_cleanUpObjects called at %1",diag_tickTime];
private["_oldObjs"];
for "_i" from 1 to (count blck_oldMissionObjects) do {
if (_i <= count blck_oldMissionObjects) then {
_oldObjs = blck_oldMissionObjects deleteat 0;
_oldObjs params ["_objarr","_timer"];
if (diag_tickTime > _timer) then {
[_objarr] call _fn_deleteObjects;
uiSleep 0.1;
#ifdef blck_debugMode
//diag_log format["_fn_deleteObjects:: blck_oldMissionObjects updated from %1",_obj];
if (blck_debugLevel > 1) then {diag_log format["_fn_deleteObjects:: (48) blck_oldMissionObjects updated to %1",blck_oldMissionObjects];};
#endif
{
deleteVehicle _x;
} forEach _objarr;
//uiSleep 0.1;
}
else {
blck_oldMissionObjects pushback _oldObjs;

View File

@ -16,28 +16,8 @@ Spawn a crate on land or in the air
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_crate","_light","_beacon","_start","_maxHeight","_bbr","_p1","_p2"];
// can probably hook this onto signalEnd as they do the same things
// Left here for legacy compatability with some GRG addons.
params["_crate"];
//_crate = _this select 0;
_start = diag_tickTime;
// If night, attach a chemlight
_signal = "SmokeShellOrange";
if (sunOrMoon < 0.2) then
{
_signal = "FlareYellow_F";
};
_bbr = boundingBoxReal _crate;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_maxHeight = abs ((_p2 select 2) - (_p1 select 2));
while {(diag_tickTime - _start) < 3*60} do
{
_beacon = _signal createVehicle getPosATL _crate;
_beacon setPos (getPos _crate);
_beacon attachTo [_crate,[0,0,(_maxHeight + 0.05)]];
uiSleep 30;
deleteVehicle _beacon;
};
true
[_crate] call blck_fnc_signalEnd;

View File

@ -19,8 +19,7 @@ _start = diag_tickTime;
//diag_log format["signalEnd.sqf: _this = %1, _crate = %2",_this, _crate];
_smokeShell = selectRandom ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"];
_lightSource = selectRandom ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"];
while {diag_tickTime - _start < (_time)} do // loop for 5 min accounting for the fact that smoke grenades do not last very long
{
_light = objNull;
_smoke = _smokeShell createVehicle getPosATL _crate;
_smoke setPosATL (getPosATL _crate);
_smoke attachTo [_crate,[0,0,(0.5)]]; // put the smoke a fixed distance above the top of any object to make it as visible as possible
@ -30,12 +29,4 @@ while {diag_tickTime - _start < (_time)} do // loop for 5 min accounting for th
_light setPosATL (getPosATL _crate);
_light attachTo [_crate,[0,0,(0.55)]];
};
uiSleep 120;
detach _smoke;
deleteVehicle _smoke;
if(sunOrMoon < 0.2) then
{
detach _light;
deleteVehicle _light;
};
};
blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,diag_tickTime + 120, diag_tickTime + 300];

View File

@ -18,7 +18,7 @@ _crate setVariable ["LAST_CHECK", 100000];
_crate allowDamage false;
_crate enableRopeAttach false;
[_crate] call blck_fnc_emptyObject;
uiSleep 1;
//uiSleep 1;
_crate setPosATL [_coords select 0, _coords select 1, (_coords select 2) + 0.25];
_crate setDir _crateDir;
//_crate setVectorUp [0,0,1];

View File

@ -96,25 +96,10 @@ if (blck_debugLevel > 1) then
[(_x select 1),0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
if (isNull _empGroup) exitWith {_abort = true};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(82):: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x];
};
#endif
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [(_x select 0),[0,0,0],false,true] call blck_fnc_spawnVehicle;
private _wep = [(_x select 0),[0,0,0],false,true] call blck_fnc_spawnVehicle;
_wep addMPEventHandler ["MPHit",{[_this] call blck_EH_AIVehicle_HandleDamage}];
//_empGroup setVariable["groupVehicle",_wep];
_wep setVariable["vehicleGroup",_empGroup];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray (94) spawnVehicle returned value of _wep = %1",_wep];
};
#endif
_wep setVariable["GRG_vehType","emplaced"];
_wep setPos _pos;
_wep setdir (random 359);
@ -126,24 +111,7 @@ if (blck_debugLevel > 1) then
_gunner setVariable["GRG_vehType","emplaced"];
_gunner setVariable["GRG_vehicle",_wep];
_emplacedAI append _units;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(110):: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos];
diag_log format["_fnc_spawnEmplacedWeaponArray(111):: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
};
#endif
} forEach _missionEmplacedWeapons;
blck_monitoredVehicles append _emplacedWeps;
_return = [_emplacedWeps,_emplacedAI,_abort];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return];
};
#endif
_return

View File

@ -88,8 +88,9 @@ _fnc_dropMissionCrates = {
_location = getPos _x;
_blck_localMissionMarker = [format["crateMarker%1%2",_location select 0, _location select 1],_location,"","","ColorBlack",["mil_dot",[]]];
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
_markers pushBack _marker;
uiSleep 0.5;
//_markers pushBack _marker;
blck_temporaryMarkers pushBack [_marker,diag_tickTime + 300];
//uiSleep 0.5;
_curPosCrate = getPos _x;
_x setPos [_curPosCrate select 0, _curPosCrate select 1, 0.3];
//_x setVectorDirAndUp[[0,1,0],[0,0,1]];
@ -97,11 +98,11 @@ _fnc_dropMissionCrates = {
} forEach _crates;
};
uisleep 300;
//uisleep 300;
{
deleteMarker _x;
}forEach _markers
//{
//deleteMarker _x;
//}forEach _markers
};
if (_spawnCrateTiming in ["atMissionEndAir","atMissionStartAir"]) then

View File

@ -0,0 +1,87 @@
/*
calculate a reward player for AI Kills in crypto.
Code fragment adapted from VEMF
call as [_unit,_killer] call blck_fnc_handlePlayerUpdates;
Last modified 6/3/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";
params["_unit","_killer"];
private _player = _killer;
diag_log format["_fnc_handlePlayerUpdates: typeOf (vehicle _killer) = %2 | vehicle(_killer) isKindOf Man = %1",(vehicle _killer) isKindOf "Man",typeOf (vehicle _killer)];
diag_log format[" : uid _killer = %1 | netID _killer = %2 | netID vehicle(_killer) = %3",if(isPlayer _killer) then {getPlayerUID _killer} else {-1},netID _killer,netID (vehicle(_killer))];
private _killerType = _killer call BIS_fnc_objectType; // anObject call BIS_fnc_objectType
private _killerVehicleType = (vehicle _killer) call BIS_fnc_objectType;
diag_log format["_killerType = %1 | _killerVehicleType = %2",_killerType,_killerVehicleType];
if (_killerType select 0 isEqualTo "Vehicle") then
{
{
if (_x isEqualTo _killer) exitWith {_player = _x};
}forEach (crew (vehicle _killer));
diag_log format["_fnc_handlePlayerUpdates:[find crew slot of player] _killer = %1 | _player set to %2 | vehicle _player = %3",_killer,_player,vehicle _player];
};
private _playerType = _player call BIS_fnc_objectType;
diag_log format["(35)_fnc_handlePlayerUpdates: _playerType = %1 | _player set to %2 | vehicle _player = %3",_playerType,_player,vehicle _player];
private _lastkill = _player getVariable["blck_lastkill",diag_tickTime];
_player setVariable["blck_lastkill",diag_tickTime];
private _kills = (_player getVariable["blck_kills",0]) + 1;
if ((diag_tickTime - _lastkill) < 240) then
{
_player setVariable["blck_kills",_kills];
} else {
_player setVariable["blck_kills",0];
};
if (toLower(blck_modType) isEqualTo "epoch") then
{
#define maxReward 2500
private _distanceBonus = floor((_unit distance _player)/100);
private _killstreakBonus = 3 * (_player getVariable["blck_kills",0]);
private _reward = 25 + _distanceBonus + _killstreakBonus;
//if (_reward > maxReward) then {_reward = maxReward};
diag_log format["_fnc_handlePlayerUpdates (43): _killer = %1 | vehicle(_killer) = %2 | typeName _killer = %3",_player,vehicle _player, typeName _player];
[_player,_reward ] call blck_fnc_giveTakeCrypto;
if (blck_useKillScoreMessage) then
{
[["showScore",[_reward,"",_kills],""],[_player]] call blck_fnc_messageplayers;
};
};
if (toLower(blck_modType) isEqualTo "exile") then
{
private _distanceBonus = floor((_unit distance _player)/100);
private _killstreakBonus = 3 * (_player getVariable["blck_kills",0]);
private _respectGained = 25 + _distanceBonus + _killstreakBonus;
private _score = _player getVariable ["ExileScore", 0];
_score = _score + (_respectGained);
_player setVariable ["ExileScore", _score];
format["setAccountScore:%1:%2", _score,getPlayerUID _player] call ExileServer_system_database_query_fireAndForget;
private _newKillerFrags = _player getVariable ["ExileKills", 0];
_newKillerFrags = _newKillerFrags + 1;
_player setVariable ["ExileKills", _newKillerFrags];
format["addAccountKill:%1", getPlayerUID _player] call ExileServer_system_database_query_fireAndForget;
_player call ExileServer_object_player_sendStatsUpdate;
if (blck_useKillScoreMessage) then
{
[["showScore",[_respectGained,_distanceBonus,_kills]], [_player]] call blck_fnc_messageplayers;
};
};
if (blck_useKillMessages) then
{
private _weapon = currentWeapon _player;
_killstreakMsg = format[" %1X KILLSTREAK",_kills];
private["_message"];
if (blck_useKilledAIName) then
{
_message = format["[blck] %2: killed by %1 from %3m",name _player,name _unit,round(_unit distance _player)];
}else{
_message = format["[blck] %1 killed with %2 from %3 meters",name _player,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _player)];
};
_message =_message + _killstreakMsg;
[["aikilled",_message,"victory"],allPlayers] call blck_fnc_messageplayers;
};

View File

@ -16,7 +16,7 @@ private ["_obj"];
if !(_characterBuildingConfigs isEqualTo []) then
{
_obj = createVehicle[(_characterBuildingConfigs select 0),_center vectorAdd (_characterBuildingConfigs select 1),[],0,"CAN_COLLIDE"];
diag_log format["_fnc_placeCharacterInBuilding: _obj = %1",_obj];
//diag_log format["_fnc_placeCharacterInBuilding: _obj = %1",_obj];
_obj setDir (_characterBuildingConfigs select 2);
_obj allowDamage true;
_obj enableDynamicSimulation true;

View File

@ -14,17 +14,24 @@
// assumptions: this is always run on the server rgardless if th event is triggered on an HC or other client.
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"];
params["_unit","_killer"/*,"_instigator"*/];
if (_unit getVariable["blck_cleanupAt",-1] > 0) exitWith {};
params["_unit","_killer","_instigator"];
diag_log format["_fnc_processAIKill: _unit = %1 | _killer = %2 | _instigator = %3" ,_unit,_killer,_instigator];
if (_unit getVariable["blck_cleanupAt",-1] > 0) exitWith {}; // this is here so that the script is not accidently run more than once for each MPKilled occurrence.
_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer];
blck_deadAI pushback _unit;
_group = group _unit;
private _group = group _unit;
[_unit] joinSilent grpNull;
if (count(units _group) < 1) then
if (count(units _group) == 0) then
{
deleteGroup _group;
};
diag_log format[
"_fnc_processAIKill: _killer = %1 | vehicle _killer = %2 | typeOf (vehicle _killer = %3) | driver(vehicle _killer) = %4",
_killer,
vehicle _killer,
typeOf(vehicle _killer),
driver(vehicle _killer)
];
if !((vehicle _unit) isEqualTo _unit) then
{
@ -35,6 +42,7 @@ if !((vehicle _unit) isEqualTo _unit) then
diag_log format["_processAIKill: no units alive in vehicle %1 of type %2",_veh, typeOf _veh];
if (_veh getVariable["GRG_vehType","none"] isEqualTo "emplaced") then
{
diag_log format["_fnc_processAIKill: emplaced weapon %1 being handled",_veh];
[_veh] call GMS_fnc_handleEmptyStaticWeapon;
} else {
if (blck_killEmptyAIVehicles) then
@ -58,48 +66,28 @@ if !((vehicle _unit) isEqualTo _unit) then
};
};
if (blck_launcherCleanup) then {[_unit] call blck_fnc_removeLaunchers;};
if (blck_removeNVG) then {[_unit] call blck_fnc_removeNVG;};
if (blck_launcherCleanup) then {[_unit] call blck_fnc_removeLaunchers};
if (blck_removeNVG) then {[_unit] call blck_fnc_removeNVG};
if !(isPlayer _killer) exitWith {};
[_unit,_killer] call blck_fnc_alertGroupUnits;
[_killer] call blck_fnc_alertNearbyVehicles;
_wp = [_group, currentWaypoint _group];
if (vehicle _killer != _killer) then
{
[_unit, vehicle _killer] call GMS_fnc_revealVehicleToUnits;
};
private _wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
_isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills;
if !(_isLegal) exitWith {};
_lastkill = _killer getVariable["blck_lastkill",diag_tickTime];
_killer setVariable["blck_lastkill",diag_tickTime];
_kills = (_killer getVariable["blck_kills",0]) + 1;
if ((diag_tickTime - _lastkill) < 240) then
{
_killer setVariable["blck_kills",_kills];
} else {
_killer setVariable["blck_kills",0];
};
if (blck_useKillMessages) then
{
_weapon = currentWeapon _killer;
_killstreakMsg = format[" %1X KILLSTREAK",_kills];
if (blck_useKilledAIName) then
{
_message = format["[blck] %2: killed by %1 from %3m",name _killer,name _unit,round(_unit distance _killer)];
}else{
_message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)];
};
_message =_message + _killstreakMsg;
[["aikilled",_message,"victory"],allPlayers] call blck_fnc_messageplayers;
};
[_unit,_killer] call blck_fnc_rewardKiller;
if (blck_showCountAliveAI) then
{
{
[_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount;
} forEach blck_missionMarkers;
};
private _isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills;
diag_log format["_fnc_processAIKill: _isLegal = %1",_isLegal];
if !(_isLegal) exitWith {};
[_unit,_killer] call GMS_fnc_handlePlayerUpdates;

View File

@ -20,11 +20,10 @@
private["_missionType","_wasRunover","_launcher","_legal"];
params["_unit","_killer"];
_legal = true;
if (vehicle _killer == _killer) exitWith {true}; // Player not in vehicle, no further checks needed.
if (vehicle _killer == _killer) exitWith {true};
// Player not in vehicle, no further checks needed.
if (_killer == (driver (vehicle _killer))) then // If the killer is also the driver then the killer must have run the AI over
{
[_unit, vehicle _killer] call GMS_fnc_revealVehicleToUnits;
if(blck_RunGear && !((vehicle _killer) isKindOf "Air")) then // assume aircraft are too fragile to kill AI by moving close to ground
{
[_unit] call GMS_fnc_removeAllAIgear;
@ -38,14 +37,19 @@ if (_killer == (driver (vehicle _killer))) then // If the killer is also the dr
} else {
if ( blck_VK_GunnerDamage ) then
{
if ((typeOf vehicle _killer) in blck_forbidenVehicles || (currentWeapon _killer) in blck_forbidenVehicleGuns) then
if ((typeOf (vehicle _killer)) in blck_forbidenVehicles || (currentWeapon _killer) in blck_forbidenVehicleGuns) then
{
if (blck_VK_Gear) then {[_unit] call GMS_fnc_removeAllAIgear;};
[_unit, vehicle _killer] call GMS_fnc_revealVehicleToUnits;
[vehicle _killer] call GMS_fnc_applyVehicleDamagePenalty;
[_killer] call GMS_fnc_msgIED;
_legal = false;
diag_log format[
"_fnc_processIlleagalKills: _legal = %1 | (typeOf (vehicle _killer)) in blck_forbidenVehicles = %2 | (currentWeapon _killer) in blck_forbidenVehicleGuns) = %3",
_legal,(typeOf (vehicle _killer)) in blck_forbidenVehicles,
(currentWeapon _killer) in blck_forbidenVehicleGuns
];
};
};
};
diag_log format["_fnc_testForIllegalKills: _legal = %1",_legal];
_legal

View File

@ -2,7 +2,6 @@
AI Mission for Epoch Mod for Arma 3
By Ghostrider
Functions and global variables used by the mission system.
Last modified 3/20/17
--------------------------
License
@ -36,17 +35,13 @@ private _functions = [
["blck_fnc_deleteMarker","\q\addons\custom_server\Compiles\Functions\GMS_fnc_deleteMarker.sqf"],
["blck_fnc_updateMarkerAliveCount","\q\addons\custom_server\Compiles\Functions\GMS_fnc_updateMarkerAliveCount.sqf"],
["blck_fnc_addMoneyToObject","\q\addons\custom_server\Compiles\Functions\GMS_fnc_addMoneyToObject.sqf"],
["blck_fnc_spawnMissionEmplacedRelative","\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnMissionEmplacedRelative.sqf"],
["blck_fnc_spawnMissionLootBoxesRelative","\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnMissionLootBoxesRelative.sqf"],
["blck_fnc_spawnSingleObject","\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnSingleObject.sqf"],
//["blck_fnc_emptyObjectInventory","\q\addons\custom_server\Compiles\Functions\GMS_fnc_emptyObjectInventory.sqf"],
["blck_fnc_spawnMissionLandscapeRelative","\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnMissionLandscapeRelative.sqf"],
["blck_fnc_nearestPlayers","\q\addons\custom_server\Compiles\Functions\GMS_fnc_nearestPlayers.sqf"],
["GMS_fnc_msgIED","\q\addons\custom_server\Compiles\Functions\GMS_fnc_msgIED.sqf"],
["GMS_fnc_cleanupTemporaryMarkers","\q\addons\custom_server\Compiles\Functions\GMS_fnc_cleanupTemporaryMarkers.sqf"],
["GMS_fnc_updateCrateSignals","\q\addons\custom_server\Compiles\Functions\GMS_fnc_updateCrateSignals.sqf"],
// Player-related functions
["blck_fnc_rewardKiller","\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf"],
["GMS_fnc_handlePlayerUpdates","\q\addons\custom_server\Compiles\Units\GMS_fnc_handlePlayerUpdates.sqf"],
["blck_fnc_MessagePlayers","\q\addons\custom_server\Compiles\Functions\GMS_fnc_AIM.sqf"], // Send messages to players regarding Missions
// Mission-related functions
@ -159,10 +154,7 @@ private _functions = [
// HC support functions
["blck_fnc_HC_XferGroup","\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferGroup.sqf"],
//["blck_fnc_onPlayerDisconnected","\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf"],
//["blck_fnc_HC_monitor","\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf"],
["blck_fnc_HC_passToHCs","\q\addons\custom_server\Compiles\HC\GMS_fnc_passToHCs.sqf"],
//["blck_fnc_HC_getListConnected","\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf"],
["blck_fnc_HC_leastBurdened","\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf"],
["blck_fnc_HC_countGroupsAssigned","\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf"]
];
@ -177,6 +169,6 @@ blck_fnc_broadcastServerFPS = compileFinal preprocessFileLineNumbers "\q\addons
diag_log "blck_functions loaded using GRGserver settings ---- >>>> ";
#endif
onPlayerDisconnected {[_name,_owner] call blck_fnc_onPlayerDisconnected;};
//onPlayerDisconnected {[_name,_owner] call blck_fnc_onPlayerDisconnected;};

View File

@ -41,7 +41,8 @@ blck_deadAI = [];
blck_connectedHCs = [];
blck_missionMarkers = [];
blck_heliCrashSites = [];
blck_temporaryMarkers = [];
blck_illuminatedCrates = []; // [crate,duration,freq of replacement]
blck_mainThreadUpdateInterval = 60;
blck_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/";
diag_log "[blckeagls] Variables Loaded";

View File

@ -17,7 +17,7 @@
changing any of these variables may break the mission systemChat
*/
blck_locationBlackList = []; // Do not touch ...
blck_debugON = false; // Do not touch ...
blck_debugON = true; // Do not touch ...
blck_debugLevel = 0; // Do not touch ...
#ifdef blck_milServer
if (true) exitWith
@ -127,14 +127,16 @@
blck_RunGear = true; // When set to true, AI that have been run over will ve stripped of gear, and the vehicle will be given blck_RunGearDamage of damage.
blck_RunGearDamage = 0.2; // Damage applied to player vehicle for each AI run over
blck_VK_Gear = true; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage
blck_VK_Gear = false; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage
blck_VK_RunoverDamage = true; // when the AI was run over blck_RunGearDamage of damage will be applied to the killer's vehicle.
blck_VK_GunnerDamage = false; // when the AI was killed by a gunner on a vehicle that is is in the list of forbidden vehicles, blck_RunGearDamage of damage will be applied to the killer's vehicle each time an AI is killed with a vehicle's gun.
blck_forbidenVehicles = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"]; // Add any vehicles for which you wish to forbid vehicle kills
//blck_forbidenVehicles = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"]; // Add any vehicles for which you wish to forbid vehicle kills
blck_forbidenVehicles = [];
// For a listing of the guns mounted on various land vehicles see the following link: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Vehicle_Weapons
// HMG_M2 is mounted on the armed offroad that is spawned by Epoch
blck_forbidenVehicleGuns = ["LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"]; // Add any vehicles for which you wish to forbid vehicle kills, o
//blck_forbidenVehicleGuns = ["LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"]; // Add any vehicles for which you wish to forbid vehicle kills, o
blck_forbidenVehicleGuns = [];
///////////////////////////////
// MISC MISSION PARAMETERS

View File

@ -14,8 +14,8 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_pathBlue = "Blue";
//_missionListBlue = ["captive1"];
_missionListBlue = ["default","captive1","hostage1"/*,"default2"/*,"medicalCamp","redCamp","resupplyCamp"*/];
_missionListBlue = ["default"];
//_missionListBlue = ["default","captive1","hostage1"/*,"default2"/*,"medicalCamp","redCamp","resupplyCamp"*/];
_pathRed = "Red";
//_missionListRed = ["resupplyCamp"];

View File

@ -0,0 +1,16 @@
For V 6.90:
1. Sort out the issue with the handling of unit kills not separating killer from the killer's vehicle.
2. Test new unlock fix on HC
3. Write a claim vehicle function.
4. End of development most likely.
5. be sure AI do heal when wounded but not killed.
6. test that ai toss smoke when healing
7. Set up queue for markers needing to be deleted.
need to call something that quickly scans for markers that need to be deleted
need to push temp markers to the cue with delete times.
8. add a quick thing for refreshing flares on crates to replace all those uisleeps
do this in _signalEnd and _crateMarker
replace _crateMarker with calls to signalEnd.
9. Check that trader zones are detected properly in Exile.
Todo:
☐ Item

View File

@ -1,4 +1,4 @@
#define blck_buildNumber 170
#define blck_buildNumber 172
#define blck_versionNumber 6.90
#define blck_buildDate "5-13-19"