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

@@ -13,7 +13,7 @@ _magazines = getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");
if (_ammoType == "") then {_ammoType = _x;};
if (!(_ammoType in _text)) then {_text set [count _text,_ammoType];};
if (_x in magazines player) exitWith {_ammo = _x;};
} forEach _magazines;
} count _magazines;
if (_ammo != "") then {
_vehicle removeMagazineTurret [_ammo,_turret];
_vehicle addMagazineTurret [_ammo,_turret];

View File

@@ -13,7 +13,7 @@ _hastinitem = false;
_hastinitem = true;
};
} forEach boil_tin_cans;
} count boil_tin_cans;
_bottletext = getText (configFile >> "CfgMagazines" >> "ItemWaterbottle" >> "displayName");
_tin1text = getText (configFile >> "CfgMagazines" >> "TrashTinCan" >> "displayName");
@@ -24,7 +24,7 @@ if (!_hastinitem) exitWith {DZE_ActionInProgress = false; cutText [format[(local
_removed = 0;
if (_hasbottleitem and _hastinitem) then {
if (_hasbottleitem && _hastinitem) then {
_qty = {_x == "ItemWaterbottle"} count magazines player;
if ("ItemWaterbottle" in magazines player) then {

View File

@@ -12,22 +12,22 @@ _maxWeapons = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxW
// Get max backpack count
_maxBackpacks = getNumber (configFile >> "CfgVehicles" >> _class >> "transportmaxbackpacks");
// Count and show magazines available space
// Count && show magazines available space
_magazineCount_raw = getMagazineCargo _vehicle;
// Count and show weapons available space
// Count && show weapons available space
_weaponsCount_raw = getWeaponCargo _vehicle;
// Count and show backpacks available space
// Count && show backpacks available space
_backpackCount_raw = getBackpackCargo _vehicle;
// Count and show magazines available space
// Count && show magazines available space
_magazineCount = (_magazineCount_raw select 1) call vehicle_gear_count;
// Count and show weapons available space
// Count && show weapons available space
_weaponsCount = (_weaponsCount_raw select 1) call vehicle_gear_count;
// Count and show weapons available space
// Count && show weapons available space
_backpackCount = (_backpackCount_raw select 1) call vehicle_gear_count;
cutText [format[(localize "str_epoch_player_1"),_magazineCount,_maxMagazines,_weaponsCount,_maxWeapons,_backpackCount,_maxBackpacks], "PLAIN DOWN"];

View File

@@ -43,7 +43,7 @@ _cookedmeat = meatcooked;
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -74,7 +74,7 @@ _cookedmeat = meatcooked;
cutText [format[(localize "str_epoch_player_130"),_textraw], "PLAIN DOWN"];
};
};
} forEach _rawmeat;
} count _rawmeat;
s_player_cook = -1;
DZE_ActionInProgress = false;

View File

@@ -7,7 +7,7 @@ if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D
_handled = true;
};
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3)) then {
if ((_dikCode == 0x3E || _dikCode == 0x0F || _dikCode == 0xD3)) then {
if(diag_tickTime - dayz_lastCheckBit > 10) then {
dayz_lastCheckBit = diag_tickTime;
call dayz_forceSave;
@@ -31,9 +31,9 @@ if (_dikCode in actionKeys "Surrender") then {
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle);
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder && !_inVehicle);
if (_canDo and !DZE_Surrender and !(player isKindOf "PZombie_VB")) then {
if (_canDo && !DZE_Surrender && !(player isKindOf "PZombie_VB")) then {
DZE_Surrender = true;
_dropPrimary = false;
_dropSecondary = false;
@@ -45,10 +45,10 @@ if (_dikCode in actionKeys "Surrender") then {
if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
_secondaryWeapon = _x;
};
} forEach (weapons player);
} count (weapons player);
if (_secondaryWeapon != "") then {_dropSecondary = true;};
if (_dropPrimary or _dropSecondary) then {
if (_dropPrimary || _dropSecondary) then {
player playActionNow "PutDown";
_iPos = getPosATL player;
_radius = 1;
@@ -85,15 +85,15 @@ if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true; if (DZE_Su
if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
//Prevent exploit of drag body
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) exitWith { force_dropBody = true; };
if ((_dikCode in actionKeys "Prone") && r_drag_sqf) exitWith { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") && r_drag_sqf) exitWith { force_dropBody = true; };
_shift = _this select 2;
_ctrl = _this select 3;
_alt = _this select 4;
//diag_log format["Keypress: %1", _this];
if ((_dikCode in actionKeys "Gear") and (vehicle player != player) and !_shift and !_ctrl and !_alt && !dialog) then {
if ((_dikCode in actionKeys "Gear") && (vehicle player != player) && !_shift && !_ctrl && !_alt && !dialog) then {
createGearDialog [player, "RscDisplayGear"];
_handled = true;
};
@@ -117,59 +117,59 @@ if (_dikCode in (actionKeys "GetOver")) then {
};
};
//if (_dikCode == 57) then {_handled = true}; // space
//if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
//if (_dikCode in actionKeys 'MoveForward' || _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
if (_dikCode == 210) then {
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
if (_dikCode in actionKeys "PushToTalk" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "VoiceOverNet" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
if (_dikCode in actionKeys "VoiceOverNet" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "PushToTalkDirect" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
if (_dikCode in actionKeys "PushToTalkDirect" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
if (_dikCode in actionKeys "Chat" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
if (_dikCode in actionKeys "User20" && (diag_tickTime - dayz_lastCheckBit > 5)) then {
dayz_lastCheckBit = diag_tickTime;
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
// numpad 8 0x48 now pgup 0xC9 1
if ((_dikCode == 0xC9 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User15")) then {
if ((_dikCode == 0xC9 && (!_alt || !_ctrl)) || (_dikCode in actionKeys "User15")) then {
DZE_Q = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User16")) then {
if ((_dikCode == 0xD1 && (!_alt || !_ctrl)) || (_dikCode in actionKeys "User16")) then {
DZE_Z = true;
};
// numpad 8 0x48 now pgup 0xC9 0.1
if ((_dikCode == 0xC9 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User13")) then {
if ((_dikCode == 0xC9 && (_alt && !_ctrl)) || (_dikCode in actionKeys "User13")) then {
DZE_Q_alt = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User14")) then {
if ((_dikCode == 0xD1 && (_alt && !_ctrl)) || (_dikCode in actionKeys "User14")) then {
DZE_Z_alt = true;
};
// numpad 8 0x48 now pgup 0xC9 0.01
if ((_dikCode == 0xC9 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User7")) then {
if ((_dikCode == 0xC9 && (!_alt && _ctrl)) || (_dikCode in actionKeys "User7")) then {
DZE_Q_ctrl = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")) then {
if ((_dikCode == 0xD1 && (!_alt && _ctrl)) || (_dikCode in actionKeys "User8")) then {
DZE_Z_ctrl = true;
};
@@ -177,15 +177,15 @@ if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")
// numpad 4 0x4B now Q 0x10
if (_dikCode == 0x10 or (_dikCode in actionKeys "User17")) then {
if (_dikCode == 0x10 || (_dikCode in actionKeys "User17")) then {
DZE_4 = true;
};
// numpad 6 0x4D now E 0x12
if (_dikCode == 0x12 or (_dikCode in actionKeys "User18")) then {
if (_dikCode == 0x12 || (_dikCode in actionKeys "User18")) then {
DZE_6 = true;
};
// numpad 5 0x4C now space 0x39
if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then {
if (_dikCode == 0x39 || (_dikCode in actionKeys "User19")) then {
DZE_5 = true;
};

View File

@@ -18,7 +18,7 @@ switch (_type) do {
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
_removed = _removed + ([player,_x] call BIS_fnc_invRemove);
};
} forEach magazines player;
} count magazines player;
if(_removed == _countIn) then {
_handle setFSMVariable ["_hunger",0];
player removeAction s_player_feeddog;

View File

@@ -6,7 +6,7 @@ _handle setFSMVariable ["_command","stay"];
_watchDog = _handle getFSMVariable "_watchDog";
_anim = animationState _dog;
if (_anim == "Dog_SitDown" and _watchDog) then {
if (_anim == "Dog_SitDown" && _watchDog) then {
//[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
//sleep 0.5;
[objNull, _dog, rSwitchMove,"Dog_LieDown"] call RE;

View File

@@ -12,7 +12,7 @@ _handle setFSMVariable ["_watchDog",_watchDog];
_warn = {
private ["_watchDog","_dog","_nearby","_senseSkill","_handle"];
_handle = _this select 0;
while {_watchDog and alive _dog} do {
while {_watchDog && alive _dog} do {
_watchDog = _handle getFSMVariable "_watchDog";
_senseSkill = _handle getFSMVariable "_senseSkill";
if (_watchDog) then {

View File

@@ -9,7 +9,7 @@ _vehicleSrc = _this select 3;
if(!(isNull _vehicleSrc)) then {
_isVehicle = ((_vehicleSrc isKindOf "AllVehicles") and !(_vehicleSrc isKindOf "Man"));
_isVehicle = ((_vehicleSrc isKindOf "AllVehicles") && !(_vehicleSrc isKindOf "Man"));
// If fuel source is vehicle get actual capacity
_configSrcVeh = configFile >> "cfgVehicles" >> TypeOf(_vehicleSrc);
_capacitySrc = getNumber(_configSrcVeh >> "fuelCapacity");
@@ -21,10 +21,10 @@ _findNearestVehicles = nearestObjects [player, ["AllVehicles"], 30];
_findNearestVehicle = [];
{
//diag_log ("FILL = " + str(_x) + " = " + str(_vehicleSrc));
if (alive _x and !(_x == _vehicleSrc) and !(_x isKindOf "Man")) exitWith {
if (alive _x && !(_x == _vehicleSrc) && !(_x isKindOf "Man")) exitWith {
_findNearestVehicle set [(count _findNearestVehicle),_x];
};
} foreach _findNearestVehicles;
} count _findNearestVehicles;
_IsNearVehicle = count (_findNearestVehicle);
@@ -67,7 +67,7 @@ if(_IsNearVehicle >= 1) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -29,7 +29,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -50,9 +50,9 @@ if(!_finished) then {
};
if (_finished) then {
// take jerry can and replace with empty
// take jerry can && replace with empty
if(!(_vehicle getVariable ["GeneratorFilled", false]) and ("ItemJerrycan" in magazines player)) then {
if(!(_vehicle getVariable ["GeneratorFilled", false]) && ("ItemJerrycan" in magazines player)) then {
if(([player,"ItemJerrycan"] call BIS_fnc_invRemove) == 1) then {
player addMagazine "ItemJerrycanEmpty";

View File

@@ -14,7 +14,7 @@ dayz_hasLight = true;
_text = getText (configFile >> "CfgAmmo" >> (typeOf _flare) >> "displayName");
s_player_dropflare = player addAction [format[localize "str_actions_medical_16",_text], "\z\addons\dayz_code\actions\flare_drop.sqf",_flare, 1, false, true, "", ""];
while {(alive _flare) and dayz_hasLight} do {
while {(alive _flare) && dayz_hasLight} do {
sleep 0.1;
};
if (dayz_hasLight) then {

View File

@@ -13,7 +13,7 @@ _type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
if ((_hasKnife || _hasKnifeBlunt) && !_hasHarvested) then {
//Get Animal Type
_isListed = isClass (_config);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
@@ -37,7 +37,7 @@ if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -60,7 +60,7 @@ if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
_hasHarvested = _item getVariable["meatHarvested",false];
if(_finished and !_hasHarvested) then {
if(_finished && !_hasHarvested) then {
_item setVariable["meatHarvested",true,true];

View File

@@ -13,7 +13,7 @@ _type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
//_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
if ((_hasKnife || _hasKnifeBlunt) && !_hasHarvested) then {
//Get Animal Type
//_loop = true;
//_isListed = isClass (_config);
@@ -38,7 +38,7 @@ if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -61,7 +61,7 @@ if ((_hasKnife or _hasKnifeBlunt) and !_hasHarvested) then {
_hasHarvested = _item getVariable["meatHarvested",false];
if(_finished and !_hasHarvested) then {
if(_finished && !_hasHarvested) then {
_item setVariable["meatHarvested",true,true];

View File

@@ -4,7 +4,7 @@ _vehicle = _this select 3;
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_32") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
{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;
_removed = ([player,"ItemHotwireKit",1] call BIS_fnc_invRemove);

View File

@@ -12,10 +12,10 @@ _abort = false;
_fuelCans = [];
{
if(_x == "ItemJerrycanEmpty" or _x == "ItemFuelBarrelEmpty") then {
if(_x == "ItemJerrycanEmpty" || _x == "ItemFuelBarrelEmpty") then {
_fuelCans set [(count _fuelCans),_x];
};
} forEach magazines player;
} count magazines player;
_qty = count _fuelCans;
@@ -29,7 +29,7 @@ _qty = count _fuelCans;
[1,1] call dayz_HungerThirst;
// force animation
player playActionNow "Medic";
// Play sound and alert zombies
// Play sound && alert zombies
_dis=10;
_sfx = "refuel";
@@ -48,7 +48,7 @@ _qty = count _fuelCans;
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -85,7 +85,7 @@ _qty = count _fuelCans;
sleep 1;
if(_abort) exitWith {};
} forEach _fuelCans;
} count _fuelCans;
s_player_fillfuel = -1;
DZE_ActionInProgress = false;

View File

@@ -4,7 +4,7 @@ _vehicle = _this select 3;
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_37") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
{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;
PVDZE_veh_Lock = [_vehicle,true];

View File

@@ -1,4 +1,4 @@
//Code developed by Axe Cop - Massiv improvments and performance tunes by Skaronator
//Code developed by Axe Cop - Massiv improvments && performance tunes by Skaronator
private ["_missing","_missingQty","_proceed","_itemIn","_countIn","_qty","_num_removed","_uniqueID","_removed","_removed_total","_tobe_removed_total","_obj","_objectID","_objectUID","_classname","_location","_dir","_objectCharacterID","_object","_temp_removed_array","_textMissing","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_itemText","_option"];
if (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; };
@@ -21,7 +21,7 @@ _objects_filtered = [];
if (damage _x >= DZE_DamageBeforeMaint) then {
_objects_filtered set [count _objects_filtered, _x];
};
} forEach _objects;
} count _objects;
_objects = _objects_filtered;
// TODO dynamic requirements based on used building parts?
@@ -66,7 +66,7 @@ switch _option do {
_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 _requirements;
} count _requirements;
if (_proceed) then {
player playActionNow "Medic";
@@ -91,8 +91,8 @@ switch _option do {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
} forEach magazines player;
} forEach _requirements;
} count magazines player;
} count _requirements;
// all required items removed from player gear
if (_tobe_removed_total == _removed_total) then {
@@ -100,7 +100,7 @@ switch _option do {
PVDZE_maintainArea = [player,1,_target];
publicVariableServer "PVDZE_maintainArea";
} else {
{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"];
};
} else {
@@ -115,10 +115,10 @@ switch _option do {
_countIn = _x select 1;
_itemText = getText(configFile >> "CfgMagazines" >> _itemIn >> "displayName");
if (_cost != "") then {
_cost = _cost + " and ";
_cost = _cost + " && ";
};
_cost = _cost + (str(_countIn) + " of " + _itemText);
} forEach _requirements;
} count _requirements;
cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"];
};
};

View File

@@ -80,7 +80,7 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >>
};
};
};
} forEach _needNear;
} count _needNear;
if(_abort) exitWith {
@@ -132,24 +132,24 @@ _findNearestPole = [];
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} foreach _findNearestPoles;
} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
// If item is plot pole && another one exists within 45m
if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
if(_IsNearPlot == 0) then {
// Allow building of plot
if(_requireplot == 0 or _isLandFireDZ) then {
if(_requireplot == 0 || _isLandFireDZ) then {
_canBuildOnPlot = true;
};
} else {
// Since there are plots nearby we check for ownership and then for friend status
// Since there are plots nearby we check for ownership && then for friend status
// check nearby plots ownership and then for friend status
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
@@ -184,7 +184,7 @@ _hasrequireditem = true;
{
_hastoolweapon = _x in weapons player;
if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); }
} forEach _require;
} count _require;
_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
@@ -301,7 +301,7 @@ if (_hasrequireditem) then {
_object setDir (getDir _object);
if((_isAllowedUnderGround == 0) and ((_position select 2) < 0)) then {
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
_position set [2,0];
};
@@ -337,7 +337,7 @@ if (_hasrequireditem) then {
if(abs(_objHDiff) > 5) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cannot move up or down more than 5 meters";
_reason = "Cannot move up || down more than 5 meters";
detach _object;
deleteVehicle _object;
};
@@ -379,7 +379,7 @@ if (_hasrequireditem) then {
// Get position based on object
_location = _position;
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
_location set [2,0];
};
@@ -424,11 +424,11 @@ if (_hasrequireditem) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt or (player getVariable["combattimeout", 0] >= time)) then {
if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
r_doLoop = false;
};
if (DZE_cancelBuilding) exitWith {

View File

@@ -21,7 +21,7 @@ _findNearestPole = [];
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} foreach _findNearestPoles;
} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
@@ -31,7 +31,7 @@ if(_IsNearPlot == 0) then {
_canBuildOnPlot = true;
} else {
// check nearby plots ownership and then for friend status
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
@@ -110,7 +110,7 @@ if ((count _upgrade) > 0) then {
if (_abortInvAdd) exitWith {};
} forEach _refund;
} count _refund;
// all parts added proceed
if(_i != 0) then {
@@ -150,7 +150,7 @@ if ((count _upgrade) > 0) then {
cutText [format[(localize "str_epoch_player_143"), _i,(getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName"))], "PLAIN DOWN"];
{
[player,(_x select 0),(_x select 1)] call BIS_fnc_invRemove;
} forEach _addedItems;
} count _addedItems;
};

View File

@@ -45,7 +45,7 @@ _proceed = true;
_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 _requirements;
} count _requirements;
if (_proceed) then {
[1,1] call dayz_HungerThirst;
@@ -73,9 +73,9 @@ if (_proceed) then {
};
};
} forEach magazines player;
} count magazines player;
} forEach _requirements;
} count _requirements;
// all parts removed proceed
if (_tobe_removed_total == _removed_total) then {
@@ -86,7 +86,7 @@ if (_proceed) then {
} else {
{player addMagazine _x;} forEach _temp_removed_array;
{player addMagazine _x;} count _temp_removed_array;
cutText [format[(localize "str_epoch_player_145"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
};

View File

@@ -42,7 +42,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -1,6 +1,6 @@
/*
count player magazines with ammo count
value = call player_countMagazines; //must be called from a spawned thread (or use spawn)
value = call player_countMagazines; //must be called from a spawned thread (|| use spawn)
return all player magazines with ammo count
Modified to save backpack magazine count by icomrade - Base for fix by Ziellos2k
*/

View File

@@ -1,6 +1,6 @@
/*
DayZ Epoch Crafting 0.3
Made for DayZ Epoch and Unleashed by [VB]AWOL please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
Made for DayZ Epoch && Unleashed by [VB]AWOL please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
Thanks to thevisad for help with the spawn call fixes.
USAGE EXAMPLE:
@@ -9,7 +9,7 @@ class ItemActions
class Crafting
{
text = "Craft Tent";
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;"; // [Class of itemaction,CfgMagazines or CfgWeapons, item]
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;"; // [Class of itemaction,CfgMagazines || CfgWeapons, item]
neednearby[] = {"workshop","fire"};
requiretools[] = {"ItemToolbox","ItemKnife"}; // (cfgweapons only)
output[] = {{"ItemTent",1}}; // (CfgMagazines, qty)
@@ -39,7 +39,7 @@ _reason = "";
_waterLevel = 0;
_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);
// Need Near Requirements
_needNear = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "neednearby");
@@ -95,7 +95,7 @@ if (_canDo) then {
{
_hastoolweapon = _x in weapons player;
if(!_hastoolweapon) exitWith { _craft_doLoop = false; _missingTools = true; _missing = _x; };
} forEach _selectedRecipeTools;
} count _selectedRecipeTools;
if(!_missingTools) then {
@@ -111,7 +111,7 @@ if (_canDo) then {
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
} forEach _selectedRecipeInput;
} count _selectedRecipeInput;
};
// If all parts proceed
@@ -137,7 +137,7 @@ if (_canDo) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -173,7 +173,7 @@ if (_canDo) then {
};
};
};
} forEach magazines player;
} count magazines player;
{
_configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
@@ -194,9 +194,9 @@ if (_canDo) then {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
} forEach magazines player;
} count magazines player;
} forEach _selectedRecipeInput;
} count _selectedRecipeInput;
//diag_log format["removed: %1 of: %2", _removed, _tobe_removed_total];
@@ -205,7 +205,7 @@ if (_canDo) then {
_num_removed_weapons = 0;
{
_num_removed_weapons = _num_removed_weapons + ([player,_x] call BIS_fnc_invRemove);
} forEach _inputWeapons;
} count _inputWeapons;
if (_num_removed_weapons == (count _inputWeapons)) then {
if(_randomOutput == 1) then {
_outputWeapons = [];
@@ -223,7 +223,7 @@ if (_canDo) then {
};
{
player addWeapon _x;
} forEach _outputWeapons;
} count _outputWeapons;
{
_itemOut = _x select 0;
@@ -250,14 +250,14 @@ if (_canDo) then {
// sleep here
sleep 1;
} forEach _selectedRecipeOutput;
} count _selectedRecipeOutput;
_tradeComplete = _tradeComplete+1;
};
} else {
// Refund parts since we failed
{player addMagazine _x;} forEach _temp_removed_array;
{player addMagazine _x;} count _temp_removed_array;
cutText [format[(localize "str_epoch_player_151"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
};

View File

@@ -19,7 +19,7 @@ _invehicle = false;
_config = configFile >> "CfgMagazines" >> _itemorignal;
_text = getText (_config >> "displayName");
//getting type of sfx (now just drink od soda open and drink)
//getting type of sfx (now just drink od soda open && drink)
_sfx = getText (_config >> "sfx");
if (!_hasdrinkitem) exitWith {cutText [format[(localize "str_player_31"),_text,"drink"] , "PLAIN DOWN"]};
@@ -35,14 +35,14 @@ if (vehicle player != player) then {
sleep 1;
if (["ItemWaterbottle",_itemorignal] call fnc_inString) then {
//low alert and sound radius
//low alert && sound radius
_dis=5;
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
player addMagazine "ItemWaterbottleUnfilled";
};
if (["ItemSoda",_itemorignal] call fnc_inString) then {
//higher alert and sound radius
//higher alert && sound radius
_dis=10;
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
@@ -71,7 +71,7 @@ if (_hasoutput && _invehicle) then {
};
//add infection chance for "ItemWaterbottle",
if ((random 15 < 1) and (_itemorignal == "ItemWaterbottle")) then {
if ((random 15 < 1) && (_itemorignal == "ItemWaterbottle")) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};

View File

@@ -70,12 +70,12 @@ if (_hasoutput && _invehicle) then {
(vehicle player) addMagazineCargoGlobal [_itemtodrop,1];
};
if (_rawfood and !_rawexceptions and (random 15 < 1)) then {
if (_rawfood && !_rawexceptions && (random 15 < 1)) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
if (_badfood and (random 2 < 1)) then {
if (_badfood && (random 2 < 1)) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};

View File

@@ -21,4 +21,4 @@ _findNearestlight = [];
};
};
} foreach nearestObjects [([player] call FNC_getPos), [], 20];
} count nearestObjects [([player] call FNC_getPos), [], 20];

View File

@@ -31,7 +31,7 @@ r_interrupt = false;
while {_isOk} do {
if (r_interrupt or (player getVariable["combattimeout", 0] >= time)) then {
if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
_isOk = false;
cutText [(localize "str_epoch_player_68"), "PLAIN DOWN"];
} else {

View File

@@ -39,7 +39,7 @@ _findNearestTree = [];
};
};
} foreach nearestObjects [([player] call FNC_getPos), [], 10];
} count nearestObjects [([player] call FNC_getPos), [], 10];
//diag_log format["DEBUG TREES: %1", _findNearestTree];
@@ -68,7 +68,7 @@ if (count(_findNearestTree) >= 1) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
[player,"chopwood",0,false] call dayz_zombieSpeak;

View File

@@ -38,7 +38,7 @@ while {r_doLoop} do {
_height = (_posL select 2) - (_posC select 2);
/*
if(_height < 20) then {
if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
_moved = true;
};
} else {
@@ -57,7 +57,7 @@ while {r_doLoop} do {
r_doLoop = false;
_finished = true;
};
if (r_interrupt or _moved or (typeName _attached == "OBJECT") or (typeName _hasAttached == "OBJECT")) then {
if (r_interrupt || _moved || (typeName _attached == "OBJECT") || (typeName _hasAttached == "OBJECT")) then {
r_doLoop = false;
};
sleep 0.1;
@@ -90,10 +90,10 @@ if(_finished) then {
player playActionNow "stop";
cutText [format["the lift heli moved to much from the vehicle that was being lifted!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
} else {
if((typeName _attached == "OBJECT") or (typeName _hasAttached == "OBJECT")) then {
if((typeName _attached == "OBJECT") || (typeName _hasAttached == "OBJECT")) then {
player switchMove "";
player playActionNow "stop";
cutText [format["Another vehicle was attached or the vehicle was attached to another heli!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
cutText [format["Another vehicle was attached || the vehicle was attached to another heli!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
} else {
r_interrupt = false;
player switchMove "";

View File

@@ -91,10 +91,10 @@ _qtynew_create_mags_full = floor(_qtynew_create_ammo/_create_magsize);
_qtynew_consume_ammo_rest = _qtynew_consume_ammo - (_qtynew_consume_mags_full*_consume_magsize);
_qtynew_create_ammo_rest = _qtynew_create_ammo - (_qtynew_create_mags_full*_create_magsize);
// abort if no complete mags or partial mag is less than 15% full
if(_qtynew_create_ammo_rest > 0 and _qtynew_create_ammo_rest < (_create_magsize*0.85)) exitWith { cutText [(localize "str_epoch_player_81"), "PLAIN DOWN"]; };
// abort if no complete mags || partial mag is less than 15% full
if(_qtynew_create_ammo_rest > 0 && _qtynew_create_ammo_rest < (_create_magsize*0.85)) exitWith { cutText [(localize "str_epoch_player_81"), "PLAIN DOWN"]; };
//remove all _consume and _create mags (we already have total ammo count)
//remove all _consume && _create mags (we already have total ammo count)
player removeMagazines _consume;
player removeMagazines _create;

View File

@@ -22,7 +22,7 @@ _findNearestPole = [];
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} foreach _findNearestPoles;
} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
@@ -32,7 +32,7 @@ if(_IsNearPlot == 0) then {
_canBuildOnPlot = true;
} else {
// check nearby plots ownership and then for friend status
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
// Find owner
@@ -95,7 +95,7 @@ if ((count _upgrade) > 0) 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 _requirements;
} count _requirements;
if (_proceed) then {
[1,1] call dayz_HungerThirst;
@@ -123,9 +123,9 @@ if ((count _upgrade) > 0) then {
};
};
} forEach magazines player;
} count magazines player;
} forEach _requirements;
} count _requirements;
// all parts removed proceed
if (_tobe_removed_total == _removed_total) then {
@@ -171,7 +171,7 @@ if ((count _upgrade) > 0) then {
} else {
{player addMagazine _x;} forEach _temp_removed_array;
{player addMagazine _x;} count _temp_removed_array;
cutText [format[(localize "str_epoch_player_145"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
};

View File

@@ -10,7 +10,7 @@ if (!isNull cursorTarget) then {
if(player distance _ent < 5) then {
if (_ent isKindOf "Animal" or _isZombie) then {
if (_ent isKindOf "Animal" || _isZombie) then {
_ent setDamage 1;
} else {
/* PVS/PVC - Skaronator */

View File

@@ -69,7 +69,7 @@ if(!(alive _item)) then {
[player,"eat",0,false] call dayz_zombieSpeak;
// todo: dump loot on ground and then remove
// todo: dump loot on ground && then remove
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';

View File

@@ -18,7 +18,7 @@ _index = 0;
_NV set [_index,(_NV select _index) + _x];
_index =_index + 1;
} forEach _increase;
} count _increase;
// set rgb + m
player setVariable [_NVx, _NV];

View File

@@ -16,7 +16,7 @@ _nameText = getText(_configVeh >> "displayName");
// _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
_availableCans = ["ItemJerrycan","ItemFuelBarrel"];
// Loop to find containers that can could hold fuel and fill them
// Loop to find containers that can could hold fuel && fill them
{
_configCan = configFile >> "CfgMagazines" >> _x;
@@ -61,7 +61,7 @@ _availableCans = ["ItemJerrycan","ItemFuelBarrel"];
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -146,6 +146,6 @@ _availableCans = ["ItemJerrycan","ItemFuelBarrel"];
// exit if abort flag was set
if(_abort) exitWith {};
} forEach magazines player;
} count magazines player;
DZE_ActionInProgress = false;

View File

@@ -47,7 +47,7 @@ else {
_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], 30];
_findNearestPole = [];
{if (alive _x) then {_findNearestPole set [(count _findNearestPole),_x];};} foreach _findNearestPoles;
{if (alive _x) then {_findNearestPole set [(count _findNearestPole),_x];};} count _findNearestPoles;
_IsNearPlot = count (_findNearestPole);
@@ -109,7 +109,7 @@ while {_isOk} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
_sfx = "repair";
@@ -131,7 +131,7 @@ while {_isOk} do {
if(_finished) then {
_counter = _counter + 1;
// 10% chance to break a required tool each pass
if((_isDestructable or _isRemovable) and !_isOwnerOfObj) then {
if((_isDestructable || _isRemovable) && !_isOwnerOfObj) then {
if((random 10) <= 1) then {
_brokenTool = true;
};
@@ -217,7 +217,7 @@ if (_proceed) then {
};
// give refund items
if((count _selectedRemoveOutput) > 0 and !_preventRefund) then {
if((count _selectedRemoveOutput) > 0 && !_preventRefund) then {
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
{
_itemOut = _x select 0;
@@ -226,7 +226,7 @@ if (_proceed) then {
_countOut = round((random (_countOut select 1)) + (_countOut select 0));
};
_item addMagazineCargoGlobal [_itemOut,_countOut];
} forEach _selectedRemoveOutput;
} count _selectedRemoveOutput;
_item setposATL _iPos;

View File

@@ -20,7 +20,7 @@ _namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
s_player_repair_crtl = 1;
if (_section and _hasToolbox) then {
if (_section && _hasToolbox) then {
[1,1] call dayz_HungerThirst;
player playActionNow "Medic";
@@ -42,7 +42,7 @@ if (_section and _hasToolbox) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -70,7 +70,7 @@ if (_section and _hasToolbox) then {
//Fix the part
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
//vehicle is owned by whoever is in it, so we have to have each client try and fix it
//vehicle is owned by whoever is in it, so we have to have each client try && fix it
PVDZE_veh_SFix = [_vehicle,_selection,0];
publicVariable "PVDZE_veh_SFix";
if (local _vehicle) then {
@@ -99,7 +99,7 @@ if (_section and _hasToolbox) then {
cutText [format[(localize "str_epoch_player_167"),_namePart], "PLAIN DOWN"];
};
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = objNull;
//check if repaired fully
@@ -110,7 +110,7 @@ _allFixed = true;
if (_damage > 0) exitWith {
_allFixed = false;
};
} forEach _hitpoints;
} count _hitpoints;
//update if repaired
if (_allFixed) then {

View File

@@ -1,4 +1,4 @@
private [];
{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;
dayz_myCursorTarget = objNull;

View File

@@ -2,7 +2,7 @@ private ["_part","_cancel","_color","_allFixed","_percent","_string","_handle","
_vehicle = _this select 3;
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;
_allFixed = true;
@@ -53,7 +53,7 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
s_player_repairActions set [count s_player_repairActions,_handle];
};
} forEach _hitpoints;
} count _hitpoints;
if (_allFixed) then {
_vehicle setDamage 0;
};

View File

@@ -20,7 +20,7 @@ _hasToolbox = "ItemToolbox" in items player;
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
{_vehicle removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{_vehicle removeAction _x} count s_player_repairActions;s_player_repairActions = [];
s_player_repair_crtl = 1;
if (_hasToolbox) then {
@@ -43,7 +43,7 @@ if (_hasToolbox) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -77,7 +77,7 @@ if (_hasToolbox) then {
//break the part
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
//vehicle is owned by whoever is in it, so we have to have each client try and fix it
//vehicle is owned by whoever is in it, so we have to have each client try && fix it
//["PVDZE_veh_SFix",[_vehicle,_selection,1],_vehicle] call broadcastRpcCallIfLocal;
PVDZE_veh_SFix = [_vehicle,_selection,1];

View File

@@ -2,7 +2,7 @@ private ["_part","_cancel","_color","_percent","_string","_handle","_damage","_c
_vehicle = _this select 3;
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;
// _allFixed = true;
@@ -40,10 +40,10 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
};
// allow removal of any lightly damaged parts
if (_damage < 1 and _damage > 0) then {
if (_damage < 1 && _damage > 0) then {
// Do not allow removal of engine or fueltanks
if( _part == "PartGlass" or _part == "PartWheel" ) then {
// Do not allow removal of engine || fueltanks
if( _part == "PartGlass" || _part == "PartWheel" ) then {
_color = "color='#ffff00'"; //yellow
if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
@@ -57,7 +57,7 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
};
};
} forEach _hitpoints;
} count _hitpoints;
if(count _hitpoints > 0 ) then {

View File

@@ -18,7 +18,7 @@ TraderCatList = [];
private ["_index", "_x"];
_index = lbAdd [TraderDialogCatList, _x select 0];
TraderCatList set [count TraderCatList, _x select 1];
} forEach _trader_data;
} count _trader_data;
waitUntil { !dialog };
TraderCurrentCatIndex = -1;
TraderCatList = -1;

View File

@@ -16,7 +16,7 @@ _nameText = getText(_configVeh >> "displayName");
_availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
// _availableCans = ["ItemJerrycan","ItemFuelBarrel"];
// Loop to find containers that can could hold fuel and fill them
// Loop to find containers that can could hold fuel && fill them
{
_configCanEmpty = configFile >> "CfgMagazines" >> _x;
//diag_log format["Looking for: %1", _x];
@@ -70,7 +70,7 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -153,6 +153,6 @@ _availableCansEmpty = ["ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
// exit if abort flag was set
if(_abort) exitWith {};
} forEach magazines player;
} count magazines player;
DZE_ActionInProgress = false;

View File

@@ -29,7 +29,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -51,7 +51,7 @@ if(!_finished) then {
if (_finished) then {
// find sound and delete
// find sound && delete
_soundObject = _vehicle getVariable "GeneratorSound";
deleteVehicle _soundObject;

View File

@@ -28,7 +28,7 @@ _selected = "";
_removed = _removed + ([player,_x] call BIS_fnc_invRemove);
};
if(_removed == 1) exitWith { _selected = _x; };
} forEach magazines player;
} count magazines player;
// Only proceed if removed count matches
if(_removed == _countIn) then {

View File

@@ -29,7 +29,7 @@ _objectsPond = nearestObjects [_playerPos, [], 10];
_isOk = true;
};
};
} forEach _objectsPond;
} count _objectsPond;
//diag_log ("Pitch Tent: " + str(_isok) );

View File

@@ -16,12 +16,12 @@ _allowedSize = _towTruckSize-(_towTruckSize/3);
_findNearestVehicles = nearestObjects [_towTruck, ["Car","Motorcycle"], 10];
_findNearestVehicle = [];
{
if (alive _x and _towTruck != _x) then {
if (alive _x && _towTruck != _x) then {
if([_x,_towTruck] call fnc_isInsideBuilding2) then {
_findNearestVehicle set [(count _findNearestVehicle),_x];
};
};
} foreach _findNearestVehicles;
} count _findNearestVehicles;
_IsNearVehicle = count (_findNearestVehicle);
@@ -54,7 +54,7 @@ if(_IsNearVehicle >= 1) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -78,7 +78,7 @@ if(_IsNearVehicle >= 1) then {
if (_finished) then {
if((sizeOf typeOf _vehicle) <= _allowedSize) then {
if([_vehicle,_towTruck] call fnc_isInsideBuilding2 and ((vectorUp _vehicle) select 2) > 0.5) then {
if([_vehicle,_towTruck] call fnc_isInsideBuilding2 && ((vectorUp _vehicle) select 2) > 0.5) then {
if(typeOf _towTruck == "TOW_DZE" ) then {
_vehicle attachTo [_towTruck,[1.3,-2,2.3]];
_towTruck setVariable ["DZEinTow", true, true];

View File

@@ -43,7 +43,7 @@ if(_inTow) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -43,7 +43,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -184,10 +184,10 @@ if (_finished) then {
_tireDmg = _tireDmg + _damage;
_tires = _tires + 1;
};
} forEach _hitpoints;
} count _hitpoints;
// find average tire damage
if(_tireDmg > 0 and _tires > 0) then {
if(_tireDmg > 0 && _tires > 0) then {
if((_tireDmg / _tires) > 0.75) then {
_okToSell = false;
};
@@ -198,7 +198,7 @@ if (_finished) then {
_notSetup = (_objectID == "0" && _objectUID == "0");
if(local _obj and !isNull _obj and alive _obj and !_notSetup) then {
if(local _obj && !isNull _obj && alive _obj && !_notSetup) then {
if(_okToSell) then {

View File

@@ -49,7 +49,7 @@ if (_qty >= _qty_in) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -143,10 +143,10 @@ if (_qty >= _qty_in) then {
_tireDmg = _tireDmg + _damage;
_tires = _tires + 1;
};
} forEach _hitpoints;
} count _hitpoints;
// find average tire damage
if(_tireDmg > 0 and _tires > 0) then {
if(_tireDmg > 0 && _tires > 0) then {
if((_tireDmg / _tires) > 0.75) then {
_okToSell = false;
};
@@ -155,7 +155,7 @@ if (_qty >= _qty_in) then {
if(_okToSell) then {
if(!isNull _obj and alive _obj) then {
if(!isNull _obj && alive _obj) then {
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
@@ -179,7 +179,7 @@ if (_qty >= _qty_in) then {
};
};
{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;
} else {

View File

@@ -43,7 +43,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -134,7 +134,7 @@ if (_finished) then {
waitUntil {!isNil "_isOk"};
if (_isOk and _isKeyOK) then {
if (_isOk && _isKeyOK) then {
_done = [[[_part_in,_qty_in]],0] call epoch_returnChange;
if (_done) then {
@@ -193,7 +193,7 @@ if (_finished) then {
_notSetup = (_objectID == "0" && _objectUID == "0");
if(local _obj and !isNull _obj and alive _obj and !_notSetup) then {
if(local _obj && !isNull _obj && alive _obj && !_notSetup) then {
PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
publicVariableServer "PVDZE_obj_Delete";

View File

@@ -50,7 +50,7 @@ if (_qty >= _qty_in) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -112,7 +112,7 @@ if (_qty >= _qty_in) then {
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"};
if (_isOk and _isKeyOK) then {
if (_isOk && _isKeyOK) then {
_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
if(_removed == _qty_in) then {
@@ -152,7 +152,7 @@ if (_qty >= _qty_in) then {
_okToSell = false;
};
if(_okToSell and !isNull _obj and alive _obj) then {
if(_okToSell && !isNull _obj && alive _obj) then {
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
@@ -172,7 +172,7 @@ if (_qty >= _qty_in) then {
};
};
{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;
} else {

View File

@@ -43,7 +43,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -134,7 +134,7 @@ if (_finished) then {
waitUntil {!isNil "_isOk"};
if (_isOk and _isKeyOK) then {
if (_isOk && _isKeyOK) then {
_done = [[[_part_in,_qty_in]],0] call epoch_returnChange;
if (_done) then {
@@ -205,10 +205,10 @@ if (_finished) then {
_tireDmg = _tireDmg + _damage;
_tires = _tires + 1;
};
} forEach _hitpoints;
} count _hitpoints;
// find average tire damage
if(_tireDmg > 0 and _tires > 0) then {
if(_tireDmg > 0 && _tires > 0) then {
if((_tireDmg / _tires) > 0.75) then {
_okToSell = false;
};
@@ -220,7 +220,7 @@ if (_finished) then {
_notSetup = (_objectID == "0" && _objectUID == "0");
if(local _obj and !isNull _obj and alive _obj and !_notSetup) then {
if(local _obj && !isNull _obj && alive _obj && !_notSetup) then {
if(_okToSell) then {
@@ -240,7 +240,7 @@ if (_finished) then {
[_activatingPlayer,_x] call BIS_fnc_invRemove;
};
};
} forEach (items _activatingPlayer);
} count (items _activatingPlayer);
// payout
_canAfford = [[[_part_out,_qty_out]],1] call epoch_returnChange;

View File

@@ -43,7 +43,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -182,10 +182,10 @@ if (_finished) then {
_tireDmg = _tireDmg + _damage;
_tires = _tires + 1;
};
} forEach _hitpoints;
} count _hitpoints;
// find average tire damage
if(_tireDmg > 0 and _tires > 0) then {
if(_tireDmg > 0 && _tires > 0) then {
if((_tireDmg / _tires) > 0.75) then {
_okToSell = false;
};
@@ -196,7 +196,7 @@ if (_finished) then {
_notSetup = (_objectID == "0" && _objectUID == "0");
if(local _obj and !isNull _obj and alive _obj and !_notSetup) then {
if(local _obj && !isNull _obj && alive _obj && !_notSetup) then {
if(_okToSell) then {

View File

@@ -54,7 +54,7 @@ if (_qty >= _qty_in) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -120,7 +120,7 @@ if (_qty >= _qty_in) then {
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"};
if (_isOk and _isKeyOK) then {
if (_isOk && _isKeyOK) then {
_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
if(_removed == _qty_in) then {
@@ -170,16 +170,16 @@ if (_qty >= _qty_in) then {
_tireDmg = _tireDmg + _damage;
_tires = _tires + 1;
};
} forEach _hitpoints;
} count _hitpoints;
// find average tire damage
if(_tireDmg > 0 and _tires > 0) then {
if(_tireDmg > 0 && _tires > 0) then {
if((_tireDmg / _tires) > 0.75) then {
_okToSell = false;
};
};
if(local _obj and !isNull _obj and alive _obj) then {
if(local _obj && !isNull _obj && alive _obj) then {
if(_okToSell) then {
@@ -206,7 +206,7 @@ if (_qty >= _qty_in) then {
};
{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;
} else {

View File

@@ -40,7 +40,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -48,7 +48,7 @@ if (_qty >= _qty_in) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -117,7 +117,7 @@ if (_qty >= _qty_in) then {
cutText [format[(localize "str_epoch_player_186"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
{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;
} else {

View File

@@ -1,3 +1,3 @@
private [];
{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;

View File

@@ -81,7 +81,7 @@ while {r_autoTrade} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -71,7 +71,7 @@ for "_x" from 1 to _total_trades do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -56,7 +56,7 @@ for "_x" from 1 to _total_trades do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -3,7 +3,7 @@ private ["_buy","_metals_conversion","_cancel"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_103") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
{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;
_metals_conversion = [
@@ -18,7 +18,7 @@ _metals_conversion = [
_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 _metals_conversion;
} count _metals_conversion;
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];

View File

@@ -33,14 +33,14 @@ if(_buy_o_sell == "sell") then {
_abort = (!(_configName in (weapons player)));
if(_isToolBelt or _isBinocs) then {
if(_isToolBelt || _isBinocs) then {
_msg = "Need the item on your toolbelt before you can sell it.";
};
} else {
// buying item type must NOT exist if rifle or pistol
_msg = "Drop or sell your current weapon before you can buy a new one.";
// buying item type must NOT exist if rifle || pistol
_msg = "Drop || sell your current weapon before you can buy a new one.";
_config = (configFile >> "CfgWeapons" >> _part_out);
_configName = configName(_config);
_wepType = getNumber(_config >> "Type");
@@ -59,12 +59,12 @@ if(_buy_o_sell == "sell") then {
if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
_secondaryWeapon = _x;
};
} forEach (weapons player);
} count (weapons player);
_abort = (_secondaryWeapon != "");
};
if(_isToolBelt or _isBinocs) then {
if(_isToolBelt || _isBinocs) then {
_abort = (_configName in (weapons player));
_msg = "Drop or sell your current toolbelt item before you can buy a new one.";
_msg = "Drop || sell your current toolbelt item before you can buy a new one.";
};
};
@@ -91,7 +91,7 @@ while {r_doLoop} do {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};

View File

@@ -49,7 +49,7 @@ if (_qty >= _qty_in) then {
if (_isMedic) then {
_started = true;
};
if (_started and !_isMedic) then {
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
@@ -107,7 +107,7 @@ if (_qty >= _qty_in) then {
{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;
} else {

View File

@@ -5,7 +5,7 @@ _key = (_this select 3) select 1;
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_37") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
{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;
PVDZE_veh_Lock = [_vehicle,false];

View File

@@ -8,7 +8,7 @@ dayz_combination = "";
if(!isNull dayz_selectedVault) then {
if ((typeOf dayz_selectedVault) == "VaultStorageLocked" or (typeOf dayz_selectedVault) == "VaultStorage") then {
if ((typeOf dayz_selectedVault) == "VaultStorageLocked" || (typeOf dayz_selectedVault) == "VaultStorage") then {
_ok = createdialog "SafeKeyPad";
} else {
_ok = createdialog "KeypadUI";

View File

@@ -101,7 +101,7 @@ _objectsPond = nearestObjects [_playerPos, [], 10];
_isOk = true;
};
};
} forEach _objectsPond;
} count _objectsPond;
deleteVehicle _tmpvault;

View File

@@ -1,6 +1,6 @@
/*
Created exclusively for ArmA2:OA - DayZMod and DayZ Epoch. Script by icomrade.
permission is required to use, alter and/or distribute from the author or project leader.
Created exclusively for ArmA2:OA - DayZMod && DayZ Epoch. Script by icomrade.
permission is required to use, alter &&/|| distribute from the author || project leader.
*/
private ["_array","_count","_action","_driver","_vehicle","_vehicleType","_emptySeat","_emptyGun"];
_array = _this select 3;
@@ -14,7 +14,7 @@ _emptyGun = ((_vehicle emptyPositions "Gunner") - _count);
switch _action do {
case "MoveToPilot": {
if (((_vehicle emptyPositions "Driver") == 0) and (!alive _driver)) then {
if (((_vehicle emptyPositions "Driver") == 0) && (!alive _driver)) then {
_driver action ["EJECT", _vehicle];
sleep 0.5; //wait for ejection
};

View File

@@ -29,7 +29,7 @@ if (!_canFill) then {
//Check for Well
_isWell = ["_well",str(_x),false] call fnc_inString;
if (_isWell) then {_canFill = true};
} forEach _objectsWell;
} count _objectsWell;
};
if (!_canFill) then {
@@ -43,7 +43,7 @@ if (!_canFill) then {
_canFill = true;
};
};
} forEach _objectsPond;
} count _objectsPond;
};
if (_canFill) then {

Binary file not shown.

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;
};
};

Some files were not shown because too many files have changed in this diff Show More