Replace forEach with Count

Use count where you do not need _forEachIndex variable, it's quicker
than forEach.
This commit is contained in:
icomrade
2014-05-27 15:37:57 -04:00
parent 91d246e64e
commit e54b9983dd
210 changed files with 890 additions and 890 deletions

View File

@@ -4,7 +4,7 @@ scriptName "Functions\arrays\fn_findNestedElement.sqf";
Author: Joris-Jan van 't Land
Description:
Function to find item in nested arrays and return a path to the first match.
Function to find item in nested arrays && return a path to the first match.
Example:
_array = [[1, 2], [3, 4]];
@@ -27,7 +27,7 @@ _found = false;
//Parameter checking.
if ((typeName _array) != (typeName [])) exitWith {debugLog "Log: [findNestedElement] Array (0) should be an Array!"};
//Find a value in an Array or one of its children.
//Find a value in an Array || one of its children.
private ["_searchArrayFunc"];
_searchArrayFunc =
{

View File

@@ -7,19 +7,19 @@
Parameter(s):
_this select 0: ARRAY - list of params
_this select 1: NUMBER - selected index
_this select 2 (Optional): ANY - default param (used when param is missing or of wrong type)
_this select 2 (Optional): ANY - default param (used when param is missing || of wrong type)
- you can overload default value by setting 'BIS_fnc_<functionName>_<index>'
_this select 3 (Optional): ARRAY - list of allowed type examples (e.g. ["",[],0,objnull])
_this select 4 (Optional): NUMBER - If value is ARRAY, checks if it has required number of elements
Returns:
ANY - either value from list of params, or default value
ANY - either value from list of params, || default value
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////
private ["_params","_id","_value","_thisCount"];
//disableserialization; //--- Do not put this here or none of the scripts where BIS_fnc_param is used will be serialized!
//disableserialization; //--- Do not put this here || none of the scripts where BIS_fnc_param is used will be serialized!
_thisCount = count _this;
//if (typename _this != typename []) then {_this = [_this]};

View File

@@ -10,7 +10,7 @@ Operand types:
<vector1>: array
<vector2>: array
Returns a vector that is the sum of <vector1> and <vector2>.
Returns a vector that is the sum of <vector1> && <vector2>.
************************************************************/

View File

@@ -20,7 +20,7 @@ _lootChance = getNumber (_config >> "lootChance");
//_countPositions = count _pos;
_qty = 0; // effective quantity of spawned weaponholder
_lootSpawnBias = 67; //67 between 50 and 100. The lower it is, the lower chance some of the lootpiles will spawn
_lootSpawnBias = 67; //67 between 50 && 100. The lower it is, the lower chance some of the lootpiles will spawn
// shuffles an array
@@ -75,7 +75,7 @@ _bias = (_bias + random(100 - _bias)) / 100;
};
};
};
} forEach _positions;
} count _positions;
// small loot
_posSmall = [] + getArray (_config >> "lootPosSmall");
@@ -114,4 +114,4 @@ _positionsSmall = _posSmall call _ShuffleArray;
};
};
};
} forEach _positionsSmall;
} count _positionsSmall;

View File

@@ -45,7 +45,7 @@ if (_canLoot) then {
[_iPos,true,_unitTypes] call zombie_generate;
};
};
} forEach _positions;
} count _positions;
} else {

View File

@@ -16,7 +16,7 @@ if (count _targets > 0) then {
_man = _x;
_manDis = (_x distance _dog);
};
} forEach _targets;
} count _targets;
_target = _man;
};
_target;

View File

@@ -43,7 +43,7 @@ if (_canAfford) then {
};
};
} forEach (magazines player);
} count (magazines player);
//diag_log format["DEBUG TRADER INPUT CURRENCY TOTAL: %1", _total_currency];

View File

@@ -5,7 +5,7 @@ scriptName "Functions\arrays\fn_selectRandomWeighted.sqf";
Description:
Function to select a random item from an array, taking into account item weights.
The weights should be Numbers between 0 and 1, with a maximum precision of hundreds.
The weights should be Numbers between 0 && 1, with a maximum precision of hundreds.
Parameter(s):
_this select 0: source Array (Array of Any Value)
@@ -40,9 +40,9 @@ for "_i" from 0 to ((count _weights) - 1) do
//If it's not, set weight to 0 to exclude it.
if ((typeName _weight) != (typeName 0)) then {diag_log "Log: [selectRandomWeighted] Weights should be Numbers; weight set to 0!"; _weight = 0};
//The weight should be a Number between 0 and 1.
if (_weight < 0) then {diag_log "Log: [selectRandomWeighted] Weights should be more than or equal to 0; weight set to 0!"; _weight = 0};
//if (_weight > 1) then {debugLog "Log: [selectRandomWeighted] Weights should be less than or equal to 1; weight set to 1!"; _weight = 1};
//The weight should be a Number between 0 && 1.
if (_weight < 0) then {diag_log "Log: [selectRandomWeighted] Weights should be more than || equal to 0; weight set to 0!"; _weight = 0};
//if (_weight > 1) then {debugLog "Log: [selectRandomWeighted] Weights should be less than || equal to 1; weight set to 1!"; _weight = 1};
//Normalize the weight for a precision of hundreds.
_weight = round(_weight * 100);

View File

