Update private tags

From
e69f8d5306

Moved dog files to the \dog\ folder and pzombie files to the \pzombie\
folder. Also removed some legacy files that are no longer used.

The actions\ and compile\ folders are fully up to date now
This commit is contained in:
ebaydayz
2016-03-30 14:55:45 -04:00
parent 30b29c541e
commit 77e760fe73
91 changed files with 543 additions and 690 deletions

View File

@@ -1,7 +0,0 @@
private ["_items","_b"];
_items = _this;
_b = _items call player_checkItems;
if (_b) then {
_b = _items call player_removeItems;
};
_b

View File

@@ -1,5 +1,5 @@
scriptName "Functions\misc\fn_damageActions.sqf";
if (DZE_ActionInProgress) exitWith {};
#include "\z\addons\dayz_code\util\array.hpp";
/***********************************************************
@@ -7,8 +7,8 @@ scriptName "Functions\misc\fn_damageActions.sqf";
- Function
- [] call fnc_usec_damageActions;
************************************************************/
if (DZE_ActionInProgress) exitWith {};
private ["_action","_weaponName","_turret","_weapons","_assignedRole","_driver","_action1","_action2","_vehicle","_unit","_vehType","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose","_transfuse"];
private ["_menClose","_hasPatient","_vehicle","_inVehicle","_isClose","_assignedRole","_driver","_action","_turret","_weapons","_weaponName","_crew","_unconscious_crew","_patients","_vehType","_unit","_antibiotics","_bloodBags","_unconscious","_lowBlood","_injured","_hasSepsis","_inPain","_legsBroke","_armsBroke","_infected","_hasBandage","_hasSepsisBandage","_hasEpi","_hasMorphine","_hasSplint","_hasPainkillers","_hasEmptyBag","_hasTester","_hasAntibiotics","_hasBloodBag","_vehClose","_hasVehicle","_action1","_action2","_action3","_y","_playerMagazines"];
_menClose = cursorTarget;
_hasPatient = alive _menClose;
@@ -135,7 +135,7 @@ if (isPlayer cursorTarget) then {
if (_hasPatient) then {
//Allow player to drag
if (_unconscious) then {
if(_unconscious) then {
r_action = true;
_action1 = _unit addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\openGear.sqf",_unit, 0, true, true];
_action2 = _unit addAction [localize "str_actions_medical_01", "\z\addons\dayz_code\medical\drag.sqf",_unit, 0, true, true];
@@ -161,43 +161,43 @@ if (isPlayer cursorTarget) then {
r_player_actions set [count r_player_actions,_action];
};
//Allow player to bandage
if (_injured && _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,"ItemBandage"], 0, true, true, "", "'ItemBandage' in magazines player"];
r_player_actions set [count r_player_actions,_action];
};
//Sepsis
if (_hasSepsis && _hasSepsisBandage) then {
if(_hasSepsis && _hasSepsisBandage) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_04", "\z\addons\dayz_code\medical\bandage.sqf",[_unit,"ItemSepsisBandage"], 0, true, true, "", "'ItemBandage' in magazines player"];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Epinephrine
if (_unconscious && _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) && _hasMorphine) then {
if((_legsBroke or _armsBroke) && _hasMorphine) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"ItemMorphine"], 0, true, true, "", "'ItemMorphine' in magazines player"];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give equip_woodensplint
if ((_legsBroke or _armsBroke) && _hasSplint) then {
if((_legsBroke or _armsBroke) && _hasSplint) then {
r_action = true;
_action = _unit addAction [localize "str_actions_medical_06_splint", "\z\addons\dayz_code\medical\brokeBones.sqf",[_unit,"equip_woodensplint"], 0, true, true, "", "'equip_woodensplint' in magazines player"];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to give Painkillers
if (_inPain && _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, "", "'ItemPainkiller' in magazines player"];
r_player_actions set [count r_player_actions,_action];
};
//Allow player to transfuse blood
if (_lowBlood && _hasBloodBag) then {
if(_lowBlood && _hasBloodBag) then {
_transfuse = if (DZE_UseBloodTypes) then {"\z\addons\dayz_code\medical\transfusion.sqf"} else {"\z\addons\dayz_code\medical\transfusion_NoBloodTypes.sqf"};
r_action = true;
_action = _unit addAction [localize "str_actions_medical_08",_transfuse,[_unit], 0, true, true];

View File

@@ -3,28 +3,36 @@ private ["_item","_pos","_nearByPile","_holder"];
//Radius to search for holder
#define PILE_SEARCH_RADIUS 2
//Location to offset the holder
#define PILE_PLAYER_OFFSET [0,0,0]
#define PILE_OFFSET [0,0,0]
_item = _this;
_holder = objNull;
//Lets get the location of the player in the world
_pos = player modeltoWorld PILE_PLAYER_OFFSET;
_pos = player modeltoWorld PILE_OFFSET;
//Check if a holder is close by the player.
_nearByPile= nearestObjects [_pos, ["WeaponHolder","WeaponHolderBase"],PILE_SEARCH_RADIUS];
if (count _nearByPile == 0) then {
//No weapon holders found in the radius, spawn a new one
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
} else {
//Found a near by weapon holder lets select it.
_holder = _nearByPile select 0;
//check to make sure the player can see the selected weapon holder.
_objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true];
//Can you see the current selected weapon holder
if ((count _objects) > 0) then {
//Unable to see the current selected weapon holder within the radius lets create a new one.
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
};
};
//Add the item to the newly created holder or to the new holder.
//Add the item to the holder or to the newly created holder.
_holder addMagazineCargoGlobal [_item,1];
//Make sure the holder spawns behind the physical location of the player
_holder setPosATL (player modeltoWorld PILE_PLAYER_OFFSET);
//Revel the item
player reveal _holder;

View File

@@ -6,8 +6,8 @@
//
/*
Returns true if <position> lies within the sector defined by <center position>,
<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>).
<center angle of sector> and <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
will return true if the vehicle named enemy_tank is within 30 degrees of where the player is pointing.
@@ -15,19 +15,17 @@
// Revision History:
// 09/01/08 0.1 - First cut VBS2
//------------------
private["_dir1","_dir2","_dir3","_small","_large","_x","_y","_r"];
private["_r","_dir1"];
_r = false;
_small = (_this select 1) - ((_this select 2) / 2);
_large = (_this select 1) + ((_this select 2) / 2);
_x = ((_this select 3) select 0) - ((_this select 0) select 0);
_y = ((_this select 3) select 1) - ((_this select 0) select 1);
_xpos = ((_this select 3) select 0) - ((_this select 0) select 0);
_ypos = ((_this select 3) select 1) - ((_this select 0) select 1);
_dir1 = _x atan2 _y;
_dir1 = _xpos atan2 _ypos;
if (_dir1 < 0) then {_dir1 = _dir1 + 360};

View File

@@ -190,7 +190,7 @@ if (DZE_NameTags > 0) then {
if (_isPZombie) then {
if (s_player_callzombies < 0) then {
s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false];
s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\pzombie\call_zombies.sqf",player, 5, true, false];
};
if (DZE_PZATTACK) then {
call pz_attack;
@@ -949,7 +949,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
//Dog
if (_isDog && {_hasRawMeat} && {_isAlive} && {_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];
s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\dog\tame_dog.sqf", _cursorTarget, 1, false, true];
};
} else {
player removeAction s_player_tamedog;

View File

@@ -10,11 +10,12 @@
Returns:
Sun's rise in hours, in the same format as engine's [daytime] command (16.5 == 16:30)
To obtain sun's set, just subtract the result from 24.
Reference:
http://forums.bistudio.com/showthread.php?107476-How-do-I-detect-sundown-sunrise
*/
private ["_lat","_day","_hour","_daytime"];
private["_daytime"];
_lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude");
_day = 360 * (dateToNumber date);
_hour = acos ((24 * sin(_lat) * cos(_day)) / ((12 * cos(_day) - 78) * cos(_lat)));

View File

@@ -1,22 +0,0 @@
private ["_markerstr","_class","_name","_type","_position","_radiusA","_radiusB","_maptype","_config"];
if ("ItemMap_Debug" in items player) then {
// _world = toUpper(worldName);
_maptype = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
_config = configFile >> "CfgWorlds" >> worldName >> "Names";
for "_i" from 0 to (count _config -1) do {
_class = _config select _i; //Returns a conif
_name = getText (_class >> "name");
_type = getText (_class >> "type");
_position = getArray (_class >> "position");
_radiusA = getNumber (_class >> "radiusA");
_radiusB = getNumber (_class >> "radiusB");
if (_type in _maptype) then {
//diag_log(format["Config Type, Name: %1 / Type: %2 / Position: %3, Passed",_name,_type,_position]);
// _rnd = random 1;

View File

@@ -1,19 +1,14 @@
//[unit, selectionName, damage, source, projectile]
//will only run when local to the created object
//record any key hits to the required selection
private ["_zed","_killer","_kills","_array","_type","_humanity"];
private["_killer"];
_array = _this select 0;
_zed = _array select 0;
_killer = _array select 1;
_type = _this select 1;
_array = _this select 0;
_zed = _array select 0;
_killer = _array select 1;
_type = _this select 1;
if (local _zed) then {
_kills = _killer getVariable[_type,0];
_killer setVariable[_type,(_kills + 1),true];
//increase players humanity when zed killed
_humanity = _killer getVariable["humanity",0];
_humanity = _humanity + 5;
_killer setVariable["humanity",_humanity,true];
};

View File

@@ -40,4 +40,4 @@ if (local _animalbody) then {
deleteVehicle _body;
true
};
};
};

View File

@@ -1,21 +1,22 @@
private ["_currentObjects","_currentTypes","_currentQty","_previousTypes","_previousQty","_serial","_itemVal","_itemQty","_oldSerial","_oldQty","_change","_checkObjects"];
//_newObjects = [_previous,weapons player] call player_weaponCheck;
_currentObjects = _this select 0;
_checkObjects = _this select 1;
private["_change","_currentTypes","_currentQty","_previousTypes","_previousQty","_serial"];
_currentObjects = _this select 0;
_checkObjects = _this select 1;
_change = false;
if (count _currentObjects > 1) then {
_currentTypes = _currentObjects select 0;
_currentQty = _currentObjects select 1;
_currentTypes = _currentObjects select 0;
_currentQty = _currentObjects select 1;
} else {
_currentTypes = [];
_currentQty = [];
};
if (count _checkObjects > 1) then {
_previousTypes = _checkObjects select 0;
_previousQty = _checkObjects select 1;
_previousTypes = _checkObjects select 0;
_previousQty = _checkObjects select 1;
} else {
_previousTypes = [];
_previousQty = [];
@@ -27,31 +28,31 @@ _serial = 0;
{
_itemVal = _x;
_itemQty = _currentQty select _serial;
_oldSerial = _previousTypes find _itemVal;
_oldSerial = _previousTypes find _itemVal;
_oldQty = 0;
if (_oldSerial >= 0) then {
_oldQty = _previousQty select _oldSerial;
_oldQty = _previousQty select _oldSerial;
};
if (_itemQty != _oldQty) then {_change = true};
_serial = _serial + 1;
} count _currentTypes;
} forEach _currentTypes;
//Review old loadout
_serial = 0;
{
_itemVal = _x;
_itemQty = _previousQty select _serial;
_oldSerial = _currentTypes find _itemVal;
_oldSerial = _currentTypes find _itemVal;
_oldQty = 0;
if (_oldSerial >= 0) then {
_oldQty = _currentQty select _oldSerial;
_oldQty = _currentQty select _oldSerial;
};
if (_itemQty != _oldQty) then {_change = true};
_serial = _serial + 1;
} count _previousTypes;
_change
_serial = _serial + 1;
} forEach _previousTypes;
_change;

View File

@@ -1,7 +1,8 @@
private["_unit","_hp","_selection","_strH","_dam"];
_unit = _this select 0;
_hp = _this select 1;
_unit = _this select 0;
_hp = _this select 1;
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _unit) >> "HitPoints" >> _hp >> "name");
_strH = "hit_" + (_selection);
_dam = _unit getVariable [_strH,0];
_dam

View File

@@ -1,4 +1,3 @@
private ["_flare","_lightArea","_lightSpark","_type","_color"];
_flare = _this select 0;
_type = _this select 1;
//_sfx = objNull;
@@ -12,14 +11,14 @@ if (!isNull _flare) then {
_lightArea setLightAmbient [0.2,0.01,0.01];
_lightArea setLightBrightness 0.2;
_lightArea lightAttachObject [_flare, [0,0,0]];
//Spark Light
_lightSpark = "#lightpoint" createVehicleLocal (getPosATL _flare);
_lightSpark setLightColor [0.1,0.1,0.1];
_lightSpark setLightAmbient [0.05,0.05,0.05];
_lightSpark setLightBrightness 0.05;
_lightSpark lightAttachObject [_flare, [0,0,0]];
while {alive _flare} do {
_lightArea setLightAmbient [((random 0.2) + 0.2),0.01,0.01];
//_lightArea setLightColor [((random 0.1) + 0.1),0.005,0.005];
@@ -30,7 +29,7 @@ if (!isNull _flare) then {
};
case 1: {
//Spark Light
_color = getArray(configFile >> "cfgAmmo" >> (typeOf _flare) >> "lightColor");
_color = getArray(configFile >> "cfgAmmo" >> (typeOf _flare) >> "lightColor");
_lightSpark = "#lightpoint" createVehicleLocal (getPosATL _flare);
_lightSpark setLightColor _color;
_lightSpark setLightAmbient _color;

View File

@@ -1,13 +1,16 @@
private ["_unit","_selection","_strH","_dam","_damage"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
// this function name is "object_setHit", but it's used to set character limb damages back during a skin change (player_humanityMorph.sqf)
private ["_damage"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if (_selection != "") then {
_strH = "hit_" + (_selection);
_dam = _unit getVariable [_strH,0];
_unit setVariable [_strH,(_dam + _damage)];
if (_selection in USEC_MinorWounds) then {
_unit setHit[_selection,(_dam + _damage)];
diag_log(format["%1: %2 setHit %3 %4", __FILE__, _unit, _selection, (_dam + _damage)]);
};
};
_damage;
_damage

View File

@@ -1,16 +1,16 @@
private ["_unit","_selection","_strH","_dam","_total","_damage"];
_unit = _this select 0;
_selection = _this select 1;
_damage = _this select 2;
if ((_selection != "")) then {
_strH = "hit_" + (_selection);
_dam = _unit getVariable [_strH,0];
_total = (_dam + _damage);
if (_total > 1) then {
_total = 1;
};
_unit setVariable [_strH,_total];
} else {
_damage = 0;
};
_damage;
// private["_unit","_selection","_strH","_dam","_total"];
// _unit = _this select 0;
// _selection = _this select 1;
// _damage = _this select 2;
// if ((_selection != "")) then {
// _strH = "hit_" + (_selection);
// _dam = _unit getVariable [_strH,0];
// _total = (_dam + _damage);
// if (_total > 1) then {
// _total = 1;
// };
// _unit setVariable [_strH,_total];
// } else {
// _damage = 0;
// };
// _damage

View File

@@ -1,10 +1,10 @@
private["_object","_updateObj"];
//check if can pitch here
_object = _this;
if (_object getVariable ["ObjectID",0] > 0) then {
_updateObj = _object getVariable["update",[false,false,false]];
_updateObj set [1,true];
_object setVariable ["update",_updateObj,true];
_object setVariable ["position",(getPosATL _object),true];
};
// private["_object","_updateObj"];
// //check if can pitch here
// _object = _this;
//
// if (_object getVariable ["ObjectID",0] > 0) then {
// _updateObj = _object getVariable["update",[false,false,false]];
// _updateObj set [1,true];
// _object setVariable ["update",_updateObj,true];
// _object setVariable ["position",(getPosATL _object),true];
// };

View File

@@ -1,47 +1,58 @@
private ["_animalssupported","_type","_agent","_favouritezones","_randrefpoint","_PosList","_PosSelect","_Pos","_list"];
_list = (getposATL player) nearEntities [["CAAnimalBase"],dayz_animalDistance];
if ((count _list) < dayz_maxAnimals) then {
_animalssupported = ["Chicken","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","Dog"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
Switch (_type) do {
case "Cow" : {
_animalssupported = ["Cow01","Cow02","Cow03","Cow04","Cow01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
private ["_type"];
_list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance];
if ((count _list < dayz_maxAnimals) and (dayz_currentGlobalAnimals < dayz_maxGlobalAnimals)) then {
//Find where animal likes
_amount = (dayz_maxAnimals - (count _list)) min (dayz_maxGlobalAnimals - dayz_currentGlobalAnimals);
for "_i" from 0 to _amount do {
_animalssupported = ["Chicken","Chicken","Chicken","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","Dog"];
_type = (_animalssupported select floor(random(count _animalssupported)));
switch (_type) do {
case "Cow" : {
_animalssupported = ["Cow01","Cow02","Cow03","Cow04","Cow01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Goat" : {
_animalssupported = ["Goat01_EP1","Goat02_EP1","Goat"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Sheep" : {
_animalssupported = ["Sheep","Sheep02_EP1","Sheep01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Chicken" : {
_animalssupported = ["Hen","Cock"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Dog" : {
_animalssupported = ["DZ_Fin","DZ_Pastor"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
};
case "Goat" : {
_animalssupported = ["Goat01_EP1","Goat02_EP1","Goat"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Sheep" : {
_animalssupported = ["Sheep","Sheep02_EP1","Sheep01_EP1"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Chicken" : {
_animalssupported = ["Hen","Cock"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
};
case "Dog" : {
_animalssupported = ["DZ_Fin","DZ_Pastor"];
_type = (_animalssupported select (floor(random(count _animalssupported))));
_root = configFile >> "CfgVehicles" >> _type;
_favouritezones = getText ( _root >> "favouritezones");
//_randrefpoint = [position player, 10, dayz_animalDistance, 1, 0, 50, 0] call BIS_fnc_findSafePos;
_randrefpoint = getposATL player;
_PosList = selectbestplaces [_randrefpoint,dayz_animalDistance,_favouritezones,10,5];
_PosSelect = _PosList select (floor random (count _PosList));
_Pos = _PosSelect select 0;
_list = _Pos nearEntities [["CAAnimalBase","Man"],50];
if (player distance _Pos < dayz_animalDistance and NOT surfaceIsWater _Pos and (count _list <= 1)) then {
if (_type == "DZ_Pastor") then {
_agent = createAgent [_type, _Pos, [], 0, "NONE"];
} else {
_agent = createAgent [_type, _Pos, [], 0, "FORM"];
};
//Disable simulation
PVDZ_Server_Simulation = [_agent, false];
publicVariableServer "PVDZ_Server_Simulation";
_agent setpos _Pos;
_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
};
uiSleep 1;
};
_favouritezones = getText (configFile >> "CfgVehicles" >> _type >> "favouritezones");
_randrefpoint = getposATL player;
_PosList = selectBestPlaces [_randrefpoint,dayz_animalDistance,_favouritezones,10,5];
_PosSelect = _PosList select (floor(random(count _PosList)));
_Pos = _PosSelect select 0;
_list = _Pos nearEntities [["CAAnimalBase","Man"],50];
if (((player distance _Pos) < dayz_animalDistance) && {!(surfaceIsWater _Pos)} && {(count _list) <= 1}) then {
if (_type == "DZ_Pastor") then { _agent = createAgent [_type, _Pos, [], 0, "NONE"]; } else { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; };
//Disable simulation
PVDZ_Server_Simulation = [_agent, false];
publicVariableServer "PVDZ_Server_Simulation";
_agent setPos _Pos;
_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
};
uiSleep 1;
};
};

View File

@@ -1,30 +1,23 @@
private ["_unit","_ammo","_distance","_weapon","_projectile","_vUp","_endPos","_dir","_height","_bolt","_hitArray","_hitObject","_hitSelection","_config","_hitMemoryPt","_variation","_val","_doLoop","_countr","_magazine"];
_unit = _this select 0;
_weapon = _this select 1;
_ammo = _this select 4;
_magazine = _this select 5;
_projectile = _this select 6;
private ["_endPos","_vUp","_doLoop","_hitArray","_countr","_hitObject","_hitSelection","_config","_hitMemoryPt","_variation","_val","_dir","_bolt","_obj","_unit","_ammo","_projectile","_height"];
_obj = _this select 0;
_unit = _obj select 0;
//_weapon = _obj select 1;
_ammo = _obj select 4;
//_magazine = _obj select 5;
_projectile = _obj select 6;
_projectile = nearestObject [_unit, _ammo];
_projectile = nearestObject [_unit,_ammo];
_vUp = vectorUp _projectile;
_endPos = getPosATL _projectile;
_dir = 0;
if (_magazine == "Quiver") then {
_ammo = player ammo "Crossbow_DZ";
if (_ammo > 0) then {
player removeMagazines "Quiver";
player addMagazine ["Quiver", _ammo];
};
};
while {alive _projectile} do {
_endPos = getPosATL _projectile;
_vUp = vectorUp _projectile;
uiSleep 0.01;
sleep 0.01;
};
_distance = _unit distance _endPos;
//_distance = _unit distance _endPos;
_height = _endPos select 2;
_doLoop = true;
_countr = 0;
@@ -34,27 +27,27 @@ if (_height < 100) then {
_bolt setPosATL _endPos;
_bolt setDir (getDir _unit);
_bolt setVectorUp _vUp;
_hitArray = _unit getVariable["firedHit",[]];
while {_doLoop} do {
_hitArray = _unit getVariable["firedHit",[]];
if (count _hitArray > 0) then {_doLoop = false};
if (_countr > 50) then {_doLoop = false};
_countr = _countr + 1;
uiSleep 0.1;
sleep 0.1;
};
if (count _hitArray > 0) then {
_hitObject = _hitArray select 0;
_hitSelection = _hitArray select 1;
_config = configFile >> "cfgBody" >> _hitSelection;
_hitMemoryPt = getText(_config >> "memoryPoint");
_variation = getNumber(_config >> "variation");
_hitMemoryPt = getText(_config >> "memoryPoint");
_variation = getNumber(_config >> "variation");
_val = [((random (_variation * 2)) - _variation),((random (_variation * 2)) - _variation),((random (_variation * 2)) - _variation)];
_bolt attachTo [_hitObject,_val,_hitMemoryPt];
_dir = ([_hitObject,_unit] call BIS_fnc_relativeDirTo) + 180;
_bolt setDir (_dir);
[_bolt] call FNC_GetSetPos;
_bolt setPos (getPosATL _bolt);
_unit setVariable["firedHit",[]];
_unit setVariable["firedDamage",0,true];
};

View File

@@ -1,49 +1,49 @@
private ["_unit","_projectile","_isInCombat","_currentNear","_projectilespeed","_projectflight","_listNear","_callCount","_nearVehicle"];
_unit = _this select 0;
_projectile = _this select 6;
private ["_currentNear","_listNear","_callCount"];
_unit = _this select 0;
_projectile = _this select 6;
//diag_log ("0");
diag_log ("0");
//_isInComat = _unit getVariable["startcombattimer",0];
//diag_log ("Bullit Speed: " +str(Speed _projectile));
//diag_log ("Bullit Velocity: " +str(velocity _projectile));
diag_log ("Bullit Speed: " +str(Speed _projectile));
diag_log ("Bullit Velocity: " +str(velocity _projectile));
_listNear = [];
_callCount = 0;
//approx 1020 meters
while {(alive _projectile) && !(isNull _projectile) && _callCount < 85;} do {
while {(alive _projectile) && !(isNull _projectile) && (_callCount < 85)} do {
_projectilespeed = Speed _projectile;
_projectflight = (((_projectilespeed / 60) * 1000));
if (_projectflight > 0) then {
uiSleep (12 / (_projectflight));
};
if (alive _projectile && !(isNull _projectile)) then {_currentNear = ([_projectile] call FNC_GetPos) nearEntities [["CAManBase","AllVehicles"],15];};
if (alive _projectile && !(isNull _projectile)) then {_currentNear = (getPosATL _projectile) nearEntities [["CAManBase","AllVehicles"],15];};
_listNear = _listNear + _currentNear;
_callCount = _callCount + 1;
};
//diag_log ("2");
diag_log ("2");
{
_nearVehicle = _x;
_listNear = _listNear - [_x];
//diag_log ("3");
diag_log ("3");
if (isPlayer _nearVehicle) then {
_isInCombat = _nearVehicle getVariable["startcombattimer",0];
if ((alive _nearVehicle) && _isInCombat == 0) then {
if ((alive _nearVehicle) and _isInCombat == 0) then {
_nearVehicle setVariable["startcombattimer", 1];
//diag_log("Now in Combat (Player): " + name _unit);
diag_log("Now in Combat (Player): " + name _unit);
};
};
if (_nearVehicle isKindOf "AllVehicles") then {
{
_isInCombat = _x getVariable["startcombattimer",0];
if (isPlayer _x && _isInCombat == 0 && alive _x) then {
if (isPlayer _x and _isInCombat == 0 and alive _x) then {
_x setVariable["startcombattimer", 1];
//diag_log("Now in Combat (Crew): " + name _x);
diag_log("Now in Combat (Crew): " + name _x);
};
} forEach (crew _nearVehicle);
};

View File

@@ -1,24 +0,0 @@
private ["_target","_id","_pos","_dog","_fsmid","_hasRawMeat","_hasdog"];
_target = _this select 0;
//_caller = _this select 1;
_id = _this select 2;
//_params = _this select 3;
_pos = [_target] call FNC_GetPos;
_hasRawMeat = "FoodSteakRaw" in magazines player;
_hasdog = player getVariable ["dogid", "false"];
if ((_hasRawMeat) && (_hasdog == "false")) then {
player removeMagazine "FoodSteakRaw";
deleteVehicle (_this select 0);
_dog = (group player) createUnit [typeOf _target, _pos, [], 0, "FORM"];
_dog disableAI "FSM";
_fsmid = [_dog, typeOf _target] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
_fsmid setFSMVariable ["_handle", _fsmid];
_target removeAction _id;
player setvariable ["dogid", _fsmid];
} else {
cutText [localize "str_epoch_player_18","PLAIN DOWN"];
};
//handle publicVariables here later.

View File

@@ -28,4 +28,4 @@ if (_ammo isKindOf "RoadFlare") then {
_distance = if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {30} else {60};
};
[_unit,_distance,false,_endPos] call player_alertZombies;
[_unit,_distance,false,_endPos] call player_alertZombies;

View File

@@ -1,7 +1,7 @@
private ["_currentObjects","_newObjects","_checkObjects","_type","_qtyNow","_qtyBefore","_change"];
private ["_newObjects","_change"];
//_newObjects = [_previous,weapons player] call player_weaponCheck;
_currentObjects = _this select 0;
_checkObjects = _this select 1;
_currentObjects = _this select 0;
_checkObjects = _this select 1;
_change = false;
@@ -10,8 +10,8 @@ _newObjects = [];
{
if (!(_x in _newObjects)) then {
_type = _x;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
if (_qtyNow != _qtyBefore) then {
_change = true;
};
@@ -24,8 +24,8 @@ _newObjects = [];
{
if (!(_x in _newObjects)) then {
_type = _x;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
if (_qtyNow != _qtyBefore) then {
_change = true;
};
@@ -33,4 +33,4 @@ _newObjects = [];
};
} forEach _checkObjects;
_change;
_change

View File

@@ -91,4 +91,4 @@ private ["_handled"];
};
};
};
//Launcher Handler
//Launcher Handler

View File

@@ -330,4 +330,4 @@ if (_isVehicle) then {
}; // fi player by foot
};
//_stop = diag_tickTime;
//diag_log format ["%2 Execution Time: %1",_stop - _start, __FILE__];
//diag_log format ["%2 Execution Time: %1",_stop - _start, __FILE__];

View File

@@ -139,4 +139,4 @@ if (_attacked) then {
};
// return true if attacked or near. if so, player_monitor will perform its ridiculous 'while true' loop faster.
(_attacked OR _near)
(_attacked OR _near)

View File

@@ -1,36 +0,0 @@
/*
File: tame_dog.sqf
Author: Kane "Alby" Stone
Description:
Allows a player to tame/domesticate a dog.
Script is applied to object via addAction.
Variables:
_target = Object that action is attached too.
_caller = Object that activates the action.
_id = ID of the action handler.
_dog = Intended target of the script.
*/
private ["_target","_caller","_id","_dog","_fsmid","_animalID"];
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_dog = _this select 3;
player removeMagazine "FoodSteakRaw";
_animalID = _dog getVariable "fsm_handle";
_animalID setFSMVariable ["_isTamed", true];
uiSleep 1;
// diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
if (!moveToCompleted _dog) then {
_dog moveTo ([_dog] call FNC_GetPos);
};
_dog disableAI "FSM";
(group _dog) setBehaviour "AWARE";
_fsmid = [_dog, typeOf _dog] execFSM "\z\addons\dayz_code\system\dog_agent.fsm";
_fsmid setFSMVariable ["_handle", _fsmid];
player setVariable ["dogID", _fsmid];
_dog setVariable ["fsm_handle", _fsmid];
_dog setVariable ["CharacterID", dayz_characterID, true];

View File

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

View File

@@ -1,24 +1,14 @@
private["_unit","_hitPoints","_selection","_killer"];
_unit = _this select 0;
_killer = _this select 1;
_hitPoints = _unit call vehicle_getHitpoints;
{
_selection = getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "HitPoints" >> _x >> "name");
_unit setVariable [_selection, 1, true];
} count _hitPoints;
//_killer = _this select 1;
// ask server to set global damage to 1, save to the hive
if (isServer) then {
[_unit, "killed"] call server_updateObject;
} else {
if (DZE_Debug_Damage && ((!isPlayer _unit) || ((isPlayer _unit) && (vehicle _unit != _unit) && (_unit != _killer)))) then {
PVDZ_veh_Save = [_unit, "killed",_killer];
if (local _unit) then {
if (isServer) then {
[_unit, "killed"] call server_updateObject;
} else {
PVDZ_veh_Save = [_unit, "killed"];
publicVariableServer "PVDZ_veh_Save";
};
publicVariableServer "PVDZ_veh_Save";
};
// everyone removes their EH for this vehicle

View File

@@ -1,79 +0,0 @@
private ["_group","_target","_targetMen","_targetDis","_c","_man","_manDis","_targets","_lead","_rnd","_assigned","_fires","_range"];
_group = _this;
_target = objNull;
_lead = leader _group;
_targetMen = [];
_targetDis = [];
_range = 500;
_assigned = _group getVariable ["targets",[]];
{
_group reveal [_x,4];
} count _assigned;
//Find targets
_targets = _lead nearTargets _range;
{
private["_obj","_dis"];
_obj = _x select 4;
_dis = _obj distance _lead;
if (_obj isKindOf "Man" && ((speed _obj) < 15)) then {
if (!(_obj isKindOf "zZombie_Base") && !(_obj in _targetMen)) then {
//process man targets
_targetMen set [count _targetMen,_obj];
_targetDis set [count _targetDis,_dis];
};
};
} count _targets;
//Search for fires
if (count _targetMen == 0) then {
_fires = nearestObjects [_lead,["Land_Fire","SmokeShell","Generator_DZ"],_range];
{
private["_dis"];
_dis = _x distance _lead;
if ((_dis < _range) && !(_x in _targetMen)) then {
_rnd = random 1;
if (_rnd < 0.5) then {
if ((inflamed _x) || (_x isKindOf "SmokeShell")) then {
_targetMen set [count _targetMen,_x];
_targetDis set [count _targetDis,_dis];
} else {
if (_x isKindOf "Generator_DZ") then {
if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
_targetMen set [count _targetMen,_x];
_targetDis set [count _targetDis,_dis];
};
};
};
};
};
} count _fires;
};
//Find best target
if (count _targetMen > 0) then {
_man = _targetMen select 0;
_manDis = _targetDis select 0;
_c = 0;
{
private["_dis"];
_dis = _targetDis select _c;
if (_dis < _manDis) then {
_man = _x;
_manDis = _dis;
};
if (_x isKindOf "SmokeShell") then {
_man = _x;
_manDis = _dis;
};
_c = _c + 1;
} count _targetMen;
_target = _man;
};
//Check if too far
if (_manDis > _range) then {
_target = objNull;
};
_target;

View File

@@ -1,29 +1,18 @@
private ["_unit","_originalPos","_pos","_chance","_playerpos"];
private["_unit","_originalPos","_pos"];
_unit = _this select 0;
_originalPos = _this select 1;
_pos = getPosATL _unit;
_playerpos = ([player] call FNC_GetPos);
if (count _this > 2) then {
_pos = _this select 2;
} else {
//_unit enableAI "MOVE";
//_unit enableAI "ANIM";
_chance = round(random 12);
if ((_chance % 4) == 0) then {
//_Offset = [0,0,0];
//_playerworldPos = _playerpos modelToWorld _Offset;
_pos = [_playerpos,30,120,4,0,5,0] call BIS_fnc_findSafePos;
} else {
_pos = [_originalPos,10,90,4,0,5,0] call BIS_fnc_findSafePos;
};
if (_unit distance player > 250) then {
_pos = [_playerpos,120,200,4,0,5,0] call BIS_fnc_findSafePos;
};
//_pos = [_originalPos,10,90,4,0,5,0] call BIS_fnc_findSafePos;
_pos = [_originalPos,10,(10 - (random (90 * 2))),0] call fn_selectRandomLocation;
};
/*
if(isNull group _unit) then {
_unit moveTo _pos;
} else {
@@ -31,3 +20,6 @@ if(isNull group _unit) then {
};
_unit forceSpeed 2;
_unit setVariable ["myDest",_pos];
*/
_pos