@@ -1,10 +1,10 @@
/*
Description:
Checks whether the player has the required items (magazines) or not
and displays a message if an item is missing.
Checks whether the player has the required items (magazines) || not
&& displays a message if an item is missing.
Parameter(s):
_this: <array> list of item names the player is required to have (can also be an sub-array with item name and quantity)
_this: <array> list of item names the player is required to have (can also be an sub-array with item name && quantity)
Returns:
Boolean (true if the player has all required items)
@@ -41,5 +41,5 @@ _hasItems = true;
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
cutText [format[(localize "STR_EPOCH_ACTIONS_12"), _missingQty, _textMissing], "PLAIN DOWN"];
};
} forEach _items;
} count _items;
_hasItems

View File

@@ -29,7 +29,7 @@ if (_inVehicle) then {
r_player_lastSeat = _assignedRole;
if ((_vehicle isKindOf "helicopter") || (_inVehicle && ({(isPlayer _x) && (alive _x)} count (crew _vehicle) > 1))) then {
//allow switch to pilot
if (((_assignedRole select 0) != "driver") and ((!alive _driver) or ((_vehicle emptyPositions "Driver") > 0))) then {
if (((_assignedRole select 0) != "driver") && ((!alive _driver) || ((_vehicle emptyPositions "Driver") > 0))) then {
if (_vehicle isKindOf "helicopter") then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_308A", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToPilot",_driver], 0, false, true];
} else {
@@ -39,19 +39,19 @@ if (_inVehicle) then {
r_action2 = true;
};
//allow switch to cargo
if (((_assignedRole select 0) != "cargo") and ((_vehicle emptyPositions "Cargo") > 0)) then {
if (((_assignedRole select 0) != "cargo") && ((_vehicle emptyPositions "Cargo") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_309", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToCargo",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
//allow switch to gunner
if (((_assignedRole select 0) != "Turret") and ((_vehicle emptyPositions "Gunner") > 0)) then {
if (((_assignedRole select 0) != "Turret") && ((_vehicle emptyPositions "Gunner") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_310", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToTurret",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
//allow switch to commander
if (((assignedCommander _vehicle) != player) and ((_vehicle emptyPositions "Commander") > 0)) then {
if (((assignedCommander _vehicle) != player) && ((_vehicle emptyPositions "Commander") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_311", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToTurret",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
@@ -65,7 +65,7 @@ if (_inVehicle) then {
_action = _vehicle addAction [format["Add AMMO to %1",_weaponName], "\z\addons\dayz_code\actions\ammo.sqf",[_vehicle,_x,_turret], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
} forEach _weapons;
} count _weapons;
};
};
} else {
@@ -74,7 +74,7 @@ if (_inVehicle) then {
r_player_lastSeat = [];
};
if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unconscious and _isClose) then {
if (!isNull _menClose && _hasPatient && !r_drag_sqf && !r_action && !_inVehicle && !r_player_unconscious && _isClose) then {
_unit = cursorTarget;
_isDisallowRefuel = typeOf _unit in ["M240Nest_DZ"];
// player reveal _unit;
@@ -110,12 +110,12 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
r_player_actions = r_player_actions + [_action1,_action2];
};
//Load Vehicle
if (_hasVehicle and _unconscious) then {
if (_hasVehicle && _unconscious) then {
_x = 0;
r_action = true;
_unit = _unit;
_vehicle = (_vehClose select _x);
while{((!alive _vehicle) and (_x < (count _vehClose)))} do {
while{((!alive _vehicle) && (_x < (count _vehClose)))} do {
_x = _x + 1;
_vehicle = (_vehClose select _x);
};
@@ -124,49 +124,49 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
r_player_actions set [count r_player_actions,_action];
};
//Allow player to bandage
if(_injured and _hasBandage) then {
if(_injured && _hasBandage) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Epinephrine
if(_unconscious and _hasEpi) then {
if(_unconscious && _hasEpi) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_05", "\z\addons\dayz_code\medical\epinephrine.sqf",[_unit], 0, true, true];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Morphine
if((_legsBroke or _armsBroke) and _hasMorphine) then {
if((_legsBroke || _armsBroke) && _hasMorphine) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\morphine.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Painkillers
if(_inPain and _hasPainkillers) then {
if(_inPain && _hasPainkillers) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_07", "\z\addons\dayz_code\medical\painkiller.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to transfuse blood
if(_lowBlood and _hasBlood) then {
if(_lowBlood && _hasBlood) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_08", "\z\addons\dayz_code\medical\transfusion.sqf",[_unit], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//Repairs
if ((_unit isKindOf "AllVehicles") and !(_unit isKindOf "Man") and !_isDisallowRefuel) then {
if ((_unit isKindOf "AllVehicles") && !(_unit isKindOf "Man") && !_isDisallowRefuel) then {
_type = TypeOf(_unit);
_typeVeh = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
//CAN WE REFUEL THE OBJECT?
if ((fuel _unit < 1) and (_hasJerry or _hasBarrel)) then {
if ((fuel _unit < 1) && (_hasJerry || _hasBarrel)) then {
r_action = true;
_action = _unit addAction [format[localize "str_actions_medical_10",_typeVeh], "\z\addons\dayz_code\actions\refuel.sqf",[], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
};
//CAN WE siphon fuel from THE OBJECT?
if ((fuel _unit > 0) and (_hasJerryE or _hasBarrelE)) then {
if ((fuel _unit > 0) && (_hasJerryE || _hasBarrelE)) then {
r_action = true;
_action = _unit addAction [format["Siphon fuel from %1",_typeVeh], "\z\addons\dayz_code\actions\siphonFuel.sqf",[], 0, true, true, "", ""];
r_player_actions set [count r_player_actions,_action];
@@ -174,8 +174,8 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
} else {
// should only fire if cursor target is man and not vehicle
if ((isPlayer _unit) and !(_charID in _friendlies)) then {
// should only fire if cursor target is man && not vehicle
if ((isPlayer _unit) && !(_charID in _friendlies)) then {
r_action = true;
_action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true, "", ""];
r_player_actions set [count r_player_actions,_action];
@@ -188,7 +188,7 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
};
/*
if ((r_player_vehicle != _vehicle) and r_action) then {
if ((r_player_vehicle != _vehicle) && r_action) then {
//Player is in a new vehicle
r_action = false;
call fnc_usec_medic_removeActions;
@@ -204,7 +204,7 @@ if (_inVehicle) then {
if (_x getVariable "NORRN_unconscious") then {
_unconscious_crew = _unconscious_crew + [_x]
};
} forEach _crew;
} count _crew;
_patients = (count _unconscious_crew);
if (_patients > 0) then {
if (!r_action_unload) then {
@@ -229,13 +229,13 @@ if (_inVehicle) then {
};
//Remove Actions
if ((!_isClose or !_hasPatient) and r_action) then {
if ((!_isClose || !_hasPatient) && r_action) then {
call fnc_usec_medic_removeActions;
r_action = false;
};
//Pain Effects
//if (r_player_inpain and !r_player_unconscious) then {
//if (r_player_inpain && !r_player_unconscious) then {
// playSound "breath_1";
// addCamShake [2, 1, 25];
//};

View File

@@ -26,7 +26,7 @@ _unitIsPlayer = _unit == player;
if (_unitIsPlayer) then {
if (_hit == "") then {
if ((_source != player) and _isPlayer) then {
if ((_source != player) && _isPlayer) then {
//Enable aggressor Actions
if (_source isKindOf "CAManBase") then {
_source setVariable["startcombattimer",1];
@@ -35,7 +35,7 @@ if (_unitIsPlayer) then {
_isBandit = (player getVariable["humanity",0]) <= -5000;
_isPZombie = player isKindOf "PZombie_VB";
if (!_canHitFree and !_isBandit and !_isPZombie) then {
if (!_canHitFree && !_isBandit && !_isPZombie) then {
//Process Morality Hit
_myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5);
_humanityHit = -100 * _myKills * _damage;
@@ -64,7 +64,7 @@ if (_damage > 0.4) then {
if (_isHeadHit) then {
_scale = _scale + 500;
};
if ((isPlayer _source) and !(player == _source)) then {
if ((isPlayer _source) && !(player == _source)) then {
_scale = _scale + 800;
if (_isHeadHit) then {
_scale = _scale + 500;
@@ -126,7 +126,7 @@ if (_damage > 0.4) then { //0.25
_rndPain = (random 10);
_rndInfection = (random 500);
_hitPain = (_rndPain < _damage);
if ((_isHeadHit) or (_damage > 1.2 and _hitPain)) then {
if ((_isHeadHit) || (_damage > 1.2 && _hitPain)) then {
_hitPain = true;
};
_hitInfection = (_rndInfection < 1);
@@ -139,7 +139,7 @@ if (_damage > 0.4) then { //0.25
};
if (_hitInfection) then {
//Set Infection if not already
if (_unitIsPlayer and !_isPZombie) then {
if (_unitIsPlayer && !_isPZombie) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
@@ -152,7 +152,7 @@ if (_damage > 0.4) then { //0.25
player setVariable["USEC_inPain",true,true];
};
};
if ((_damage > 1.5) and _isHeadHit) then {
if ((_damage > 1.5) && _isHeadHit) then {
[_source,"shothead"] spawn player_death;
};
};
@@ -168,17 +168,17 @@ if (_damage > 0.4) then { //0.25
_inRange = _pos nearEntities ["CAManBase",1000];
{
// only send to other players
if(isPlayer _x and _x != player) then {
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"Bleed",[_unit,_wound,_hit]];
publicVariableServer "PVDZE_send";
};
} forEach _inRange;
} count _inRange;
//Set Injured if not already
_isInjured = _unit getVariable["USEC_injured",false];
if (!_isInjured) then {
_unit setVariable["USEC_injured",true,true];
if ((_unitIsPlayer) and (_ammo != "zombie")) then {
if ((_unitIsPlayer) && (_ammo != "zombie")) then {
dayz_sourceBleeding = _source;
};
};
@@ -197,7 +197,7 @@ if (_type == 1) then {
/*
BALISTIC DAMAGE
*/
if ((_damage > 0.01) and (_unitIsPlayer)) then {
if ((_damage > 0.01) && (_unitIsPlayer)) then {
//affect the player
[20,45] call fnc_usec_pitchWhine; //Visual , Sound
};
@@ -236,7 +236,7 @@ if (_type == 2) then {
};
};
if (!_unconscious and !_isMinor and ((_damage > 2) or ((_damage > 0.5) and _isHeadHit))) then {
if (!_unconscious && !_isMinor && ((_damage > 2) || ((_damage > 0.5) && _isHeadHit))) then {
//set unconsious
[_unit,_damage] call fnc_usec_damageUnconscious;
};

View File

@@ -11,7 +11,7 @@ _projectile = _this select 4;
if (local _zed) then {
if (_damage > 1 and _projectile != "") then {
if (_damage > 1 && _projectile != "") then {
//Record deliberate critical damages
switch (_selection) do {
case "head_hit": {

View File

@@ -12,9 +12,9 @@ _isOk = false;
if(!_isOk) then {
_isOk = _cTarget isKindOf _x;
};
} forEach ["LandVehicle","Air", "Ship"];
} count ["LandVehicle","Air", "Ship"];
if((locked _cTarget) and _isOk and (((vehicle player) distance _cTarget) < 12)) then {
if((locked _cTarget) && _isOk && (((vehicle player) distance _cTarget) < 12)) then {
cutText [(localize "str_epoch_player_7") , "PLAIN DOWN"];
_display closeDisplay 1;
};

View File

@@ -1,7 +1,7 @@
/*
Description:
Checks whether the player has the required tools equipped or not
and displays a message if a tool is missing from the tool belt.
Checks whether the player has the required tools equipped || not
&& displays a message if a tool is missing from the tool belt.
Parameter(s):
_this: <array> list of tool names the player is required to have
@@ -22,5 +22,5 @@ _hasTools = true;
_missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
cutText [format[(localize "STR_EPOCH_ACTIONS_13"), _missing] , "PLAIN DOWN"];
};
} forEach _tools;
} count _tools;
_hasTools

View File

@@ -6,7 +6,7 @@
//
/*
Returns true if <position> lies within the sector defined by <center position>,
<center angle of sector> and <sector width>. Use this function to determine if
<center angle of sector> && <sector width>. Use this function to determine if
a position lies within a certain angle from another position (ie the <center position>).
Example:
[position player,getdir player,30,position enemy_tank] call BIS_fnc_inAngleSector

View File

@@ -24,9 +24,9 @@ _myZ = _relPos select 2;
//diag_log ("Y: " + str(_myY) );
//diag_log ("Z: " + str(_myZ) );
if ((_myX > (_min select 0)) and (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) and (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) and (_myZ < (_max select 2))) then {
if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then {
_inside = true;
} else { _inside = false; };
} else { _inside = false; };

View File

@@ -23,9 +23,9 @@ _myZ = _relPos select 2;
//diag_log ("Y: " + str(_myY) );
//diag_log ("Z: " + str(_myZ) );
if ((_myX > (_min select 0)) and (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) and (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) and (_myZ < (_max select 2))) then {
if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then {
_inside = true;
} else { _inside = false; };
} else { _inside = false; };

View File

@@ -23,9 +23,9 @@ _myZ = _relPos select 2;
//diag_log ("Y: " + str(_myY) );
//diag_log ("Z: " + str(_myZ) );
if ((_myX > (_min select 0)) and (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) and (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) and (_myZ < (_max select 2))) then {
if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then {
if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then {
if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then {
_inside = true;
} else { _inside = false; };
} else { _inside = false; };

View File

@@ -23,7 +23,7 @@ _lights = ["a_fuelstation_sign.p3d","lampa_ind_zebr.p3d","lampa_ind.p3d","lampa_
};
};
};
} foreach nearestObjects [([_target] call FNC_getPos), [], _rng];
} count nearestObjects [([_target] call FNC_getPos), [], _rng];
};
@@ -101,7 +101,7 @@ _nrTLs= _twrPos nearObjects ["#lightpoint",20];
deleteVehicle _x;
};
sleep .2;
}forEach _nrTLs;
}count _nrTLs;
}else{
//axeDiagLog = format["FN:TL NEW LPS:%1",_twr];

View File

@@ -1,10 +1,10 @@
/*
Description:
Removes the items (magazines) from the player's inventory
and performs a double check for the required items.
&& performs a double check for the required items.
Parameter(s):
_this: <array> list of item names to be removed (can also be an sub-array with item name and quantity)
_this: <array> list of item names to be removed (can also be an sub-array with item name && quantity)
Returns:
Boolean (true if all items have been removed from the player's inventory)
@@ -43,12 +43,12 @@ _tobe_removed_total = 0;
_temp_removed_array set [count _temp_removed_array, _x];
};
};
} forEach _inventory;
} count _inventory;
};
} forEach _items;
} count _items;
// all parts removed
if (_tobe_removed_total == _removed_total) exitWith { true };
// missing parts
{ player addMagazine _x; } forEach _temp_removed_array;
{ player addMagazine _x; } count _temp_removed_array;
cutText [format[(localize "STR_EPOCH_ACTIONS_5"), _removed_total, _tobe_removed_total], "PLAIN DOWN"];
false

View File

@@ -5,7 +5,7 @@ scriptName "Functions\arrays\fn_selectRandomWeighted.sqf";
Description:
Function to select a random item from an array, taking into account item weights.
The weights should be Numbers between 0 and 1, with a maximum precision of hundreds.
The weights should be Numbers between 0 && 1, with a maximum precision of hundreds.
Parameter(s):
_this select 0: source Array (Array of Any Value)
@@ -39,9 +39,9 @@ for "_i" from 0 to ((count _weights) - 1) do
//If it's not, set weight to 0 to exclude it.
if ((typeName _weight) != (typeName 0)) then {debugLog "Log: [selectRandomWeighted] Weights should be Numbers; weight set to 0!"; _weight = 0};
//The weight should be a Number between 0 and 1.
if (_weight < 0) then {debugLog "Log: [selectRandomWeighted] Weights should be more than or equal to 0; weight set to 0!"; _weight = 0};
//if (_weight > 1) then {debugLog "Log: [selectRandomWeighted] Weights should be less than or equal to 1; weight set to 1!"; _weight = 1};
//The weight should be a Number between 0 && 1.
if (_weight < 0) then {debugLog "Log: [selectRandomWeighted] Weights should be more than || equal to 0; weight set to 0!"; _weight = 0};
//if (_weight > 1) then {debugLog "Log: [selectRandomWeighted] Weights should be less than || equal to 1; weight set to 1!"; _weight = 1};
//Normalize the weight for a precision of hundreds.
_weight = round(_weight * 100);
@@ -52,7 +52,7 @@ for "_i" from 0 to ((count _weights) - 1) do
};
};
//Randomly select an index from the weighted array and therefore an element.
//Randomly select an index from the weighted array && therefore an element.
private ["_index"];
_index = _weighted call BIS_fnc_selectRandom;

View File

@@ -13,7 +13,7 @@ _isPZombie = player isKindOf "PZombie_VB";
_inVehicle = (_vehicle != player);
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
_nearLight = nearestObject [player,"LitObject"];
_canPickLight = false;
@@ -24,7 +24,7 @@ if (!isNull _nearLight) then {
};
//Grab Flare
if (_canPickLight and !dayz_hasLight and !_isPZombie) then {
if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
if (s_player_grabflare < 0) then {
_text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
@@ -39,7 +39,7 @@ if (_canPickLight and !dayz_hasLight and !_isPZombie) then {
if (DZE_HeliLift) then {
_hasAttached = _vehicle getVariable["hasAttached",false];
if(_inVehicle and (_vehicle isKindOf "Air") and ((([_vehicle] call FNC_getPos) select 2) < 30) and (speed _vehicle < 5) and (typeName _hasAttached == "OBJECT")) then {
if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
if (s_player_heli_detach < 0) then {
dayz_myLiftVehicle = _vehicle;
s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
@@ -51,7 +51,7 @@ if (DZE_HeliLift) then {
};
if(DZE_HaloJump) then {
if(_inVehicle and (_vehicle isKindOf "Air") and ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
if (s_halo_action < 0) then {
DZE_myHaloVehicle = _vehicle;
s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
@@ -63,7 +63,7 @@ if(DZE_HaloJump) then {
};
if (!DZE_ForceNameTagsOff) then {
if (s_player_showname < 0 and !_isPZombie) then {
if (s_player_showname < 0 && !_isPZombie) then {
if (DZE_ForceNameTags) then {
s_player_showname = 1;
player setVariable["DZE_display_name",true,true];
@@ -85,13 +85,13 @@ if(_isPZombie) then {
if (s_player_pzombiesvision < 0) then {
s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
};
if (!isNull cursorTarget and (player distance cursorTarget < 3)) then { //Has some kind of target
if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
_isAnimal = cursorTarget isKindOf "Animal";
_isZombie = cursorTarget isKindOf "zZombie_base";
_isHarvested = cursorTarget getVariable["meatHarvested",false];
_isMan = cursorTarget isKindOf "Man";
// Pzombie Gut human corpse or animal
if (!alive cursorTarget and (_isAnimal or _isMan) and !_isZombie and !_isHarvested) then {
// Pzombie Gut human corpse || animal
if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
if (s_player_pzombiesfeed < 0) then {
s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
};
@@ -105,15 +105,15 @@ if(_isPZombie) then {
};
};
// Increase distance only if AIR OR SHIP
// Increase distance only if AIR || SHIP
_allowedDistance = 4;
_isAir = cursorTarget isKindOf "Air";
_isShip = cursorTarget isKindOf "Ship";
if(_isAir or _isShip) then {
if(_isAir || _isShip) then {
_allowedDistance = 8;
};
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then { //Has some kind of target
if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
// set cursortarget to variable
_cursorTarget = cursorTarget;
@@ -127,7 +127,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
_isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
// get items and magazines only once
// get items && magazines only once
_magazinesPlayer = magazines player;
//boiled Water
@@ -137,7 +137,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if (_x in _magazinesPlayer) then {
_hastinitem = true;
};
} forEach boil_tin_cans;
} count boil_tin_cans;
_hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
_hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
_hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
@@ -155,7 +155,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_temp_keys_names set [_ownerKeyId,_ownerKeyName];
_temp_keys set [count _temp_keys,str(_ownerKeyId)];
};
} forEach _itemsPlayer;
} count _itemsPlayer;
_hasKnife = "ItemKnife" in _itemsPlayer;
_hasToolbox = "ItemToolbox" in _itemsPlayer;
@@ -187,13 +187,13 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if (_x in _magazinesPlayer) then {
_hasRawMeat = true;
};
} forEach _rawmeat;
} count _rawmeat;
_isFuel = false;
if (_hasFuelE or _hasFuelBarrelE) then {
if (_hasFuelE || _hasFuelBarrelE) then {
{
if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
} forEach dayz_fuelsources;
} count dayz_fuelsources;
};
// diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
@@ -219,37 +219,37 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if(_isAlive) then {
//Allow player to delete objects
if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding) then {
if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
//Allow owners to delete modulars
if(_isModular and (dayz_characterID == _ownerID)) then {
if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
if(_isModular && (dayz_characterID == _ownerID)) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
//Allow owners to delete modular doors without locks
if(_isModularDoor and (dayz_characterID == _ownerID)) then {
if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
if(_isModularDoor && (dayz_characterID == _ownerID)) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
// CURSOR TARGET VEHICLE
if(_isVehicle) then {
//flip vehicle small vehicles by your self and all other vehicles with help nearby
if (!(canmove _cursorTarget) and (player distance _cursorTarget >= 2) and (count (crew _cursorTarget))== 0 and ((vectorUp _cursorTarget) select 2) < 0.5) then {
//flip vehicle small vehicles by your self && all other vehicles with help nearby
if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
_playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
if(_isVehicletype or (_playersNear >= 2)) then {
if(_isVehicletype || (_playersNear >= 2)) then {
_player_flipveh = true;
};
};
if(!_isMan and _ownerID != "0" and !(_cursorTarget isKindOf "Bicycle")) then {
if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
_player_lockUnlock_crtl = true;
};
@@ -276,7 +276,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if(!_allowTow) then {
_allowTow = _cursorTarget isKindOf _x;
};
} forEach DZE_HeliAllowToTow;
} count DZE_HeliAllowToTow;
};
//diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];
@@ -289,20 +289,20 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_posC = [_cursorTarget] call FNC_getPos;
_height = (_posL select 2) - (_posC select 2);
_hasAttached = _x getVariable["hasAttached",false];
if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then {
if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
_liftHeli = _x;
_found = true;
};
};
};
} forEach _liftHelis;
} count _liftHelis;
};
//diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];
_attached = _cursorTarget getVariable["attached",false];
if(_found and _allowTow and _canDo and !locked _cursorTarget and !_isPZombie and (typeName _attached != "OBJECT")) then {
if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
if (s_player_heli_lift < 0) then {
s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
};
@@ -312,13 +312,13 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
};
// Allow Owner to lock and unlock vehicle
// Allow Owner to lock && unlock vehicle
if(_player_lockUnlock_crtl) then {
if (s_player_lockUnlock_crtl < 0) then {
_hasKey = _ownerID in _temp_keys;
_oldOwner = (_ownerID == dayz_playerUID);
if(locked _cursorTarget) then {
if(_hasKey or _oldOwner) then {
if(_hasKey || _oldOwner) then {
_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockUnlock_crtl = 1;
@@ -332,7 +332,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
s_player_lockUnlock_crtl = 1;
};
} else {
if(_hasKey or _oldOwner) then {
if(_hasKey || _oldOwner) then {
_lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_lock];
s_player_lockUnlock_crtl = 1;
@@ -341,13 +341,13 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
} else {
{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
s_player_lockUnlock_crtl = -1;
};
if(DZE_AllowForceSave) then {
//Allow player to force save
if((_isVehicle or _isTent) and !_isMan) then {
if((_isVehicle || _isTent) && !_isMan) then {
if (s_player_forceSave < 0) then {
s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
};
@@ -360,7 +360,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
If(DZE_AllowCargoCheck) then {
if((_isVehicle or _isTent or _isnewstorage) and _isAlive and !_isMan and !locked _cursorTarget) then {
if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
if (s_player_checkGear < 0) then {
s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
};
@@ -371,7 +371,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//flip vehicle small vehicles by your self and all other vehicles with help nearby
//flip vehicle small vehicles by your self && all other vehicles with help nearby
if(_player_flipveh) then {
if (s_player_flipveh < 0) then {
s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
@@ -382,7 +382,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Allow player to fill jerrycan
if((_hasFuelE or _hasFuelBarrelE) and _isFuel) then {
if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
if (s_player_fillfuel < 0) then {
s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
};
@@ -400,7 +400,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if (!_isAlive) then {
// Gut animal/zed
if((_isAnimal or _isZombie) and _hasKnife) then {
if((_isAnimal || _isZombie) && _hasKnife) then {
_isHarvested = _cursorTarget getVariable["meatHarvested",false];
if (!_isHarvested) then {
_player_butcher = true;
@@ -408,14 +408,14 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// Study body
if (_isMan and !_isZombie and !_isAnimal) then {
if (_isMan && !_isZombie && !_isAnimal) then {
_player_studybody = true;
}
} else {
// unit alive
// gear access on surrendered player
if(_isMan and !_isZombie and !_isAnimal) then {
if(_isMan && !_isZombie && !_isAnimal) then {
_isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
if (_isSurrendered) then {
_player_SurrenderedGear = true;
@@ -424,7 +424,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// Human Gut animal or zombie
// Human Gut animal || zombie
if (_player_butcher) then {
if (s_player_butcher < 0) then {
if(_isZombie) then {
@@ -461,7 +461,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// Boil water
if (_hasbottleitem and _hastinitem) then {
if (_hasbottleitem && _hastinitem) then {
_player_boil = true;
};
};
@@ -496,7 +496,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
if(_cursorTarget == dayz_hasFire) then {
if ((s_player_fireout < 0) and !(inflamed _cursorTarget) and (player distance _cursorTarget < 3)) then {
if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
@@ -505,13 +505,13 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Packing my tent
if(_isTent and (player distance _cursorTarget < 3)) then {
if(_isTent && (player distance _cursorTarget < 3)) then {
if (_ownerID == dayz_characterID) then {
if (s_player_packtent < 0) then {
s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
if(("ItemJerrycan" in _magazinesPlayer) and ("ItemMatchbox_DZE" in weapons player)) then {
if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
if (s_player_packtent < 0) then {
s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
};
@@ -523,10 +523,10 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Allow owner to unlock vault
if((_typeOfCursorTarget in DZE_LockableStorage) and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
if (s_player_unlockvault < 0) then {
if(_typeOfCursorTarget in DZE_LockedStorage) then {
if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
s_player_combi set [count s_player_combi,_combi];
} else {
@@ -535,7 +535,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
s_player_unlockvault = 1;
} else {
if(_ownerID != dayz_combination and _ownerID != dayz_playerUID) then {
if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
_combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
s_player_combi set [count s_player_combi,_combi];
s_player_unlockvault = 1;
@@ -543,19 +543,19 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
};
} else {
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
{player removeAction _x} count s_player_combi;s_player_combi = [];
s_player_unlockvault = -1;
};
//Allow owner to pack vault
if(_typeOfCursorTarget in DZE_UnLockedStorage and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
if (s_player_lockvault < 0) then {
if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
};
};
if (s_player_packvault < 0 and (_ownerID == dayz_combination or _ownerID == dayz_playerUID)) then {
if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
@@ -585,10 +585,10 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
_findNearestGen = [];
{
if (alive _x and (_x getVariable ["GeneratorRunning", false])) then {
if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
_findNearestGen set [(count _findNearestGen),_x];
};
} foreach _findNearestGens;
} count _findNearestGens;
_IsNearRunningGen = count (_findNearestGen);
// show that pump needs power if no generator nearby.
@@ -604,7 +604,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Fuel Pump on truck
if(_typeOfCursorTarget in DZE_fueltruckarray and alive _cursorTarget) then {
if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
if (s_player_fuelauto2 < 0) then {
// show that fuel truck pump needs power.
if(isEngineOn _cursorTarget) then {
@@ -619,7 +619,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// inplace upgrade tool
if ((_cursorTarget isKindOf "ModularItems") or (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") or (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
if ((s_player_lastTarget select 0) != _cursorTarget) then {
if (s_player_upgrade_build > 0) then {
player removeAction s_player_upgrade_build;
@@ -637,7 +637,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// downgrade system
if((_isDestructable or _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" or _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") and (DZE_Lock_Door == _ownerID)) then {
if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
if ((s_player_lastTarget select 1) != _cursorTarget) then {
if (s_player_downgrade_build > 0) then {
player removeAction s_player_downgrade_build;
@@ -655,7 +655,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
// inplace maintenance tool
if((_cursorTarget isKindOf "ModularItems" or _cursorTarget isKindOf "DZE_Housebase" or _typeOfCursorTarget == "LightPole_DZ") and (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
if ((s_player_lastTarget select 2) != _cursorTarget) then {
if (s_player_maint_build > 0) then {
player removeAction s_player_maint_build;
@@ -681,7 +681,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
} else {
// check if not filled and player has jerry.
// check if not filled && player has jerry.
if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
} else {
@@ -714,8 +714,8 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
//Sleep
if(_isTent and _ownerID == dayz_characterID) then {
if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
if(_isTent && _ownerID == dayz_characterID) then {
if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
@@ -724,7 +724,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
//Repairing Vehicles
if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then {
if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
if (s_player_repair_crtl < 0) then {
dayz_myCursorTarget = _cursorTarget;
_menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
@@ -733,13 +733,13 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
s_player_repairActions set [count s_player_repairActions,_menu1];
s_player_repair_crtl = 1;
} else {
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
s_player_repair_crtl = -1;
};
};
// All Traders
if (_isMan and !_isPZombie and _traderType in serverTraders) then {
if (_isMan && !_isPZombie && _traderType in serverTraders) then {
if (s_player_parts_crtl < 0) then {
@@ -772,7 +772,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];
s_player_parts set [count s_player_parts,_buy];
} forEach (_traderMenu select 1);
} count (_traderMenu select 1);
// Database menu
_buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];
@@ -782,7 +782,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
};
} else {
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
{player removeAction _x} count s_player_parts;s_player_parts = [];
s_player_parts_crtl = -1;
};
@@ -790,7 +790,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
if(dayz_tameDogs) then {
//Dog
if (_isDog and _isAlive and (_hasRawMeat) and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
if (s_player_tamedog < 0) then {
s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
};
@@ -798,12 +798,12 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
player removeAction s_player_tamedog;
s_player_tamedog = -1;
};
if (_isDog and _ownerID == dayz_characterID and _isAlive) then {
if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
_dogHandle = player getVariable ["dogID", 0];
if (s_player_feeddog < 0 and _hasRawMeat) then {
if (s_player_feeddog < 0 && _hasRawMeat) then {
s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
};
if (s_player_waterdog < 0 and "ItemWaterbottle" in _magazinesPlayer) then {
if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
};
if (s_player_staydog < 0) then {
@@ -845,18 +845,18 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
} else {
//Engineering
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
s_player_repair_crtl = -1;
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
{player removeAction _x} count s_player_combi;s_player_combi = [];
dayz_myCursorTarget = objNull;
s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
{player removeAction _x} count s_player_parts;s_player_parts = [];
s_player_parts_crtl = -1;
{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
s_player_lockUnlock_crtl = -1;
player removeAction s_player_checkGear;
@@ -940,7 +940,7 @@ if (_dogHandle > 0) then {
_dog = _dogHandle getFSMVariable "_dog";
_ownerID = "0";
if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
if (_canDo and !_inVehicle and alive _dog and _ownerID != dayz_characterID) then {
if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
if (s_player_movedog < 0) then {
s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
};

View File

@@ -1,18 +1,18 @@
/************************************************************
Set Pitch and Bank
By General Barron ([EMAIL=aw_barron@hotmail.com]aw_barron@hotmail.com[/EMAIL]) and vektorboson
Set Pitch && Bank
By General Barron ([EMAIL=aw_barron@hotmail.com]aw_barron@hotmail.com[/EMAIL]) && vektorboson
Parameters: [object, pitch, bank]
Returns: nothing
Rotates an object, giving it the specified pitch and bank,
Rotates an object, giving it the specified pitch && bank,
in degrees.
Pitch is 0 when the object is level; 90 when pointing straight
up; and -90 when pointing straight down.
up; && -90 when pointing straight down.
Bank is 0 when level; 90 when the object is rolled to the right,
-90 when rolled to the left, and 180 when rolled upside down.
-90 when rolled to the left, && 180 when rolled upside down.
Note that the object's yaw can be set with the setdir command,
which should be issued before using this function, if required.
@@ -83,7 +83,7 @@ _yaw = 360-(getdir _obj);
//use bank to flip upside down
_bank = _bank + 180;
//and adjust our original pitch
//&& adjust our original pitch
_pitch = (180 - abs _pitch)*_sign;
};

View File

@@ -27,7 +27,7 @@ Missing:
//All Values can be seen as x of 100: 100 / x = minutes from min temperetaure to max temperature (without other effects)
_vehicle_factor = 4;
_moving_factor = 7;
_fire_factor = 15; //Should be always: _rain_factor + _night_factor + _wind_factor OR higher !
_fire_factor = 15; //Should be always: _rain_factor + _night_factor + _wind_factor || higher !
_building_factor = 7;
_sun_factor = 4; //max sunfactor linear over the day. highest value in the middle of the day
@@ -72,7 +72,7 @@ Missing:
_building = nearestObject [player, "HouseBase"];
if(!isNull _building) then {
if([player,_building] call fnc_isInsideBuilding) then {
//Make sure thate Fire and Building Effect can only appear single Not used at the moment
//Make sure thate Fire && Building Effect can only appear single Not used at the moment
//if(!_hasfireffect && _fire_factor > _building_factor) then {
_difference = _difference + _building_factor;
//};
@@ -106,7 +106,7 @@ Missing:
t = -(f / (12 - s)<29>) * (d - 12)<29> + f
Parabel with highest Point( greatest Effect == _sun_factor) always at 12.00
Zero Points are always at sunrise and sunset -> Only Positiv Values Possible
Zero Points are always at sunrise && sunset -> Only Positiv Values Possible
*/
_difference = _difference + (-((_sun_factor / (12 - _sunrise)^2)) * ((daytime - 12)^2) + _sun_factor);

View File

@@ -1,6 +1,6 @@
private ["_nul","_timeout","_isOnDeck","_isInLocation","_inVehicle","_bloodLow","_isHospital","_totalTimeout","_display","_ctrl1","_ctrl1Pos"];
disableSerialization;
if ((!r_player_handler1) and (r_handlerCount == 0)) then {
if ((!r_player_handler1) && (r_handlerCount == 0)) then {
//Unconscious Meter
_totalTimeout = r_player_timeout;
if (_totalTimeout == 0) then { _totalTimeout = 1; }; //Fix for zero divisor
@@ -29,12 +29,12 @@ if ((!r_player_handler1) and (r_handlerCount == 0)) then {
_isInLocation = false; //getPos player in LHA_Location;
_inVehicle = (vehicle player != player);
_bloodLow = ((r_player_blood/r_player_bloodTotal) < 0.5);
if ((surfaceIsWater (getPosASL player)) and !_isOnDeck and !_inVehicle) then {
if ((surfaceIsWater (getPosASL player)) && !_isOnDeck && !_inVehicle) then {
player setpos [(getPosASL player select 0),(getPosASL player select 1),0.3];
};
if(_timeout == 0) then {
if (!r_player_dead and !_bloodLow and r_player_injured) then {
if (!r_player_dead && !_bloodLow && r_player_injured) then {
_timeout = 10;
//_animType = (USEC_WoundAnim select (floor(random (count USEC_WoundAnim))));
//player playActionNow _anim;
@@ -46,13 +46,13 @@ if ((!r_player_handler1) and (r_handlerCount == 0)) then {
if (r_player_timeout > 0) then {
r_player_timeout = r_player_timeout - 1;
} else {
if ((!r_player_dead) and (!r_player_cardiac)) then {
if ((!r_player_dead) && (!r_player_cardiac)) then {
_nul = [] spawn fnc_usec_recoverUncons;
};
};
//Check if near field hospital
_isHospital = false; //(count( nearestObjects [player, ["USMC_WarfareBFieldhHospital"], 8]) > 0);
if (_isHospital or _isOnDeck or _isInLocation) then {
if (_isHospital || _isOnDeck || _isInLocation) then {
waitUntil {!(player getVariable ["NORRN_unit_dragged", false])};
@@ -87,7 +87,7 @@ if ((!r_player_handler1) and (r_handlerCount == 0)) then {
player setVariable ["USEC_inPain", false, true];
player setdamage 0;
{player setVariable[_x,false,true];} forEach USEC_woundHit;
{player setVariable[_x,false,true];} count USEC_woundHit;
player setVariable ["USEC_injured",false,true];
sleep 1;
@@ -106,7 +106,7 @@ if ((!r_player_handler1) and (r_handlerCount == 0)) then {
disableUserInput false;
//waitUntil{USEC_MotherInbox == ""};
//["MED001",0,"Conscious"] call fnc_usec_recordEventClient;
if (!r_player_injured and ((r_player_blood/r_player_bloodTotal) >= 0.5)) then {
if (!r_player_injured && ((r_player_blood/r_player_bloodTotal) >= 0.5)) then {
10 fadeSound 1;
"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;

View File

@@ -14,7 +14,7 @@ if (local _animalbody) then {
_timer = _this select 0;
_body = _this select 1;
_pos = getPosATL _body;
while {(count magazines _body >0) and (time - _timer < 300) } do {
while {(count magazines _body >0) && (time - _timer < 300) } do {
sleep 5;
};
@@ -24,11 +24,11 @@ if (local _animalbody) then {
_inRange = _pos nearEntities ["CAManBase",100];
{
// only send to other players
if(isPlayer _x and _x != player) then {
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"HideBody",[_body]];
publicVariableServer "PVDZE_send";
};
} forEach _inRange;
} count _inRange;
sleep 5;
deleteVehicle _body;

View File

@@ -10,7 +10,7 @@ if (local _zombiebody) then {
_timer = _this select 0;
_body = _this select 1;
_pos = getPosATL _body;
while {(count magazines _body >0) and (time - _timer < 300) } do {
while {(count magazines _body >0) && (time - _timer < 300) } do {
sleep 5;
};
@@ -19,11 +19,11 @@ if (local _zombiebody) then {
/* PVS/PVC - Skaronator */
_inRange = _pos nearEntities ["CAManBase",100];
{
if(isPlayer _x and _x != player) then {
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"HideBody",[_body]];
publicVariableServer "PVDZE_send";
};
} forEach _inRange;
} count _inRange;
sleep 5;
deleteVehicle _body;

View File

@@ -63,7 +63,7 @@ if(!isNil "_objHouse")then{
_validHouses = _validHouses +1;
};
} forEach _objHouse;
} count _objHouse;
_maxHouses = ((_validHouses/100)*_lightPcnt);
@@ -77,7 +77,7 @@ if(!isNil "_objHouse")then{
if(_currLighting < _maxHouses)then{
if(_lightPcnt > floor (random 100))then{//Randomness required or first nearest houses to player get lit in a block - Needs to be based on range !
if(_lightPcnt > floor (random 100))then{//Randomness required || first nearest houses to player get lit in a block - Needs to be based on range !
//axeDiagLog = format["HL:Lighting New House: %3 Num:%1 Type: %4 for %2 | Dist:%5",_currLighting, name player,_x,typeOf _x,player distance _x];
//publicVariable "axeDiagLog";
@@ -114,7 +114,7 @@ if(!isNil "_objHouse")then{
};
};
}forEach _notLitHouses;
}count _notLitHouses;
}else{
//axeDiagLog = format["House Limit Reached(%3): Max:%1 | Count:%2",_maxHouses,count _litHouses,name player];
@@ -127,7 +127,7 @@ if(!isNil "_objHouse")then{
_pos = [_x] call FNC_getPos;
if((abs ([_pos, _objLightPoint] call BIS_fnc_distance2D))<_hsLPDist)then{//In House
if(_plyr distance _x < _lpRange)then{//If within range and outside band
if(_plyr distance _x < _lpRange)then{//If within range && outside band
_brtns = [_plyr,_x] call axe_lightBrightness;
_objLightPoint enableSimulation false;//Attempt to stop Arma from broadcasting lightpoint, just reminding it here ! DO NOT USE ! Will stop light from being visible to player (At least upon creation) !
_objLightPoint setLightColor _lmpCol;
@@ -153,7 +153,7 @@ if(!isNil "_objHouse")then{
};
};
}forEach _litHouses;
}count _litHouses;
};
}else{

View File

@@ -23,7 +23,7 @@ if(!isDedicated)then{
_nrGen = [];
_genCount = 0;
_hsRange = 250;//set var
_houseNum = 0;//Monitor house numbers in range.. Pass around and reduce range if too many and/or client lag (NOT server / client lag)
_houseNum = 0;//Monitor house numbers in range.. Pass around && reduce range if too many &&/|| client lag (NOT server / client lag)
_lightTrig = vehicle player;//Central point around which to run the lights
_plyPos = [0,0,0];
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_lightFunctions.sqf";
@@ -32,7 +32,7 @@ if(!isDedicated)then{
waitUntil {(([Player] call FNC_getPos) select 0) > 0};
//Detect Dusk and Dawn
//Detect Dusk && Dawn
_sunrise = call world_sunRise;
_fnHr = _sunrise + 0.5;
_stHr = (24 - _sunrise) - 0.5;
@@ -50,14 +50,14 @@ if(!isDedicated)then{
_nrGen = nearestObjects [_plyr, [_genClass], _rngPlyr];
_genCount = count _nrGen;
//Set Generator to use and Assign trigger object
//Set Generator to use && Assign trigger object
if(_genCount>0)then{
{
if(_x getVariable["GeneratorRunning",false])exitWith{
_lightTrig = _x;
};
}forEach _nrGen;
}count _nrGen;
};
};
@@ -69,7 +69,7 @@ if(!isDedicated)then{
//Generator not required !
if(!_ndGen)then{_doLight = true;};
//Choose range, player or generator
//Choose range, player || generator
if(_ndGen)then{_hsRange = _trgRng;}else{_hsRange = _rngPlyr;};
//100% chance of lights with nearby generator - ToDo, make this slightly lower.
@@ -116,7 +116,7 @@ if(isServer)then{
DZE_DYN_cleanLightpoints = true;
_missonLights = entities "#lightpoint";
_missionObjs = allMissionObjects "#lightpoint";
diag_log (format["CLEANUP: Attempting Cleanup of Lights out of %1 or %2",count _missonLights, count _missionObjs]);
diag_log (format["CLEANUP: Attempting Cleanup of Lights out of %1 || %2",count _missonLights, count _missionObjs]);
_delQtyLights = 0;
{
if (local _x) then {
@@ -127,7 +127,7 @@ if(isServer)then{
if (!alive _x) then {
_pos = getPosATL _x;
if (count _pos > 0) then {
_nearby = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 420]);//Use calculated range here.
_nearby = {(isPlayer _x) && (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 420]);//Use calculated range here.
if (_nearby==0) then {
_x call dayz_perform_purge;
sleep 0.025;
@@ -137,7 +137,7 @@ if(isServer)then{
};
};
sleep 0.001;
} forEach _missonLights;
} count _missonLights;
if (_delQtyLights > 0) then {
_qty = count _missonLights;
diag_log (format["CLEANUP: Deleted %1 Lights out of %2",_delQtyLights,_qty]);

View File

@@ -1,6 +1,6 @@
/*
DayZ Epoch Lighting System - Lights Out
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com or vbawol@veteranbastards.com.
Made for DayZ Epoch by axeman please ask permission to use/edit/distribute email gregory.andrew@gmail.com || vbawol@veteranbastards.com.
*/
private ["_hsRange","_rng","_pos","_hsCount","_nrstTrig","_objHouses","_objHouse","_nrTowers","_doRand","_rnd","_animlightpoint","_hasLight","_sleeptime","_lightstate","_objLightPoint"];
_rng = _this select 0;//Full distance to turn off all lights if required
@@ -9,7 +9,7 @@ _doRand = _this select 2;//Random if gen not required otherwise just switch then
_hsRange = _this select 4;//House range for randomly failing nearby (within lp distance)houses)
_hasLight = false;
if(_doRand)then{//Randomly fail a nearby house - If generator skip and reset house variable so it can be lit again (reliability if gen nearby)
if(_doRand)then{//Randomly fail a nearby house - If generator skip && reset house variable so it can be lit again (reliability if gen nearby)
_objHouses = nearestObjects [_nrstTrig, ["House"], _hsRange];
if(count _objHouses >3)then{
@@ -50,7 +50,7 @@ _nrTowers = nearestObjects [_nrstTrig, ["Land_Ind_IlluminantTower"], _rng];
if((abs ([([_x] call FNC_getPos), _objLightPoint] call BIS_fnc_distance2D))<1.5)then{
deleteVehicle _objLightPoint;
};
}forEach _objHouses;
}count _objHouses;
};
if(count _objHouses >0)then{
@@ -58,7 +58,7 @@ _nrTowers = nearestObjects [_nrstTrig, ["Land_Ind_IlluminantTower"], _rng];
_x animate ["Lights_1",0];
_x animate ["Lights_2",0];
_x setVariable ["axeHLight", 0, false];
}forEach _objHouses;
}count _objHouses;
};
if(count _nrTowers >0)then{
@@ -71,6 +71,6 @@ _nrTowers = nearestObjects [_nrstTrig, ["Land_Ind_IlluminantTower"], _rng];
};
_x setVariable ["axeTLight", 0, false];
}forEach _nrTowers;
}count _nrTowers;
};
};

View File

@@ -15,5 +15,5 @@ if(count _nrTowers >0)then{
[_lCol,_lbrt,_lamb,[_x],[true]] call axe_towerLight;
_x setVariable ["axeTLight", 1, false];
};
}forEach _nrTowers;
}count _nrTowers;
};

View File

@@ -13,4 +13,4 @@ private ["_spawnveh","_position","_direction","_veh"];
_veh setDir _direction;
_veh setpos _position;
} forEach _this;
} count _this;

View File

@@ -36,7 +36,7 @@ _serial = 0;
if (_itemQty != _oldQty) then {_change = true};
_serial = _serial + 1;
} forEach _currentTypes;
} count _currentTypes;
//Review old loadout
_serial = 0;
@@ -52,6 +52,6 @@ _serial = 0;
if (_itemQty != _oldQty) then {_change = true};
_serial = _serial + 1;
} forEach _previousTypes;
} count _previousTypes;
_change

View File

@@ -6,7 +6,7 @@ _countWeapons = {
_return = 0;
_weapons = (getWeaponCargo _object) select 1;
{ _return = _return + _x } foreach _weapons;
{ _return = _return + _x } count _weapons;
_return;
};
@@ -16,7 +16,7 @@ _countMagazines = {
_return = 0;
_magazines = (getMagazineCargo _object) select 1;
{ _return = _return + _x } foreach _magazines;
{ _return = _return + _x } count _magazines;
_return;
};
@@ -26,7 +26,7 @@ _countBackpacks = {
_return = 0;
_backpacks = (getBackpackCargo _object) select 1;
{ _return = _return + _x } foreach _backpacks;
{ _return = _return + _x } count _backpacks;
_return;
};
@@ -63,11 +63,11 @@ _isStorage = _object isKindOf "Land_A_tent";
_isnewstorage = (typeOf _object) in DZE_isNewStorage;
_timeout = time + 2;
waitUntil { !(isNull (findDisplay 106)) or (_timeout < time) };
waitUntil { !(isNull (findDisplay 106)) || (_timeout < time) };
//diag_log format["object_monitorGear.sqf: _object: %1 _isStorage: %4 _isVehicle: %2 _isMan: %3 _display: %5", _object, _isVehicle, _isMan, _isStorage, findDisplay 106];
if ((_isVehicle or _isStorage or _isnewstorage) and (!_isMan) and (!(isNull (findDisplay 106)))) then {
if ((_isVehicle || _isStorage || _isnewstorage) && (!_isMan) && (!(isNull (findDisplay 106)))) then {
_objectName = getText (configFile >> "CfgVehicles" >> (typeof _object) >> "displayName");
_controlText = [] call _getControlText;

View File

@@ -11,11 +11,11 @@ if (local _unit) then {
_unit setVariable [_strH,_total,true];
_break = false;
if (_selection in USEC_MinorWounds and _total >= 1 and _unit == player) then {
if (_selection in USEC_MinorWounds && _total >= 1 && _unit == player) then {
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_ctrlFracture = _display displayCtrl 1203;
if ((_selection == "legs") and !r_fracture_legs) then {
if ((_selection == "legs") && !r_fracture_legs) then {
r_fracture_legs = true;
_ctrlFracture ctrlShow true;
_id = [] spawn {
@@ -23,7 +23,7 @@ if (local _unit) then {
};
_break = true;
};
if ((_selection == "arms") and !r_fracture_arms) then {
if ((_selection == "arms") && !r_fracture_arms) then {
r_fracture_arms = true;
_ctrlFracture ctrlShow true;
_id = [] spawn {

View File

@@ -6,7 +6,7 @@ _error = _this select 2;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
_nearByObjects = nearestObjects [player,_objects,_range];
@@ -15,7 +15,7 @@ if (count _nearByObjects == 0) exitWith {
};
_targetObject = _nearByObjects select 0;
if (!isNull _targetObject and _canDo) then {
if (!isNull _targetObject && _canDo) then {
[0,1,2,_targetObject] spawn player_removeObject;
} else {
cutText [(localize _error), "PLAIN DOWN"];

View File

@@ -3,7 +3,7 @@ _unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if (_selection != "" and local _unit) then {
if (_selection != "" && local _unit) then {
_strH = "hit_" + (_selection);
_unit setHit[_selection,_damage];
//player sidechat str _damage;

View File

@@ -2,7 +2,7 @@ private["_unit","_selection","_damage","_strH","_dam","_total"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if ((_selection != "") and local _unit) then {
if ((_selection != "") && local _unit) then {
_strH = "hit_" + (_selection);
_dam = _unit getVariable [_strH,0];
_total = (_dam + _damage);

View File

@@ -39,12 +39,12 @@ if (count _this > 4) then {
};
_isWoman = getText(configFile >> "cfgVehicles" >> (typeOf _unit) >> "TextPlural") == "Women";
if (_isWoman and (_type in ["scream","panic"])) then {
if (_isWoman && (_type in ["scream","panic"])) then {
_type = _type + "_w";
};
if ((round(random _chance) == _chance) or (_chance == 0)) then {
if ((round(random _chance) == _chance) || (_chance == 0)) then {
_rnd =(round(random _num));
_sound = "z_" + _type + "_" + str(_rnd);
if (_local) then {

View File

@@ -27,4 +27,4 @@ if ("ItemMap_Debug" in items player) then {
} else {
_zombie setVariable ["myDest",_pos,true];
};
} forEach _listTalk;
} count _listTalk;

View File

@@ -38,7 +38,7 @@ if (count _list < dayz_maxAnimals) then {
_list = _Pos nearEntities [["CAAnimalBase","Man"],50];
if (player distance _Pos < dayz_animalDistance and NOT surfaceIsWater _Pos and (count _list <= 1)) then {
if (player distance _Pos < dayz_animalDistance && NOT surfaceIsWater _Pos && (count _list <= 1)) then {
if (_type == "DZ_Pastor") then { _agent = createAgent [_type, _Pos, [], 0, "NONE"]; } else { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; };
_agent setpos _Pos;

View File

@@ -24,14 +24,14 @@ _intersectsWith = lineIntersectsWith [_playerPos, _vehiclePos, player, _vehicle]
if ((count _intersectsWith) > 0) then {
{
// buildings
if (_x isKindOf "Building" or _x isKindOf "DZE_Housebase") exitWith {
if (_x isKindOf "Building" || _x isKindOf "DZE_Housebase") exitWith {
_activated = true;
};
// walls
if ((typeOf _x) == "" and {["wall_", str _x, false] call fnc_inString}) exitWith {
if ((typeOf _x) == "" && {["wall_", str _x, false] call fnc_inString}) exitWith {
_activated = true;
};
} forEach _intersectsWith;
} count _intersectsWith;
};
if(_activated) then {

View File

@@ -95,7 +95,7 @@ if (_scaleLight < 0.9) then {
};
};
//Ensure zero or above
//Ensure zero || above
_scaleLight = _scaleLight max 0;
//Terrain Visibility
@@ -145,7 +145,7 @@ if (_isPlayerInside) then {
//Work out result
_audial = round(_speed * dayz_surfaceNoise * _scaleMvmt * _scaleSound);
if ((_audial > DAYZ_disAudial) or ((time - dayz_firedCooldown) > 0.3)) then {
if ((_audial > DAYZ_disAudial) || ((time - dayz_firedCooldown) > 0.3)) then {
DAYZ_disAudial = _audial;
};

View File

@@ -44,13 +44,13 @@ _array = _this;
if (count _array > 0) then {
_source = _array select 0;
_method = _array select 1;
if ((!isNull _source) and (_source != player)) then {
if ((!isNull _source) && (_source != player)) then {
_canHitFree = player getVariable ["freeTarget",false];
_isBandit = (player getVariable["humanity",0]) <= -2000;
_punishment = _canHitFree or _isBandit; //if u are bandit or start first - player will not recieve humanity drop
_punishment = _canHitFree || _isBandit; //if u are bandit || start first - player will not recieve humanity drop
_humanityHit = 0;
if (!_punishment) then {
//i'm "not guilty" - kill me and be punished
//i'm "not guilty" - kill me && be punished
_myKills = ((player getVariable ["humanKills",0]) / 30) * 1000;
_humanityHit = -(2000 - _myKills);
_kills = _source getVariable ["humanKills",0];

View File

@@ -6,7 +6,7 @@ if (!(isNull _backpack)) then {
_magazines = getMagazineCargo _backpack;
_weaponscnt = count(_weapons select 0);
_magazinescnt = count(_magazines select 0);
if ((_magazinescnt > 0) or(_weaponscnt > 0)) then{
if ((_magazinescnt > 0) ||(_weaponscnt > 0)) then{
hideObject _backpack;
};
};

View File

@@ -44,7 +44,7 @@ if (_ammo isKindOf "SmokeShell") then {
_group setVariable ["targets",_targets,true];
};
_i = _i + 1;
} forEach _listTalk;
} count _listTalk;
} else {
[_unit,_distance,true,(getPosATL player)] spawn player_alertZombies;
//Check if need to place arrow
@@ -65,11 +65,11 @@ if (_ammo isKindOf "SmokeShell") then {
_pos = getPosATL player;
_inRange = _pos nearEntities ["CAManBase",1250];
{
if(isPlayer _x and _x != player) then {
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"RoadFlare",[_projectile,0]];
publicVariableServer "PVDZE_send";
};
} forEach _inRange;
} count _inRange;
_id = _this spawn player_throwObject;
};
@@ -81,11 +81,11 @@ if (_ammo isKindOf "SmokeShell") then {
_pos = getPosATL player;
_inRange = _pos nearEntities ["CAManBase",1250];
{
if(isPlayer _x and _x != player) then {
if(isPlayer _x && _x != player) then {
PVDZE_send = [_x,"RoadFlare",[_projectile,1]];
publicVariableServer "PVDZE_send";
}
} forEach _inRange;
} count _inRange;
_id = _this spawn player_throwObject;
};

View File

@@ -30,7 +30,7 @@ if (count _inventory > 0) then {
};
};
_idc = _idc + 1;
} forEach _mags;
} count _mags;
//Add weapons
{
@@ -43,5 +43,5 @@ if (count _inventory > 0) then {
if (_isOK) then {
player addWeapon _x;
};
} forEach _wpns;
} count _wpns;
};

View File

@@ -5,7 +5,7 @@ _objects = nearestObjects [getPosATL player, dayz_updateObjects, 10];
PVDZE_veh_Update = [_x,"gear"];
publicVariableServer "PVDZE_veh_Update";
} foreach _objects;
} count _objects;
private["_dialog","_magazineArray","_control","_item","_val","_max"];

View File

@@ -4,7 +4,7 @@ _weapon = _this select 1;
_ammo = _this select 4;
_projectile = _this select 6;
if (_ammo isKindOf "Hatchet_Swing_Ammo" or _ammo isKindOf "Chainsaw_Swing_Ammo") then {
if (_ammo isKindOf "Hatchet_Swing_Ammo" || _ammo isKindOf "Chainsaw_Swing_Ammo") then {
_findNearestTree = [];
{
@@ -20,7 +20,7 @@ if (_ammo isKindOf "Hatchet_Swing_Ammo" or _ammo isKindOf "Chainsaw_Swing_Ammo")
};
};
};
} foreach nearestObjects [getPosATL player, [], 20];
} count nearestObjects [getPosATL player, [], 20];
//diag_log ("POSITION: " + str(_endPos));

View File

@@ -51,7 +51,7 @@ if (count _medical > 0) then {
//["usecBleed",[player,_x,_hit]] call broadcastRpcCallAll;
usecBleed = [player,_x,0];
publicVariable "usecBleed";
} forEach (_medical select 8);
} count (_medical select 8);
//Add fractures
_fractures = (_medical select 9);

View File

@@ -32,7 +32,7 @@ _ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
if((_ownerID != dayz_combination) and (_ownerID != dayz_playerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_115"),_text], "PLAIN DOWN"]; };
if((_ownerID != dayz_combination) && (_ownerID != dayz_playerUID)) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_115"),_text], "PLAIN DOWN"]; };
_alreadyPacking = _obj getVariable["packing",0];
if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; s_player_lockvault = -1; cutText [format[(localize "str_epoch_player_116"),_text], "PLAIN DOWN"]};

View File

@@ -22,7 +22,7 @@ EpochDeathBoardLoad = {
];*/
{
lbAdd [EpochDeathBoardDialogList, (_x select 0)];
} forEach PVDZE_plr_DeathBResult;
} count PVDZE_plr_DeathBResult;
};
@@ -34,7 +34,7 @@ EpochDeathBoardClick = {
"What happens if you get scared half to death, twice?",
"Don't upset me.. I'm running out of places to hide the bodies.",
"Don't run, you'll just die tired.",
"Give me immortality or give me death.",
"Give me immortality || give me death.",
"I can't live with death; he's always leaving the toilet seat up.",
"Why won't you die?!?!",
"Guns don't kill people; death kills people. It's a proven medical fact."

View File

@@ -4,7 +4,7 @@ while {!r_player_dead} do {
_sound = "z_suspense_" + str(_num);
_length = getNumber(configFile >> "cfgMusic" >> _sound >> "Duration");
_pause = ((random 5) + 2) + _length;
if (!r_player_unconscious and !r_pitchWhine) then {
if (!r_player_unconscious && !r_pitchWhine) then {
playMusic _sound;
};
sleep _pause;

View File

@@ -17,7 +17,7 @@ dayz_lastCheckBit = time;
if(r_fracture_legs && !r_player_dead) then {_btnRespawn ctrlEnable true;};
//force gear save
if (!r_player_dead and time - dayz_lastCheckBit > 10) then {
if (!r_player_dead && time - dayz_lastCheckBit > 10) then {
call dayz_forceSave;
};
@@ -26,17 +26,17 @@ _sleep = 1;
while {!isNull _display} do {
switch true do {
case (!r_player_dead and {isPlayer _x} count (player nearEntities ["AllVehicles", 12]) > 1) : {
case (!r_player_dead && {isPlayer _x} count (player nearEntities ["AllVehicles", 12]) > 1) : {
_btnAbort ctrlEnable false;
cutText [localize "str_abort_playerclose", "PLAIN DOWN"];
_sleep = 1;
};
case (!r_player_dead and !canbuild) : {
case (!r_player_dead && !canbuild) : {
_btnAbort ctrlEnable false;
cutText [(localize "str_epoch_player_12"), "PLAIN DOWN"];
_sleep = 1;
};
case (!r_player_dead and player getVariable["combattimeout", 0] >= time) : {
case (!r_player_dead && player getVariable["combattimeout", 0] >= time) : {
_btnAbort ctrlEnable false;
//cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];
cutText [localize "str_abort_playerincombat", "PLAIN DOWN"];

View File

@@ -41,7 +41,7 @@ sleep 3;
_classname = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "create");
if(!isNull _obj and alive _obj) then {
if(!isNull _obj && alive _obj) then {
_location = _pos;
@@ -78,7 +78,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
//Add Magazines
_objWpnTypes = _magazines select 0;
@@ -87,7 +87,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
//Add Backpacks
_objWpnTypes = _backpacks select 0;
@@ -96,7 +96,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
cutText [localize "str_success_tent_pack", "PLAIN DOWN"];

View File

@@ -15,7 +15,7 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName"
// Silently exit if object no longer exists
if(isNull _obj or !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
if(isNull _obj || !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
_playerNear = _obj call dze_isnearest_player;
@@ -30,7 +30,7 @@ s_player_packvault = 1;
if(_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_packvault = -1; cutText [format[(localize "str_epoch_player_118"),_text], "PLAIN DOWN"];};
if((_ownerID != dayz_combination) and (_ownerID != dayz_playerUID)) exitWith { DZE_ActionInProgress = false; s_player_packvault = -1; cutText [format[(localize "str_epoch_player_119"),_text], "PLAIN DOWN"];};
if((_ownerID != dayz_combination) && (_ownerID != dayz_playerUID)) exitWith { DZE_ActionInProgress = false; s_player_packvault = -1; cutText [format[(localize "str_epoch_player_119"),_text], "PLAIN DOWN"];};
_alreadyPacking = _obj getVariable["packing",0];
@@ -54,7 +54,7 @@ if(_location1 distance _location2 > 0.1) exitWith {
_dir = direction _obj;
_pos = _obj getVariable["OEMPos",(getposATL _obj)];
if(!isNull _obj and alive _obj) then {
if(!isNull _obj && alive _obj) then {
[1,1] call dayz_HungerThirst;
player playActionNow "Medic";
@@ -94,7 +94,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
//Add Magazines
_objWpnTypes = _magazines select 0;
@@ -103,7 +103,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
//Add Backpacks
_objWpnTypes = _backpacks select 0;
@@ -112,7 +112,7 @@ if(!isNull _obj and alive _obj) then {
{
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
cutText [format[(localize "str_epoch_player_123"),_text], "PLAIN DOWN"];

View File

@@ -32,7 +32,7 @@ while {(alive _projectile) && !(isNull _projectile) && _callCount < 85;} do {
if (isPlayer _nearVehicle) then {
_isInCombat = _nearVehicle getVariable["startcombattimer",0];
if ((alive _nearVehicle) and _isInCombat == 0) then {
if ((alive _nearVehicle) && _isInCombat == 0) then {
_nearVehicle setVariable["startcombattimer", 1];
diag_log("Now in Combat (Player): " + name _unit);
};
@@ -41,11 +41,11 @@ while {(alive _projectile) && !(isNull _projectile) && _callCount < 85;} do {
if (_nearVehicle isKindOf "AllVehicles") then {
{
_isInCombat = _x getVariable["startcombattimer",0];
if (isPlayer _x and _isInCombat == 0 and alive _x) then {
if (isPlayer _x && _isInCombat == 0 && alive _x) then {
_x setVariable["startcombattimer", 1];
diag_log("Now in Combat (Crew): " + name _x);
};
} forEach (crew _nearVehicle);
} count (crew _nearVehicle);
};
} forEach _listNear;
} count _listNear;

View File

@@ -13,7 +13,7 @@ _position = getPosATL player;
dayz_spawnZombies = 0;
dayz_CurrentZombies = 0;
// experiment with adding fly sounds locally for both zombies and players.
// experiment with adding fly sounds locally for both zombies && players.
_soundLimit = 2;
{
if (!alive _x) then {
@@ -23,7 +23,7 @@ _soundLimit = 2;
};
};
if (_soundLimit == 0) exitWith {};
} foreach (nearestObjects [player, ["CAManBase"], 8]);
} count (nearestObjects [player, ["CAManBase"], 8]);
_players = _position nearEntities ["CAManBase",_radius+200];
dayz_maxGlobalZombies = dayz_maxGlobalZombiesInit;
@@ -38,7 +38,7 @@ dayz_maxGlobalZombies = dayz_maxGlobalZombiesInit;
dayz_CurrentZombies = dayz_CurrentZombies + 1;
};
};
} foreach _players;
} count _players;
if ("ItemMap_Debug" in items player) then {
deleteMarkerLocal "MaxZeds";
@@ -89,7 +89,7 @@ _nearby = _position nearObjects ["building",_radius];
_nearbyCount = count _nearby;
if (_nearbyCount < 1) exitwith
{
if ((dayz_spawnZombies < _maxWildZombies) and !_inVehicle) then {
if ((dayz_spawnZombies < _maxWildZombies) && !_inVehicle) then {
[_position] call wild_spawnZombies;
};
};
@@ -108,19 +108,19 @@ if (_nearbyCount < 1) exitwith
_dis = _x distance player;
//Loot
if ((_dis < 120) and (_dis > 30) and !_inVehicle) then {
if ((_dis < 120) && (_dis > 30) && !_inVehicle) then {
_looted = (_x getVariable ["looted",-0.1]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
//diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if ((_age > DZE_LootSpawnTimer) and (!_cleared)) then {
if ((_age > DZE_LootSpawnTimer) && (!_cleared)) then {
_nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)];
{deleteVehicle _x} forEach _nearByObj;
{deleteVehicle _x} count _nearByObj;
_x setVariable ["cleared",true,true];
_x setVariable ["looted",_dateNow,true];
};
if ((_age > DZE_LootSpawnTimer) and (_cleared)) then {
if ((_age > DZE_LootSpawnTimer) && (_cleared)) then {
//Register
_x setVariable ["looted",_dateNow,true];
//cleanup
@@ -150,4 +150,4 @@ if (_nearbyCount < 1) exitwith
};
};
};
} forEach _nearby;
} count _nearby;

View File

@@ -56,29 +56,29 @@ _newUnit setPosATL _position;
_newUnit setDir _dir;
//Clear New Character
{_newUnit removeMagazine _x;} forEach magazines _newUnit;
{_newUnit removeMagazine _x;} count magazines _newUnit;
removeAllWeapons _newUnit;
//Equip New Charactar
{
if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
} forEach _magazines;
} count _magazines;
{
_newUnit addWeapon _x;
} forEach _weapons;
} count _weapons;
//Check and Compare it
//Check && Compare it
if(str(_weapons) != str(weapons _newUnit)) then {
//Get Differecnce
{
_weapons = _weapons - [_x];
} forEach (weapons _newUnit);
} count (weapons _newUnit);
//Add the Missing
{
_newUnit addWeapon _x;
} forEach _weapons;
} count _weapons;
};
if(_primweapon != (primaryWeapon _newUnit)) then {
@@ -108,11 +108,11 @@ _switchUnit = {
setPlayable _newUnit;
selectPlayer _newUnit;
removeAllWeapons _oldUnit;
{_oldUnit removeMagazine _x;} forEach magazines _oldUnit;
{_oldUnit removeMagazine _x;} count magazines _oldUnit;
deleteVehicle _oldUnit;
if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
};
//Add and Fill BackPack
//Add && Fill BackPack
if (!isNil "_newBackpackType") then {
if (_newBackpackType != "") then {
_newUnit addBackpack _newBackpackType;
@@ -140,13 +140,13 @@ if (!isNil "_newBackpackType") then {
(unitBackpack player) addMagazineCargoGlobal [_x, 1];
};
};
} forEach _backpackMag;
} count _backpackMag;
(findDisplay 106) closeDisplay 0;
_countr = 0;
{
(unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
_countr = _countr + 1;
} forEach _backpackWpnTypes;
} count _backpackWpnTypes;
} else { [] call _switchUnit; };
} else { [] call _switchUnit; };
[objNull, player, rSwitchMove,_currentAnim] call RE;
@@ -171,4 +171,4 @@ if (_ismelee == "true") then {
};
//reveal the same objects we do on login
{player reveal _x} forEach (nearestObjects [getPosATL player, dayz_reveal, 50]);
{player reveal _x} count (nearestObjects [getPosATL player, dayz_reveal, 50]);

View File

@@ -175,7 +175,7 @@ TraderDialogLoadItemList = {
_header,
_File
]];
} forEach PVDZE_plr_TradeMenuResult;
} count PVDZE_plr_TradeMenuResult;
TraderItemList = _item_list;
};

View File

@@ -16,7 +16,7 @@ TraderDialogLoadItemList = {
TraderItemList = -1;
_index = _this select 0;
if (_index < 0 or TraderCurrentCatIndex == _index) exitWith {};
if (_index < 0 || TraderCurrentCatIndex == _index) exitWith {};
TraderCurrentCatIndex = _index;
_trader_id = TraderCatList select _index;
@@ -163,7 +163,7 @@ TraderDialogLoadItemList = {
_header,
_File
]];
} forEach PVDZE_plr_TradeMenuResult;
} count PVDZE_plr_TradeMenuResult;
TraderItemList = _item_list;
};

View File

@@ -8,7 +8,7 @@ private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_we
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_21") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
{player removeAction _x} count s_player_combi;s_player_combi = [];
s_player_unlockvault = 1;
_obj = _this;
@@ -22,8 +22,8 @@ if (!(_objType in DZE_LockedStorage)) exitWith {
_playerNear = _obj call dze_isnearest_player;
if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_20") , "PLAIN DOWN"]; };
// Silently exit if object no longer exists or alive
if(isNull _obj or !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
// Silently exit if object no longer exists || alive
if(isNull _obj || !(alive _obj)) exitWith { DZE_ActionInProgress = false; };
_unlockedClass = getText (configFile >> "CfgVehicles" >> _objType >> "unlockedClass");
_text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
@@ -35,14 +35,14 @@ _ownerID = _obj getVariable["CharacterID","0"];
if (_alreadyPacking == 1) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_124"),_text], "PLAIN DOWN"]};
// Promt user for password if _ownerID != dayz_playerUID
if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
if ((_ownerID == dayz_combination) || (_ownerID == dayz_playerUID)) then {
// Check if any players are nearby if not allow player to claim item.
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
_playerID = getPlayerUID player;
// Only allow if not already claimed.
if (_claimedBy == "0" or !_playerNear) then {
if (_claimedBy == "0" || !_playerNear) then {
// Since item was not claimed proceed with claiming it.
_obj setVariable["claimed",_playerID,true];
};
@@ -56,7 +56,7 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
if (_claimedBy == _playerID) then {
if(!isNull _obj and alive _obj) then {
if(!isNull _obj && alive _obj) then {
PVDZE_log_lockUnlock = [player, _obj, false];
publicVariableServer "PVDZE_log_lockUnlock";
@@ -91,7 +91,7 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
{
_holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
};
if (count _magazines > 0) then {
@@ -105,7 +105,7 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
_holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
};
} forEach _objWpnTypes;
} count _objWpnTypes;
};
if (count _backpacks > 0) then {
@@ -116,7 +116,7 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then {
{
_holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
} count _objWpnTypes;
};
cutText [format[(localize "str_epoch_player_125"),_text], "PLAIN DOWN"];

View File

@@ -69,9 +69,9 @@ if (_foodLvl < 0) then { _foodLvl = 0 };
_food = "\z\addons\dayz_code\gui\status_food_inside_" + str(_foodLvl) + "_ca.paa";
if ( _tempLvl >= 36 ) then { _tempImg = 4 };
if ( _tempLvl > 33 and _tempLvl < 36 ) then { _tempImg = 3 };
if ( _tempLvl >= 30 and _tempLvl <= 33 ) then { _tempImg = 2 };
if ( _tempLvl > 28 and _tempLvl < 30 ) then { _tempImg = 1 };
if ( _tempLvl > 33 && _tempLvl < 36 ) then { _tempImg = 3 };
if ( _tempLvl >= 30 && _tempLvl <= 33 ) then { _tempImg = 2 };
if ( _tempLvl > 28 && _tempLvl < 30 ) then { _tempImg = 1 };
if ( _tempLvl <= 28 ) then { _tempImg = 0 };
_temp = "\z\addons\dayz_code\gui\status_temp_" + str(_tempImg) + "_ca.paa";
@@ -142,7 +142,7 @@ Opt-in tag system with friend tagging
_targetControl = _display displayCtrl 1199;
_string = "";
_humanityTarget = cursorTarget;
if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarget) then {
if (!isNull _humanityTarget && isPlayer _humanityTarget && alive _humanityTarget) then {
_distance = (player distance _humanityTarget);
@@ -150,7 +150,7 @@ if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarg
_size = (1-(floor(_distance/5)*0.1)) max 0.1;
// Display name if player opt-in or if friend
// Display name if player opt-in || if friend
_friendlies = player getVariable ["friendlies", []];
_charID = player getVariable ["CharacterID", "0"];
@@ -158,7 +158,7 @@ if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarg
_rfriendlies = _humanityTarget getVariable ["friendlies", []];
_rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
if ((_rcharID in _friendlies) and (_charID in _rfriendlies)) then {
if ((_rcharID in _friendlies) && (_charID in _rfriendlies)) then {
if (!(_charID in _rfriendlyTo)) then {
@@ -189,7 +189,7 @@ if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarg
_color = "color='#3333ff'";
};
};
if((_humanityTarget getVariable ["DZE_display_name", false]) or (DZE_ForceNameTagsInTrader && isInTraderCity)) then {
if((_humanityTarget getVariable ["DZE_display_name", false]) || (DZE_ForceNameTagsInTrader && isInTraderCity)) then {
_humanityName = if (alive _humanityTarget) then {name _humanityTarget; } else { "Dead Player";};
_string = format["<t %2 align='center' size='%3'>%1</t>",_humanityName,_color,_size];
};

View File

@@ -16,10 +16,10 @@ if (vehicle player != player) exitWith {DZE_ActionInProgress = false; cutText [(
_findNearestVehicles = nearestObjects [player, ["LandVehicle"], 10];
_findNearestVehicle = [];
{
if (alive _x and (count (crew _x)) == 0) exitWith {
if (alive _x && (count (crew _x)) == 0) exitWith {
_findNearestVehicle set [(count _findNearestVehicle),_x];
};
} foreach _findNearestVehicles;
} count _findNearestVehicles;
_IsNearVehicle = count (_findNearestVehicle);
if (_IsNearVehicle >= 1) then {
@@ -28,11 +28,11 @@ if (_IsNearVehicle >= 1) then {
_notNearestPlayer = _vehicle call dze_isnearest_player;
if (!isNull _vehicle and local _vehicle and !_notNearestPlayer) then {
if (!isNull _vehicle && local _vehicle && !_notNearestPlayer) then {
_classname = typeOf _vehicle;
// lookup vehicle and find if any upgrades are available
// lookup vehicle && find if any upgrades are available
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "Upgrades" >> _upgrade);
if (!isNil "_upgrade" && (count _upgrade) > 0) then {
@@ -50,13 +50,13 @@ if (_IsNearVehicle >= 1) then {
_countIn = _x select 1;
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
} forEach _requirementsMagazine;
} count _requirementsMagazine;
{
_itemIn = _x select 0;
_countIn = _x select 1;
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgWeapons" >> _x)) == _itemIn) } count weapons player;
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
} forEach _requirementsWeapon;
} count _requirementsWeapon;
if (_proceed) then {
@@ -84,8 +84,8 @@ if (_IsNearVehicle >= 1) then {
_temp_removed_array_mag set [count _temp_removed_array_mag,_x];
};
};
} forEach magazines player;
} forEach _requirementsMagazine;
} count magazines player;
} count _requirementsMagazine;
{
_removed = 0;
@@ -103,8 +103,8 @@ if (_IsNearVehicle >= 1) then {
_temp_removed_array_wep set [count _temp_removed_array_wep,_x];
};
};
} forEach weapons player;
} forEach _requirementsWeapon;
} count weapons player;
} count _requirementsWeapon;
// all parts removed proceed
if (_tobe_removed_total == _removed_total) then {
@@ -132,8 +132,8 @@ if (_IsNearVehicle >= 1) then {
};
}
else {
{player addMagazine _x;} forEach _temp_removed_array_mag;
{player addWeapon _x;} forEach _temp_removed_array_wep;
{player addMagazine _x;} count _temp_removed_array_mag;
{player addWeapon _x;} count _temp_removed_array_wep;
cutText [format[(localize "str_epoch_player_145"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
};
}

View File

@@ -17,7 +17,7 @@ _newObjects = [];
};
_newObjects set [count _newObjects,_type];
};
} forEach _currentObjects;
} count _currentObjects;
//Compare current loadout with old loadout
_newObjects = [];
@@ -31,6 +31,6 @@ _newObjects = [];
};
_newObjects set [count _newObjects,_type];
};
} forEach _checkObjects;
} count _checkObjects;
_change;

View File

@@ -13,13 +13,13 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
_arc = 60;
_isBallistic = (getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleOnFire") > 0);
_dmgDistance = getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleDist");
_isRocket = ((_ammo isKindOf "RocketBase") and (_firer isKindOf "Man"));
_isRocket = ((_ammo isKindOf "RocketBase") && (_firer isKindOf "Man"));
_isPlayer = (_unit == player);
_inVehicle = (vehicle _unit != _unit);
_evType = "";
_recordable = false;
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
// Both the firer && those nearby (<=8m) go into "combat" to prevent ALT-F4
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
_firer setVariable["startcombattimer", 1];
if (_distance <= 8) then {
@@ -44,7 +44,7 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
_isInRear = (_firingArc > (180 - _arc));
//Ballistic Handler
if ((_isBallistic and _isInFront) and (_distance < (_dmgDistance * 2))) then {
if ((_isBallistic && _isInFront) && (_distance < (_dmgDistance * 2))) then {
if (_distance < _dmgDistance) then {
//Will Cause Damage
1 call fnc_usec_bulletHit;
@@ -68,8 +68,8 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
};
};
} else {
if (_isRocket and (_isInFront or _isInRear)) then {
if ((_distance < 5) and !_handled) then {
if (_isRocket && (_isInFront || _isInRear)) then {
if ((_distance < 5) && !_handled) then {
1 call fnc_usec_bulletHit;
[20,45] call fnc_usec_pitchWhine; //Visual , Sound
// Dead
@@ -78,12 +78,12 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
};
[_unit,2] call fnc_usec_damageUnconscious;
};
if ((_distance < 10) and !_handled) then {
if ((_distance < 10) && !_handled) then {
[10,20] call fnc_usec_pitchWhine; //Visual , Sound
// Unconscious
[_unit,0.2] call fnc_usec_damageUnconscious;
};
if ((_distance < 20) and !_handled and _isPlayer) then {
if ((_distance < 20) && !_handled && _isPlayer) then {
// Warn
[10,20] call fnc_usec_pitchWhine; //Visual , Sound
addCamShake [15, 0.8, 25];

View File

@@ -5,7 +5,7 @@ _vehicle = (vehicle player);
_targets = _unit getVariable ["targets",[]];
if (!dayz_zedsAttackVehicles and !(_vehicle in _targets)) exitWith {
if (!dayz_zedsAttackVehicles && !(_vehicle in _targets)) exitWith {
//diag_log ("not attacking vehicle" + str(_vehicle));
};
@@ -56,7 +56,7 @@ if (_vehicle != player) then {
if (_vehicle isKindOf _x) exitWith {
player action ["eject", _vehicle];
};
} forEach _openVehicles;
} count _openVehicles;
};
//diag_log ("Hitpoints " +str(_wound) + "hit points " + str(_hpList));
@@ -89,7 +89,7 @@ if (_vehicle != player) then {
} else {
//diag_log ("Animation state: " +(_currentAnim));
_attackanimations = ["zombiestandingattack1","zombiestandingattack2","zombiestandingattack3","zombiestandingattack4","zombiestandingattack5","zombiestandingattack6","zombiestandingattack7","zombiestandingattack8","zombiestandingattack9","zombiestandingattack10","zombiefeed1","zombiefeed2","zombiefeed3","zombiefeed4","zombiefeed5"];
if (((_unit distance player) <= dayz_areaAffect) and ((animationState _unit) in _attackanimations)) then {
if (((_unit distance player) <= dayz_areaAffect) && ((animationState _unit) in _attackanimations)) then {
//check LOS
_inAngle = [_zPos,(getdir _unit),50,_tPos] call fnc_inAngleSector;
if (_inAngle) then {

View File

@@ -14,7 +14,7 @@ _attacked = false;
_dist = (_x distance _refObj);
_chance = 1;
if ((_dist < dayz_areaAffect) and !(animationState _x == "ZombieFeed")) then {
if ((_dist < dayz_areaAffect) && !(animationState _x == "ZombieFeed")) then {
//diag_log ("within attack range: " + str(_x));
@@ -23,7 +23,7 @@ _attacked = false;
_last = _x getVariable["lastAttack",0];
_entHeight = (getPosATL _x) select 2;
_delta = _pHeight - _entHeight;
if ( ((time - _last) > 1) and ((_delta < 1.5) and (_delta > -1.5)) ) then
if ( ((time - _last) > 1) && ((_delta < 1.5) && (_delta > -1.5)) ) then
{
//diag_log ("perform attack: " + str(_x));
[_x, _type] spawn player_zombieAttack;
@@ -41,7 +41,7 @@ _attacked = false;
};
//Noise Activation
_targets = _x getVariable ["targets",[]];
if (!(_refObj in _targets) and !isNull _refObj) then {
if (!(_refObj in _targets) && !isNull _refObj) then {
if (_dist < DAYZ_disAudial) then {
if (DAYZ_disAudial > 80) then {
@@ -72,7 +72,7 @@ _attacked = false;
};
//Sight Activation
_targets = _x getVariable ["targets",[]];
if (!(_refObj in _targets) and !isNull _refObj) then {
if (!(_refObj in _targets) && !isNull _refObj) then {
if (_dist < DAYZ_disVisual) then {
_tPos = (getPosASL _refObj);
@@ -95,7 +95,7 @@ _attacked = false;
};
};
};
} forEach _listTalk;
} count _listTalk;
if (_attacked) then {
if (r_player_unconscious) then {

View File

@@ -8,7 +8,7 @@ _uniq = [];
_item = objNull;
_iPosZ = _iPos select 2;
if((isNil "_iPosZ") OR {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
if((isNil "_iPosZ") || {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
if (isNil "_iClass") exitWith {diag_log "_iClass isNil, exiting loot spawn!";};
switch (_iClass) do {
@@ -17,11 +17,11 @@ switch (_iClass) do {
if (DZE_MissionLootTable) then {
{
_itemTypes set [count _itemTypes, _x select 0]
} foreach getArray (missionConfigFile >> "cfgLoot" >> _iClass);
} count getArray (missionConfigFile >> "cfgLoot" >> _iClass);
} else {
{
_itemTypes set [count _itemTypes, _x select 0]
} foreach getArray (configFile >> "cfgLoot" >> _iClass);
} count getArray (configFile >> "cfgLoot" >> _iClass);
};
_qty = 0;
_max = ceil(random 2) + 1;
@@ -101,12 +101,12 @@ switch (_iClass) do {
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "cfgLoot" >> _iClass);
} count getArray(missionConfigFile >> "cfgLoot" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "cfgLoot" >> _iClass);
} count getArray(configFile >> "cfgLoot" >> _iClass);
};
_index = dayz_CLBase find _iItem;
_weights = dayz_CLChances select _index;
@@ -139,12 +139,12 @@ switch (_iClass) do {
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "cfgLoot" >> _iClass);
} count getArray(missionConfigFile >> "cfgLoot" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "cfgLoot" >> _iClass);
} count getArray(configFile >> "cfgLoot" >> _iClass);
};
_index = dayz_CLBase find _iItem;
_weights = dayz_CLChances select _index;
@@ -158,7 +158,7 @@ switch (_iClass) do {
_iItem = ["ChainSaw","ChainSawB","ChainSawG","ChainSawP","ChainSawR"] call BIS_fnc_selectRandom;
};
//Item is a weapon, add it and a random quantity of magazines
//Item is a weapon, add it && a random quantity of magazines
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_iItem,1];
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
@@ -174,7 +174,7 @@ switch (_iClass) do {
};
case "weapon":
{
//Item is a weapon, add it and a random quantity of magazines
//Item is a weapon, add it && a random quantity of magazines
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_iItem,1];
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
@@ -194,7 +194,7 @@ switch (_iClass) do {
};
case "weaponnomags":
{
//Item is a weapon, and spawns no mags
//Item is a weapon, && spawns no mags
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_iItem,1];
};

View File

@@ -19,12 +19,12 @@ switch (_iClass) do
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
} count getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayzE_CLSBase find _iClass;
@@ -45,12 +45,12 @@ switch (_iClass) do
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
} count getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayzE_CLSBase find _iItem;
_weights = dayzE_CLSChances select _index;
@@ -70,12 +70,12 @@ switch (_iClass) do
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} foreach getArray(configFile >> "CfgLootSmall" >> _iClass);
} count getArray(configFile >> "CfgLootSmall" >> _iClass);
};
_index = dayzE_CLSBase find _iItem;
_weights = dayzE_CLSChances select _index;

View File

@@ -2,7 +2,7 @@ private["_state"];
disableSerialization;
_state = uiNamespace getVariable ['DZ_displayUI', 0];
// Hard code the GUI on and the Debug Monitor off
// Hard code the GUI on && the Debug Monitor off
if (dayzState != 0) then {
3 cutRsc ["playerStatusGUI", "PLAIN",0];
//Update GUI

View File

@@ -16,7 +16,7 @@ if( (!isNull cursorTarget) && (player distance cursorTarget < 5) && (vehicle pla
};
};
/*Player doesn't have a cursor target, or its too far away, or they are in a vehicle.
/*Player doesn't have a cursor target, || its too far away, || they are in a vehicle.
else{
if ( (vehicle player != player) && (vehicle player isKindOf "AllVehicles") ) then {
//Player is in a vehicle, placeholder for vehicle trunk sounds(if added)

View File

@@ -42,7 +42,7 @@ if (_button == 1) then {
/*
This flag means that the action is output oriented
the output class will then be transferred to the script
and the type used for the name
&& the type used for the name
*/
_array = getArray (_config >> "output");
_outputClass = _array select 0;

View File

@@ -7,7 +7,7 @@ _hitPoints = _unit call vehicle_getHitpoints;
{
_selection = getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "HitPoints" >> _x >> "name");
_unit setVariable [_selection, 1, true];
} forEach _hitPoints;
} count _hitPoints;
//["PVDZE_veh_Update",[_unit, "damage"]] call callRpcProcedure;
if (isServer) then {

View File

@@ -15,7 +15,7 @@ _agent = objNull;
_type = _unitTypes call BIS_fnc_selectRandom;
//Create the Group and populate it
//Create the Group && populate it
//diag_log ("Spawned: " + _type);
_radius = 40;
_method = "NONE";
@@ -64,7 +64,7 @@ if (_rnd > 0.3) then {
_array = [];
{
_array set [count _array, _x select 0]
} foreach _lootTypeCfg;
} count _lootTypeCfg;
if (count _array > 0) then {
_index = dayz_CLBase find _lootType;
_weights = dayz_CLChances select _index;

View File

@@ -9,7 +9,7 @@ _range = 500;
_assigned = _group getVariable ["targets",[]];
{
_group reveal [_x,4];
} forEach _assigned;
} count _assigned;
//Find targets
_targets = _lead nearTargets _range;
@@ -17,14 +17,14 @@ _targets = _lead nearTargets _range;
private["_obj","_dis"];
_obj = _x select 4;
_dis = _obj distance _lead;
if (_obj isKindOf "Man" and ((speed _obj) < 15)) then {
if (!(_obj isKindOf "zZombie_Base") and !(_obj in _targetMen)) then {
if (_obj isKindOf "Man" && ((speed _obj) < 15)) then {
if (!(_obj isKindOf "zZombie_Base") && !(_obj in _targetMen)) then {
//process man targets
_targetMen set [count _targetMen,_obj];
_targetDis set [count _targetDis,_dis];
};
};
} forEach _targets;
} count _targets;
//Search for fires
if (count _targetMen == 0) then {
@@ -32,15 +32,15 @@ if (count _targetMen == 0) then {
{
private["_dis"];
_dis = _x distance _lead;
if ((_dis < _range) and !(_x in _targetMen)) then {
if ((_dis < _range) && !(_x in _targetMen)) then {
_rnd = random 1;
if (_rnd < 0.5) then {
if ((inflamed _x) or (_x isKindOf "SmokeShell")) then {
if ((inflamed _x) || (_x isKindOf "SmokeShell")) then {
_targetMen set [count _targetMen,_x];
_targetDis set [count _targetDis,_dis];
} else {
if (_x isKindOf "Generator_DZ") then {
if (alive _x and (_x getVariable ["GeneratorRunning", false])) then {
if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
_targetMen set [count _targetMen,_x];
_targetDis set [count _targetDis,_dis];
};
@@ -48,7 +48,7 @@ if (count _targetMen == 0) then {
};
};
};
} forEach _fires;
} count _fires;
};
//Find best target
@@ -68,7 +68,7 @@ if (count _targetMen > 0) then {
_manDis = _dis;
};
_c = _c + 1;
} forEach _targetMen;
} count _targetMen;
_target = _man;
};

View File

@@ -43,7 +43,7 @@ if (count _targets == 0) then
_targets set [count _targets,_x];
_targetDis set [count _targetDis,_dis];
};
} forEach _objects;
} count _objects;
};
//Find best target
@@ -68,7 +68,7 @@ if (count _targets > 0) then
_man = _x;
_manDis = _dis;
};
} forEach _targets;
} count _targets;
_target = _man;
};

View File

@@ -32,21 +32,21 @@ _cantSee = {
_deg = [_xasl, _zPos] call BIS_fnc_dirTo;
_deg = (_deg - _ed + 720) % 360;
if (_deg > 180) then { _deg = _deg - 360; };
if ((abs(_deg) < _fov) AND {( // in right angle sector?
if ((abs(_deg) < _fov) && {( // in right angle sector?
(!(terrainIntersectASL [_zPos, _eye]) // no terrain between?
AND {(!(lineIntersects [_zPos, _eye]))}) // and no object between?
&& {(!(lineIntersects [_zPos, _eye]))}) // && no object between?
)}) then {
_isok = false;
};
};
};
if (!_isok) exitWith {false};
} forEach playableUnits;
} count playableUnits;
_isok
};
if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
if ((dayz_spawnZombies < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
if ([_position, dayz_cantseefov, 10, dayz_cantseeDist] call _cantSee) then {
//Check if anyone close
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
@@ -91,7 +91,7 @@ if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies <
_array = [];
{
_array set [count _array, _x select 0]
} foreach getArray (configFile >> "cfgLoot" >> getText(_lootType));
} count getArray (configFile >> "cfgLoot" >> getText(_lootType));
if (count _array > 0) then {
_index = dayz_CLBase find getText(_lootType);
_weights = dayz_CLChances select _index;