diff --git a/dayz_code/actions/ammo.sqf b/dayz_code/actions/ammo.sqf
new file mode 100644
index 000000000..299e83d1c
--- /dev/null
+++ b/dayz_code/actions/ammo.sqf
@@ -0,0 +1,24 @@
+private["_ammoType","_vehicle","_ammo","_weapon","_turret","_text","_array","type"];
+_array = _this select 3;
+_vehicle = _array select 0;
+_weapon = _array select 1;
+_turret = _array select 2;
+_ammo = "";
+_text = [];
+
+call r_player_removeActions2;
+_magazines = getArray (configFile >> "cfgWeapons" >> _weapon >> "magazines");
+{
+ _ammoType = getText (configFile >> "cfgMagazines" >> _x >> "displayName");
+ 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;
+if (_ammo != "") then {
+ _vehicle removeMagazineTurret [_ammo,_turret];
+ _vehicle addMagazineTurret [_ammo,_turret];
+ player removeMagazine _ammo;
+ cutText [format["You have successfully loaded %1 ammunition.",_ammoType], "PLAIN DOWN"];
+} else {
+ cutText [format["You need %1 type of ammo to do this.",_text], "PLAIN DOWN"];
+};
\ No newline at end of file
diff --git a/dayz_code/actions/buy_db.sqf b/dayz_code/actions/buy_db.sqf
index 99befa5c8..b5018a394 100644
--- a/dayz_code/actions/buy_db.sqf
+++ b/dayz_code/actions/buy_db.sqf
@@ -11,7 +11,7 @@ _category = (_this select 3) select 1;
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
-publicVariable "dayzTraderMenu";
+publicVariableServer "dayzTraderMenu";
if (isServer) then {
dayzTraderMenu call server_traders;
};
@@ -19,6 +19,7 @@ if (isServer) then {
waitUntil {!isNil "dayzTraderMenuResult"};
/*
+ `id`,
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
@@ -96,10 +97,11 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
if(_qty <= 0) then {
_Display = format["Buy %1 (Out of Stock: %2)", _textPart, _qty];
- _part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
+ //_part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
+ _part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
} else {
_Display = format["Buy %1 for %2 %3 (Available: %4)", _textPart, _in, _textCurrency, _qty];
- _part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart], _order, true, true, "",""];
+ _part = player addAction [_Display, _File,[_name,_bname,_out,_in,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
};
diag_log format["DEBUG TRADER: %1", _part];
diff --git a/dayz_code/actions/dog/feed.sqf b/dayz_code/actions/dog/feed.sqf
index ff2ddf7ba..a1d050f46 100644
--- a/dayz_code/actions/dog/feed.sqf
+++ b/dayz_code/actions/dog/feed.sqf
@@ -1,4 +1,4 @@
-_dog = _this select 0;
+private ["_array", "_handle", "_type", "_onLadder"];
_array = _this select 3;
_handle = _array select 0;
_type = _array select 1;
@@ -12,10 +12,15 @@ switch (_type) do {
case 0: {
player removeMagazine "FoodSteakRaw";
_handle setFSMVariable ["_hunger",0];
+ player removeAction s_player_feeddog;
+ s_player_feeddog = -1;
+
};
case 1: {
player removeMagazine "ItemWaterbottle";
player addMagazine "ItemWaterbottleUnfilled";
- _handle setFSMVariable ["_hunger",0];
+ _handle setFSMVariable ["_thirst",0];
+ player removeAction s_player_waterdog;
+ s_player_waterdog = -1;
};
};
\ No newline at end of file
diff --git a/dayz_code/actions/dog/follow.sqf b/dayz_code/actions/dog/follow.sqf
index cc47bdbe7..4379ed9fe 100644
--- a/dayz_code/actions/dog/follow.sqf
+++ b/dayz_code/actions/dog/follow.sqf
@@ -1,7 +1,8 @@
-_dog = _this select 0;
+private["_array","_handle","_whistle","_dog"];
_array = _this select 3;
_handle = _array select 0;
_whistle = _array select 1;
+_dog = _handle getFSMVariable "_dog";
if(_whistle) then {
[nil,player,rSAY,["dog_callBack", 120]] call RE;
diff --git a/dayz_code/actions/dog/move.sqf b/dayz_code/actions/dog/move.sqf
index 904f9d1a4..bfee7f52c 100644
--- a/dayz_code/actions/dog/move.sqf
+++ b/dayz_code/actions/dog/move.sqf
@@ -1,5 +1,4 @@
-_array = _this select 3;
-_handle = _array;
+private ["_handle"];
+_handle = _this select 3;
_handle setFSMVariable ["_command","move"];
-
diff --git a/dayz_code/actions/dog/speak.sqf b/dayz_code/actions/dog/speak.sqf
index b3ee92e72..add9a4ffb 100644
--- a/dayz_code/actions/dog/speak.sqf
+++ b/dayz_code/actions/dog/speak.sqf
@@ -1,19 +1,5 @@
-_dog = _this select 0;
+private ["_dog"];
+_dog = _this select 3;
+
_dog playActionNow "GestureBark";
-[_dog,"dog_bark",0,false] call dayz_zombieSpeak;
-/*
-_anim = animationState _dog;
-_sitDown = false;
-if(_anim == "Dog_SitDown") then {
- [objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
- sleep 1;
- _sitDown = true;
-};
-
-[objNull, _dog, rSwitchMove,"Dog_StopV2"] call RE;
-
-if (_sitDown) then {
- waitUntil{(animationState _dog) != "Dog_StopV2"};
- [objNull, _dog, rSwitchMove,"Dog_SitDown"] call RE;
-};
-*/
\ No newline at end of file
+[_dog,"dog_bark",0,false] call dayz_zombieSpeak;
\ No newline at end of file
diff --git a/dayz_code/actions/dog/speed.sqf b/dayz_code/actions/dog/speed.sqf
index 065ddf4e2..6e28dfe6b 100644
--- a/dayz_code/actions/dog/speed.sqf
+++ b/dayz_code/actions/dog/speed.sqf
@@ -1,33 +1,16 @@
-//_dog = _this select 0;
+private ["_array", "_handle", "_speed", "_dog"];
_array = _this select 3;
_handle = _array select 0;
-_whistle = _array select 1;
-_forceWalk = _array select 2;
+_speed = _array select 1;
-_dog = _handle getFSMVariable "_dog";
-_maxSpeed = _handle getFSMVariable "_maxSpeed";
+player removeAction s_player_speeddog;
+s_player_speeddog = -1;
-if(player distance _dog < 5) then {
- _whistle = false;
-};
+_dog = _handle getFSMVariable "_dog";
-if(_forceWalk) then {
- _maxSpeed = _maxSpeed - 1;
- if (_maxSpeed < 0) then {
- _maxSpeed = 0;
- };
- if(_whistle) then {
+if(player distance _dog > 5) then {
[nil,player,rSAY,["dog_slowDown", 120]] call RE;
};
-} else {
- _maxSpeed = _maxSpeed + 1;
- if (_maxSpeed > 2) then {
- _maxSpeed = 2;
- };
- if(_whistle) then {
- [nil,player,rSAY,["dog_speedUp", 120]] call RE;
- };
-};
-_handle setFSMVariable ["_maxSpeed",_maxSpeed];
-_handle setFSMVariable ["_forceChange",true];
\ No newline at end of file
+_handle setFSMVariable ["_maxSpeed", _speed];
+_dog setVariable ["currentSpeed", _speed];
\ No newline at end of file
diff --git a/dayz_code/actions/dog/stay.sqf b/dayz_code/actions/dog/stay.sqf
index fa0bb7f32..9b6efc483 100644
--- a/dayz_code/actions/dog/stay.sqf
+++ b/dayz_code/actions/dog/stay.sqf
@@ -1,12 +1,13 @@
-_dog = _this select 0;
+private ["_handle", "_dog", "_standing", "_watchDog", "_anim"];
_handle = _this select 3;
+_dog = _handle getFSMVariable "_dog";
_standing = _handle getFSMVariable "_standing";
_handle setFSMVariable ["_command","stay"];
_watchDog = _handle getFSMVariable "_watchDog";
_anim = animationState _dog;
if (_anim == "Dog_SitDown" and _watchDog) then {
- [objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
- sleep 0.5;
+ //[objNull, _dog, rSwitchMove,"Dog_SitUp"] call RE;
+ //sleep 0.5;
[objNull, _dog, rSwitchMove,"Dog_LieDown"] call RE;
};
\ No newline at end of file
diff --git a/dayz_code/actions/dog/track.sqf b/dayz_code/actions/dog/track.sqf
index 80188d5c0..8060c1fbe 100644
--- a/dayz_code/actions/dog/track.sqf
+++ b/dayz_code/actions/dog/track.sqf
@@ -1,8 +1,5 @@
-_array = _this select 3;
-_handle = _array;
-//_target = _array select 1;
-
-_target = target1;
+private ["_handle"];
+_handle = _this select 3;
_handle setFSMVariable ["_command","track"];
-_handle setFSMVariable ["_target",_target];
+
diff --git a/dayz_code/actions/dog/warn.sqf b/dayz_code/actions/dog/warn.sqf
index 1e8a35ba1..b59ae10bd 100644
--- a/dayz_code/actions/dog/warn.sqf
+++ b/dayz_code/actions/dog/warn.sqf
@@ -1,18 +1,16 @@
-_dog = _this select 0;
+private ["_array", "_handle", "_watchDog", "_dog", "_warn"];
_array = _this select 3;
_handle = _array select 0;
_watchDog = _array select 1;
+_dog = _handle getFSMVariable "_dog";
+
+player removeAction s_player_warndog;
+s_player_warndog = -1;
_handle setFSMVariable ["_watchDog",_watchDog];
-_actionWarn = _handle getFSMVariable "_actionWarn";
-_actionDir = _handle getFSMVariable "_actionDir";
-_dog removeAction _actionWarn;
-
-if (_watchDog) then {
- _actionWarn = _dog addAction ["Quiet",_actionDir + "warn.sqf",[_handle,false], 2, false, true];
- _handle setFSMVariable ["_actionWarn",_actionWarn];
- _handle setFSMVariable ["_idleTime",5];
+_warn = {
+ _handle = _this select 0;
while {_watchDog and alive _dog} do {
_watchDog = _handle getFSMVariable "_watchDog";
_senseSkill = _handle getFSMVariable "_senseSkill";
@@ -20,21 +18,16 @@ if (_watchDog) then {
_nearby = (getPosATL _dog) nearEntities ["CAManBase",_senseSkill];
_nearby = _nearby - [player];
if (count _nearby > 0) then {
- //_chance = (3 - (count _nearby));
- //hintSilent str(_chance);
[_dog,"dog_growl",2,false] call dayz_zombieSpeak;
- } else {
- /*
- _nearby = (getPosATL _dog) nearEntities ["CAAnimalBase",_senseSkill];
- _nearby = _nearby - [_dog];
- [_dog,"dog_bark",1,false] call dayz_zombieSpeak;
- */
};
};
sleep 2;
};
+};
+
+if (_watchDog) then {
+ _handle setFSMVariable ["_idleTime",5];
+ [_handle] spawn _warn;
} else {
- _actionWarn = _dog addAction ["Alert",_actionDir + "warn.sqf",[_handle,true], 2, false, true];
- _handle setFSMVariable ["_actionWarn",_actionWarn];
_handle setFSMVariable ["_idleTime",1];
};
\ No newline at end of file
diff --git a/dayz_code/actions/player_wearClothes.sqf b/dayz_code/actions/player_wearClothes.sqf
index 1c5af84b3..ac60bba97 100644
--- a/dayz_code/actions/player_wearClothes.sqf
+++ b/dayz_code/actions/player_wearClothes.sqf
@@ -40,6 +40,31 @@ switch (_item) do {
case "Skin_Rocket_DZ": {
_model = "Rocket_DZ";
};
+ case "Skin_RU_Policeman_DZ": {
+ _model = "RU_Policeman_DZ";
+ };
+ case "Skin_Pilot_EP1_DZ": {
+ _model = "Pilot_EP1_DZ";
+ };
+ case "Skin_Haris_Press_EP1_DZ": {
+ _model = "Haris_Press_EP1_DZ";
+ };
+ case "Skin_Ins_Soldier_GL_DZ": {
+ _model = "Ins_Soldier_GL_DZ";
+ };
+ case "Skin_GUE_Commander_DZ": {
+ _model = "GUE_Commander_DZ";
+ };
+ case "Skin_Functionary1_EP1_DZ": {
+ _model = "Functionary1_EP1_DZ";
+ };
+ case "Skin_Priest_DZ": {
+ _model = "Priest_DZ";
+ };
+ case "Skin_Rocker2_DZ": {
+ _model = "Rocker2_DZ";
+ };
+
case "Skin_Soldier1_DZ": {
_model = "Soldier1_DZ";
};
diff --git a/dayz_code/actions/sell_db.sqf b/dayz_code/actions/sell_db.sqf
index 59db3089c..6afae3ffb 100644
--- a/dayz_code/actions/sell_db.sqf
+++ b/dayz_code/actions/sell_db.sqf
@@ -11,7 +11,7 @@ _category = (_this select 3) select 1;
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
-publicVariable "dayzTraderMenu";
+publicVariableServer "dayzTraderMenu";
if (isServer) then {
dayzTraderMenu call server_traders;
};
@@ -95,7 +95,7 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
_Display = format["Sell %1 for %2 %3", _textPart, _sqty, _textCurrency];
- _part = player addAction [_Display, _File,[_sname,_name,_out,_in,"sell",_textPart,_textCurrency], _order, true, true, "",""];
+ _part = player addAction [_Display, _File,[_sname,_name,_out,_in,"sell",_textPart,_textCurrency,_header], _order, true, true, "",""];
diag_log format["DEBUG TRADER: %1", _part];
s_player_parts set [count s_player_parts,_part];
diff --git a/dayz_code/actions/tame_dog.sqf b/dayz_code/actions/tame_dog.sqf
new file mode 100644
index 000000000..e4c399ad8
--- /dev/null
+++ b/dayz_code/actions/tame_dog.sqf
@@ -0,0 +1,36 @@
+/*
+ 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", "_pos", "_fsmid"];
+_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];
+sleep 1;
+diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
+if (!moveToCompleted _dog) then {
+ _dog moveTo (position _dog);
+};
+_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];
\ No newline at end of file
diff --git a/dayz_code/actions/trade_any_boat.sqf b/dayz_code/actions/trade_any_boat.sqf
new file mode 100644
index 000000000..5ed2a06f5
--- /dev/null
+++ b/dayz_code/actions/trade_any_boat.sqf
@@ -0,0 +1,107 @@
+private["_position","_veh","_location","_isOk","_backpack","_vehType","_trg","_key","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID"];
+
+// [part_out,part_in, qty_out, qty_in, loc];
+
+_activatingPlayer = _this select 1;
+
+_part_out = (_this select 3) select 0;
+_part_in = (_this select 3) select 1;
+_qty_out = (_this select 3) select 2;
+_qty_in = (_this select 3) select 3;
+_buy_o_sell = (_this select 3) select 4;
+_textPartIn = (_this select 3) select 5;
+_textPartOut = (_this select 3) select 6;
+_traderID = (_this select 3) select 7;
+_bos = 0;
+
+if(_buy_o_sell == "buy") then {
+ _qty = {_x == _part_in} count magazines player;
+} else {
+ _obj = nearestObjects [(getPosATL player), [_part_in], 10];
+ _qty = count _obj;
+ _bos = 1;
+};
+
+
+if (_qty >= _qty_in) then {
+
+ // server_tradeObject [_activatingPlayer,_traderID,_bos]
+ dayzTradeObject = [_activatingPlayer,_traderID,_bos];
+ publicVariableServer "dayzTradeObject";
+
+ if (isServer) then {
+ dayzTradeObject call server_tradeObject;
+ };
+
+ diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject];
+
+ waitUntil {!isNil "dayzTradeResult"};
+
+ diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
+
+ if(dayzTradeResult == "PASS") then {
+
+
+ if(_buy_o_sell == "buy") then {
+ for "_x" from 1 to _qty_in do {
+ player removeMagazine _part_in;
+ };
+
+ _dir = 90;
+
+ _location = [(position player),0,20,1,2,20,0] call BIS_fnc_findSafePos;
+
+ //place tent (local)
+ _veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
+ _veh setdir _dir;
+ _veh setpos _location;
+
+ //_veh setPosATL _position;
+
+ player reveal _veh;
+ _location = getPosATL _veh;
+
+ _veh setVariable ["characterID",dayz_playerUID,true];
+
+ // server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
+ dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
+
+ publicVariableServer "dayzPublishVeh";
+ if (isServer) then {
+ dayzPublishVeh call server_publishVeh;
+ };
+
+ cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ } else {
+ // Sell Vehicle
+ for "_x" from 1 to _qty_out do {
+ player addMagazine _part_out;
+ };
+
+ _obj = _obj select 0;
+ _objectID = _obj getVariable ["ObjectID","0"];
+ _objectUID = _obj getVariable ["ObjectUID","0"];
+
+ dayzDeleteObj = [_objectID,_objectUID];
+ publicVariableServer "dayzDeleteObj";
+ if (isServer) then {
+ dayzDeleteObj call local_deleteObj;
+ };
+
+ deleteVehicle _obj;
+
+ cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ };
+
+ {player removeAction _x} forEach s_player_parts;s_player_parts = [];
+ s_player_parts_crtl = -1;
+
+ } else {
+ cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
+ };
+ dayzTradeResult = nil;
+
+} else {
+ _needed = _qty_in - _qty;
+ cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
+};
\ No newline at end of file
diff --git a/dayz_code/actions/trade_any_vehicle.sqf b/dayz_code/actions/trade_any_vehicle.sqf
index 43d37577d..2248cac5b 100644
--- a/dayz_code/actions/trade_any_vehicle.sqf
+++ b/dayz_code/actions/trade_any_vehicle.sqf
@@ -2,6 +2,8 @@ private["_position","_veh","_location","_isOk","_backpack","_vehType","_trg","_k
// [part_out,part_in, qty_out, qty_in, loc];
+_activatingPlayer = _this select 1;
+
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
@@ -9,70 +11,95 @@ _qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
+_traderID = (_this select 3) select 7;
+_bos = 0;
if(_buy_o_sell == "buy") then {
_qty = {_x == _part_in} count magazines player;
} else {
_obj = nearestObjects [(getPosATL player), [_part_in], 10];
_qty = count _obj;
+ _bos = 1;
};
if (_qty >= _qty_in) then {
- if(_buy_o_sell == "buy") then {
- for "_x" from 1 to _qty_in do {
- player removeMagazine _part_in;
- };
+ // server_tradeObject [_activatingPlayer,_traderID,_bos]
+ dayzTradeObject = [_activatingPlayer,_traderID,_bos];
+ publicVariableServer "dayzTradeObject";
- _dir = 90;
-
- _location = [(position player),0,20,1,0,20,0] call BIS_fnc_findSafePos;
-
- //place tent (local)
- _veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
- _veh setdir _dir;
- _veh setpos _location;
-
- //_veh setPosATL _position;
-
- player reveal _veh;
- _location = getPosATL _veh;
-
- _veh setVariable ["characterID",dayz_playerUID,true];
-
- // server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
- dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
-
- publicVariable "dayzPublishVeh";
- if (isServer) then {
- dayzPublishVeh spawn server_publishVeh;
- };
-
- cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
- } else {
- // Sell Vehicle
- for "_x" from 1 to _qty_out do {
- player addMagazine _part_out;
- };
-
- _obj = _obj select 0;
- _objectID = _obj getVariable ["ObjectID","0"];
- _objectUID = _obj getVariable ["ObjectUID","0"];
-
- dayzDeleteObj = [_objectID,_objectUID];
- publicVariableServer "dayzDeleteObj";
- if (isServer) then {
- dayzDeleteObj call local_deleteObj;
- };
-
- deleteVehicle _obj;
-
- cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ if (isServer) then {
+ dayzTradeObject call server_tradeObject;
};
+
+ diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject];
+
+ waitUntil {!isNil "dayzTradeResult"};
+
+ diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
+
+ if(dayzTradeResult == "PASS") then {
+
+
+ if(_buy_o_sell == "buy") then {
+ for "_x" from 1 to _qty_in do {
+ player removeMagazine _part_in;
+ };
- {player removeAction _x} forEach s_player_parts;s_player_parts = [];
- s_player_parts_crtl = -1;
+ _dir = 90;
+
+ _location = [(position player),0,20,1,0,20,0] call BIS_fnc_findSafePos;
+
+ //place tent (local)
+ _veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
+ _veh setdir _dir;
+ _veh setpos _location;
+
+ //_veh setPosATL _position;
+
+ player reveal _veh;
+ _location = getPosATL _veh;
+
+ _veh setVariable ["characterID",dayz_playerUID,true];
+
+ // server_publishVeh [_veh,[_dir,_objPosition],_vehicle,true,dayz_characterID]
+ dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
+
+ publicVariableServer "dayzPublishVeh";
+ if (isServer) then {
+ dayzPublishVeh call server_publishVeh;
+ };
+
+ cutText [format[("Bought %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ } else {
+ // Sell Vehicle
+ for "_x" from 1 to _qty_out do {
+ player addMagazine _part_out;
+ };
+
+ _obj = _obj select 0;
+ _objectID = _obj getVariable ["ObjectID","0"];
+ _objectUID = _obj getVariable ["ObjectUID","0"];
+
+ dayzDeleteObj = [_objectID,_objectUID];
+ publicVariableServer "dayzDeleteObj";
+ if (isServer) then {
+ dayzDeleteObj call local_deleteObj;
+ };
+
+ deleteVehicle _obj;
+
+ cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ };
+
+ {player removeAction _x} forEach s_player_parts;s_player_parts = [];
+ s_player_parts_crtl = -1;
+
+ } else {
+ cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
+ };
+ dayzTradeResult = nil;
} else {
_needed = _qty_in - _qty;
diff --git a/dayz_code/actions/trade_backpacks.sqf b/dayz_code/actions/trade_backpacks.sqf
index 67e5f95b2..1113a2f44 100644
--- a/dayz_code/actions/trade_backpacks.sqf
+++ b/dayz_code/actions/trade_backpacks.sqf
@@ -1,6 +1,8 @@
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty"];
// [part_out,part_in, qty_out, qty_in,];
+_activatingPlayer = _this select 1;
+
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
@@ -8,10 +10,13 @@ _qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
+_traderID = (_this select 3) select 7;
+_bos = 0;
if(_buy_o_sell == "buy") then {
_qty = {_x == _part_in} count magazines player;
} else {
+ _bos = 1;
_qty = 0;
_bag = unitBackpack player;
_class = typeOf _bag;
@@ -22,25 +27,46 @@ if(_buy_o_sell == "buy") then {
if (_qty >= _qty_in) then {
- if(_buy_o_sell == "buy") then {
- for "_x" from 1 to _qty_in do {
- player removeMagazine _part_in;
- };
- removeBackpack player;
- player addBackpack _part_out;
- } else {
- // Sell
- for "_x" from 1 to _qty_out do {
- player addMagazine _part_out;
- };
- removeBackpack player;
- // player addBackpack _part_out;
+ // server_tradeObject [_activatingPlayer,_traderID,_bos]
+ dayzTradeObject = [_activatingPlayer,_traderID,_bos];
+ publicVariableServer "dayzTradeObject";
+
+ if (isServer) then {
+ dayzTradeObject call server_tradeObject;
};
- cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject];
+
+ waitUntil {!isNil "dayzTradeResult"};
+
+ diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
+
+ if(dayzTradeResult == "PASS") then {
+
+ if(_buy_o_sell == "buy") then {
+ for "_x" from 1 to _qty_in do {
+ player removeMagazine _part_in;
+ };
+ removeBackpack player;
+ player addBackpack _part_out;
+ } else {
+ // Sell
+ for "_x" from 1 to _qty_out do {
+ player addMagazine _part_out;
+ };
+ removeBackpack player;
+ // player addBackpack _part_out;
+ };
+
+ cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
- {player removeAction _x} forEach s_player_parts;s_player_parts = [];
- s_player_parts_crtl = -1;
+ {player removeAction _x} forEach s_player_parts;s_player_parts = [];
+ s_player_parts_crtl = -1;
+
+ } else {
+ cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
+ };
+ dayzTradeResult = nil;
} else {
_needed = _qty_in - _qty;
diff --git a/dayz_code/actions/trade_items.sqf b/dayz_code/actions/trade_items.sqf
index 2c6d7b4bc..5b8c68f9e 100644
--- a/dayz_code/actions/trade_items.sqf
+++ b/dayz_code/actions/trade_items.sqf
@@ -1,6 +1,8 @@
-private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut"];
+private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos"];
// [part_out,part_in, qty_out, qty_in,];
+_activatingPlayer = _this select 1;
+
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
@@ -8,21 +10,48 @@ _qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
+_traderID = (_this select 3) select 7;
_qty = {_x == _part_in} count magazines player;
if (_qty >= _qty_in) then {
- for "_x" from 1 to _qty_in do {
- player removeMagazine _part_in;
+ _bos = 0;
+ if(_buy_o_sell == "sell") then {
+ _bos = 1;
};
+
+ // server_tradeObject [_activatingPlayer,_traderID,_bos]
+ dayzTradeObject = [_activatingPlayer,_traderID,_bos];
+ publicVariableServer "dayzTradeObject";
- for "_x" from 1 to _qty_out do {
- player addMagazine _part_out;
+ if (isServer) then {
+ dayzTradeObject call server_tradeObject;
};
+
+ diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject];
+
+ waitUntil {!isNil "dayzTradeResult"};
+
+ diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
+
+ if(dayzTradeResult == "PASS") then {
+ for "_x" from 1 to _qty_in do {
+ player removeMagazine _part_in;
+ };
+
+ for "_x" from 1 to _qty_out do {
+ player addMagazine _part_out;
+ };
+
+ // [player,"repair",0,false] call dayz_zombieSpeak;
+ cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+ } else {
+ cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
+ };
+ dayzTradeResult = nil;
+
- // [player,"repair",0,false] call dayz_zombieSpeak;
- cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
_needed = _qty_in - _qty;
diff --git a/dayz_code/actions/trade_items_wo_db.sqf b/dayz_code/actions/trade_items_wo_db.sqf
new file mode 100644
index 000000000..e66a5c77f
--- /dev/null
+++ b/dayz_code/actions/trade_items_wo_db.sqf
@@ -0,0 +1,33 @@
+private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos"];
+// [part_out,part_in, qty_out, qty_in,];
+
+//_activatingPlayer = _this select 1;
+
+_part_out = (_this select 3) select 0;
+_part_in = (_this select 3) select 1;
+_qty_out = (_this select 3) select 2;
+_qty_in = (_this select 3) select 3;
+_buy_o_sell = (_this select 3) select 4;
+_textPartIn = (_this select 3) select 5;
+_textPartOut = (_this select 3) select 6;
+//_traderID = (_this select 3) select 7;
+
+_qty = {_x == _part_in} count magazines player;
+
+if (_qty >= _qty_in) then {
+
+ for "_x" from 1 to _qty_in do {
+ player removeMagazine _part_in;
+ };
+
+ for "_x" from 1 to _qty_out do {
+ player addMagazine _part_out;
+ };
+
+ // [player,"repair",0,false] call dayz_zombieSpeak;
+ cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+
+} else {
+ _needed = _qty_in - _qty;
+ cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
+};
\ No newline at end of file
diff --git a/dayz_code/actions/trade_weapons.sqf b/dayz_code/actions/trade_weapons.sqf
index 922ee64d2..9c622c9f8 100644
--- a/dayz_code/actions/trade_weapons.sqf
+++ b/dayz_code/actions/trade_weapons.sqf
@@ -1,6 +1,8 @@
-private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell"];
+private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_traderID","_bos"];
// [part_out,part_in, qty_out, qty_in,"buy"];
+_activatingPlayer = _this select 1;
+
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
@@ -8,37 +10,61 @@ _qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
+_traderID = (_this select 3) select 7;
+_bos = 0;
if(_buy_o_sell == "buy") then {
_qty = {_x == _part_in} count magazines player;
+
} else {
_qty = {_x == _part_in} count weapons player;
+ _bos = 1;
};
if (_qty >= _qty_in) then {
- for "_x" from 1 to _qty_in do {
- if(_buy_o_sell == "buy") then {
- player removeMagazine _part_in;
- } else {
- player removeWeapon _part_in;
- };
- };
-
- for "_x" from 1 to _qty_out do {
- if(_buy_o_sell == "buy") then {
- player addWeapon _part_out;
- } else {
- player addMagazine _part_out;
- };
- };
-
-
- // [player,"repair",0,false] call dayz_zombieSpeak;
- cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
- {player removeAction _x} forEach s_player_parts;s_player_parts = [];
- s_player_parts_crtl = -1;
+ // server_tradeObject [_activatingPlayer,_traderID,_bos]
+ dayzTradeObject = [_activatingPlayer,_traderID,_bos];
+ publicVariableServer "dayzTradeObject";
+
+ if (isServer) then {
+ dayzTradeObject call server_tradeObject;
+ };
+
+ waitUntil {!isNil "dayzTradeResult"};
+
+ diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];
+
+ if(dayzTradeResult == "PASS") then {
+
+ for "_x" from 1 to _qty_in do {
+ if(_buy_o_sell == "buy") then {
+ player removeMagazine _part_in;
+ } else {
+ player removeWeapon _part_in;
+ };
+ };
+
+ for "_x" from 1 to _qty_out do {
+ if(_buy_o_sell == "buy") then {
+ player addWeapon _part_out;
+ } else {
+ player addMagazine _part_out;
+ };
+ };
+
+
+ // [player,"repair",0,false] call dayz_zombieSpeak;
+ cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
+
+ {player removeAction _x} forEach s_player_parts;s_player_parts = [];
+ s_player_parts_crtl = -1;
+
+ } else {
+ cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
+ };
+ dayzTradeResult = nil;
} else {
_needed = _qty_in - _qty;
diff --git a/dayz_code/cfgVehicles.hpp b/dayz_code/cfgVehicles.hpp
index fdbafc485..7afbe5b90 100644
--- a/dayz_code/cfgVehicles.hpp
+++ b/dayz_code/cfgVehicles.hpp
@@ -14,9 +14,97 @@ class CfgVehicles {
class MainTurret: NewTurret
{
class Turrets;
+ class ViewOptics;
};
};
};
+
+ class Mi17_base: Helicopter
+ {
+ class Turrets: Turrets
+ {
+ class MainTurret: MainTurret
+ {
+ class ViewOptics: ViewOptics {};
+ class Turrets: Turrets {};
+ };
+ class BackTurret: MainTurret
+ {
+ class Turrets: Turrets {};
+ };
+ };
+ };
+
+ class Mi17_DZ: Mi17_base
+ {
+ displayName = "Mi17_DZ";
+ scope = 2;
+ side = 2;
+ crew = "";
+ maxSpeed = 180; // max speed on level road, km/h
+ typicalCargo[] = {};
+ hiddenSelections[] = {};
+ class TransportMagazines{};
+ class TransportWeapons{};
+ commanderCanSee = 2+16+32;
+ gunnerCanSee = 2+16+32;
+ driverCanSee = 2+16+32;
+
+ class Turrets : Turrets
+ {
+ class MainTurret : MainTurret
+ {
+ magazines[] = {"100Rnd_762x54_PK"};
+ };
+ class BackTurret : BackTurret
+ {
+ magazines[] = {"100Rnd_762x54_PK"};
+ };
+ };
+ };
+
+ class UH1H_base: Helicopter
+ {
+ class Turrets: Turrets
+ {
+ class MainTurret: MainTurret
+ {
+ class ViewOptics: ViewOptics {};
+ class Turrets: Turrets {};
+ };
+ class LeftDoorGun: MainTurret
+ {
+ class Turrets: Turrets {};
+ };
+ };
+ };
+
+ class UH1H_DZ: UH1H_base
+ {
+ scope = 2;
+ side = 2;
+ crew = "";
+ typicalCargo[] = {};
+ hiddenSelections[] = {};
+ class TransportMagazines{};
+ class TransportWeapons{};
+ commanderCanSee = 2+16+32;
+ gunnerCanSee = 2+16+32;
+ driverCanSee = 2+16+32;
+
+ class Turrets : Turrets
+ {
+ class MainTurret : MainTurret
+ {
+ magazines[] = {"100Rnd_762x51_M240"};
+ };
+ class LeftDoorGun : LeftDoorGun
+ {
+ magazines[] = {"100Rnd_762x51_M240"};
+ };
+ };
+ };
+
class Animal;
class Pastor;
class Fin;
@@ -61,12 +149,23 @@ class CfgVehicles {
};
class DZ_Pastor : Pastor {
scope = 2;
+ side = 1;
model = "\ca\animals2\Dogs\Pastor\Pastor";
displayName = "Alsatian";
moves = "CfgMovesDogDZ";
gestures = "CfgGesturesDogDZ";
fsmDanger = "";
fsmFormation = "";
+ agentTasks[] = {};
+ woman = 0;
+ class EventHandlers{};
+ class Wounds
+ {
+ tex[] = {};
+ mat[] = {};
+ };
+ class VariablesScalar {};
+ class VariablesString {};
};
class DZ_Fin : Fin {
@@ -96,7 +195,7 @@ class CfgVehicles {
class BAF_Soldier_Officer_W;
class Rocket_DZ: BAF_Soldier_Officer_W {
- displayName = "Rocket";
+ displayName = "Officer";
side = 1;
weapons[] = {"Throw","Put"};
backpack = "";
@@ -106,6 +205,105 @@ class CfgVehicles {
weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
canHideBodies = 1;
};
+ class RU_Policeman;
+ class RU_Policeman_DZ: RU_Policeman {
+ displayName = "Policeman";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Pilot_EP1;
+ class Pilot_EP1_DZ: Pilot_EP1 {
+ displayName = "Pilot";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Haris_Press_EP1;
+ class Haris_Press_EP1_DZ: Haris_Press_EP1 {
+ displayName = "Press";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Ins_Soldier_GL;
+ class Ins_Soldier_GL_DZ: Ins_Soldier_GL {
+ displayName = "Terrorist";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class GUE_Commander;
+ class GUE_Commander_DZ: GUE_Commander {
+ displayName = "Rebel";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Functionary1_EP1;
+ class Functionary1_EP1_DZ: Functionary1_EP1 {
+ displayName = "Business Suit";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Priest;
+ class Priest_DZ: Priest {
+ displayName = "Priest Outfit";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+ class Rocker2;
+ class Rocker2_DZ: Rocker2 {
+ displayName = "Rocker Outfit";
+ side = 1;
+ weapons[] = {"Throw","Put"};
+ backpack = "";
+ magazines[] = {};
+ respawnWeapons[] = {"Throw","Put"};
+ respawnMagazines[] = {};
+ weaponSlots = "1 + 4 + 12* 256 + 2* 4096 + 2 + 8* 16 + 12*131072";
+ canHideBodies = 1;
+ };
+
+
+
class BAF_Soldier_W;
class Soldier1_DZ: BAF_Soldier_W {
displayName = "Soldier";
@@ -198,108 +396,6 @@ class CfgVehicles {
transportMaxWeapons = 6;
transportMaxMagazines = 24;
};
- class UH1H_base;
- class UH1H_DZ: UH1H_base
- {
- scope = 2;
- side = 2;
- crew = "";
- typicalCargo[] = {};
- hiddenSelections[] = {};
- class TransportMagazines{};
- class TransportWeapons{};
- commanderCanSee = 2+16+32;
- gunnerCanSee = 2+16+32;
- driverCanSee = 2+16+32;
- };
-
- class Mi17_base : Helicopter
- {
- class Turrets: Turrets
- {
- class MainTurret: MainTurret
- {
- minElev = -80;
- maxElev = 25;
- initElev = -80;
- minTurn = 30;
- maxTurn = 150;
- initTurn = 90;
- class ViewOptics {
- initAngleX = 0;
- minAngleX = -30;
- maxAngleX = 30;
- initAngleY = 0;
- minAngleY = -100;
- maxAngleY = 100;
- initFov = 0.7;
- minFov = 0.25;
- maxFov = 1.1;
- };
- class Turrets: Turrets {};
- };
- class BackTurret : MainTurret
- {
- minElev = -80;
- maxElev = 25;
- initElev = -80;
- minTurn = -185;
- maxTurn = -45;
- initTurn = -155;
- class Turrets: Turrets {};
- };
- };
- };
- class Mi17_DZ: Mi17_base
- {
- displayName = "Mi17_DZ";
- scope = 2;
- side = 2;
- crew = "";
- maxSpeed = 180; // max speed on level road, km/h
- typicalCargo[] = {};
- hiddenSelectionsTextures[] = {"\ca\air_E\Data\mi17_body_IND_CO.paa", "\ca\air_E\Data\mi17_det_IND_CO.paa", "\ca\air\data\clear_empty.paa", "\ca\air\data\mi8_decals_ca.paa"};
- class Turrets : Turrets {
- class FrontTurret : MainTurret {
- weapons[] = {PKT_2};
- magazines[] = {"100Rnd_762x54_PK"};
- };
- class BackTurret : BackTurret {
- weapons[] = {PKT_2};
- magazines[] = {"100Rnd_762x54_PK"};
- };
- };
- class AnimationSources : AnimationSources {
- class ReloadAnim {
- source = "reload";
- weapon = PKT;
- };
- class ReloadMagazine {
- source = "reloadmagazine";
- weapon = PKT;
- };
- class Revolving {
- source = "revolving";
- weapon = PKT;
- };
- class ReloadAnim_2 {
- source = "reload";
- weapon = PKT_2;
- };
- class ReloadMagazine_2 {
- source = "reloadmagazine";
- weapon = PKT_2;
- };
- class Revolving_2 {
- source = "revolving";
- weapon = PKT_2;
- };
- };
- gunnerHasFlares = false;
- commanderCanSee = 2+16+32;
- gunnerCanSee = 2+16+32;
- driverCanSee = 2+16+32;
- };
//An2_TK_EP1
class An2_Base_EP1;
class AN2_DZ: An2_Base_EP1
@@ -347,7 +443,11 @@ class CfgVehicles {
class House {
class DestructionEffects;
};
- class UH1Wreck_DZ: House
+
+ // This parent class is made to make referring to these objects easier later with allMissionObjects
+ class SpawnableWreck : House {};
+
+ class UH1Wreck_DZ: SpawnableWreck
{
model = "\ca\air2\UH1Y\UH1Y_Crashed.p3d";
icon = "\ca\air2\data\UI\icon_UH1Y_CA.paa";
diff --git a/dayz_code/compile/building_spawnLoot.sqf b/dayz_code/compile/building_spawnLoot.sqf
index bf1bcc79d..3b91e3e0e 100644
--- a/dayz_code/compile/building_spawnLoot.sqf
+++ b/dayz_code/compile/building_spawnLoot.sqf
@@ -1,41 +1,22 @@
-private["_obj","_type","_config","_positions","_lootChance","_itemType","_itemChance","_iPos2","_rnd","_nearBy","_weights","_index","_iArray","_item"];
+private ["_obj","_type","_config","_positions","_iPos","_nearBy","_itemType","_itemTypes","_lootChance","_weights","_cntWeights","_index"];
_obj = _this select 0;
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
_positions = [] + getArray (_config >> "lootPos");
-//diag_log ("LOOTSPAWN: READ:" + str(_type));
+_itemTypes = [] + getArray (_config >> "itemType");
_lootChance = getNumber (_config >> "lootChance");
-_itemType = [] + getArray (_config >> "itemType");
-//diag_log ("LOOTSPAWN: READ:" + str(_itemType));
-_itemChance = [] + getArray (_config >> "itemChance");
-//diag_log ("LOOTSPAWN: Type " + str(count _itemType) + " / Chance " + str(count _itemChance));
-//diag_log ("I want to spawn loot...");
{
- private["_iPos2"];
- _iPos2 = _obj modelToWorld _x;
- _rnd = random 1;
- //Place something at each position
- if (player distance _iPos2 > 5) then {
- if (_rnd < _lootChance) then {
- //if (true) then {
- _nearBy = nearestObjects [_iPos2, ["WeaponHolder","WeaponHolderBase"],1];
+ if ((random 1) < _lootChance) then {
+ _iPos = _obj modelToWorld _x;
+ _nearBy = nearestObjects [_iPos, ["WeaponHolder","WeaponHolderBase"], 1];
if (count _nearBy == 0) then {
- private["_index","_iArray"];
- _weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
- _index = _weights call BIS_fnc_selectRandom;
- //diag_log ("LOOTSPAWN: _itemType:" + str(_itemType));
- //diag_log ("LOOTSPAWN: _index:" + str(_index));
- if (_index >= 0) then {
- _iArray = +(_itemType select _index);
- // diag_log ("LOOTSPAWN: _iArray" + str(_iArray));
- _iArray set [2,_iPos2];
- _iArray set [3,0];
- _iArray call spawn_loot;
- _iArray = [];
- //diag_log ("LOOTSPAWN");
- };
- _item setVariable ["created",(DateToNumber date),true];
- };
+ _index = dayz_CBLCounts find (count _itemTypes);
+ _weights = dayz_CBLChances select _index;
+ _cntWeights = count _weights;
+ _index = floor(random _cntWeights);
+ _index = _weights select _index;
+ _itemType = _itemTypes select _index;
+ [_itemType select 0, _itemType select 1 , _iPos, 0.0] call spawn_loot;
};
};
} forEach _positions;
\ No newline at end of file
diff --git a/dayz_code/compile/building_spawnZombies.sqf b/dayz_code/compile/building_spawnZombies.sqf
index eaa93a495..520168e33 100644
--- a/dayz_code/compile/building_spawnZombies.sqf
+++ b/dayz_code/compile/building_spawnZombies.sqf
@@ -1,4 +1,4 @@
-private["_obj","_type","_config","_canLoot","_originalPos","_unitTypes","_min","_max","_num","_clean","_positions","_zombieChance","_rnd","_iPos","_nearBy","_nearByPlayer"];
+private ["_positions","_min","_iPos","_max","_obj","_type","_nearBy","_clean","_unitTypes","_config","_num","_originalPos","_zombieChance","_rnd","_nearByPlayer","_canLoot"];
_obj = _this select 0;
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
@@ -7,26 +7,27 @@ _originalPos = getPosATL _obj;
if (_canLoot) then {
//Get zombie class
_unitTypes = getArray (_config >> "zombieClass");
- _min = getNumber (_config >> "maxRoaming");
- _max = getNumber (_config >> "minRoaming");
+ _min = getNumber (_config >> "minRoaming");
+ _max = getNumber (_config >> "maxRoaming");
//Walking Zombies
_num = round(random _max) max _min; // + round(_max / 3);
- //diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
+ diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
for "_i" from 1 to _num do
{
[_originalPos,true,_unitTypes] call zombie_generate;
- };
+ };
//Add Internal Zombies
- _clean = {alive _x} count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
+ _clean = count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
if (_clean) then {
_positions = getArray (_config >> "lootPos");
_zombieChance = getNumber (_config >> "zombieChance");
- //diag_log format["Building: %1 / Positions: %2 / Chance: %3",_type,_positions,_zombieChance];
+ diag_log format["Building: %1 / Positions: %2 / Chance: %3",_type,_positions,_zombieChance];
{
_rnd = random 1;
if (_rnd < _zombieChance) then {
_iPos = _obj modelToWorld _x;
- _nearBy = {alive _x} count nearestObjects [_iPos, ["zZombie_Base"],1] > 0;
+ //_iPos = position (_obj);
+ _nearBy = count nearestObjects [_iPos, ["zZombie_Base"],1] > 0;
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
diag_log ("BUILDING: " + _type + " / " + str(_nearBy) + " / " + str(_nearByPlayer));
if (!_nearByPlayer and !_nearBy) then {
diff --git a/dayz_code/compile/dog_findTargetAgent.sqf b/dayz_code/compile/dog_findTargetAgent.sqf
new file mode 100644
index 000000000..461c5e7a5
--- /dev/null
+++ b/dayz_code/compile/dog_findTargetAgent.sqf
@@ -0,0 +1,22 @@
+private["_dog","_target","_targets","_targetDis","_c","_man","_manDis","_targets","_agentheight","_nearEnts","_rnd","_assigned","_range","_objects"];
+_dog = _this;
+_target = objNull;
+_targets = [];
+_man = objNull;
+_manDis = 600;
+
+_targets = _dog getVariable ["targets",[]];
+diag_log "DEBUG: FIND TARGET AGENT";
+
+if (isNil "_targets") exitWith { diag_log "DEBUG: DOG WAS NIL";};
+
+if (count _targets > 0) then {
+ {
+ if ((_x distance _dog) < _manDis) then {
+ _man = _x;
+ _manDis = (_x distance _dog);
+ };
+ } forEach _targets;
+ _target = _man;
+};
+_target;
\ No newline at end of file
diff --git a/dayz_code/compile/fn_damageActions.sqf b/dayz_code/compile/fn_damageActions.sqf
index 642273b4e..cbc7255d0 100644
--- a/dayz_code/compile/fn_damageActions.sqf
+++ b/dayz_code/compile/fn_damageActions.sqf
@@ -14,6 +14,31 @@ _isClose = ((player distance _menClose) < ((sizeOf typeOf _menClose) / 2));
_bag = unitBackpack player;
_classbag = typeOf _bag;
+if (_inVehicle) then {
+ r_player_lastVehicle = _vehicle;
+ _assignedRole = assignedVehicleRole player;
+ if (str (_assignedRole) != str (r_player_lastSeat)) then {
+ call r_player_removeActions2;
+ };
+ if (!r_player_unconscious && !r_action2) then {
+ r_player_lastSeat = _assignedRole;
+ if (count _assignedRole > 1) then {
+ _turret = _assignedRole select 1;
+ _weapons = _vehicle weaponsTurret _turret;
+ {
+ _weaponName = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
+ _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;
+ };
+ };
+} else {
+ call r_player_removeActions2;
+ r_player_lastVehicle = objNull;
+ r_player_lastSeat = [];
+};
+
if (_hasPatient and !r_drag_sqf and !r_action and !_inVehicle and !r_player_unconscious and _isClose) then {
_unit = cursorTarget;
player reveal _unit;
diff --git a/dayz_code/compile/fn_damageHandler.sqf b/dayz_code/compile/fn_damageHandler.sqf
index 4116bfd83..172c1be17 100644
--- a/dayz_code/compile/fn_damageHandler.sqf
+++ b/dayz_code/compile/fn_damageHandler.sqf
@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_damageHandler.sqf";
- Function
- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
-private["_unit","_hit","_damage","_unconscious","_source","_ammo","_type","_isMinor","_isHeadHit","_inVehicle","_evType","_recordable","_isPlayer","_humanityHit","_myKills","_sourceZombie","_display","_control","_canHitFree","_isBandit","_id","_scale","_wound","_isHit","_rndPain","_rndInfection","_hitPain","_hitInfection","_isInjured","_lowBlood","_isCardiac"];
+private["_unit","_humanityHit","_myKills","_isBandit","_hit","_damage","_isPlayer","_unconscious","_wound","_isHit","_isInjured","_type","_hitPain","_inPain","_isDead","_isCardiac","_killerID","_evType","_recordable","_inVehicle","_isHeadHit","_isMinor","_scale","_canHitFree"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
@@ -46,7 +46,20 @@ if (_isPlayer) then {
if (_unit == player) then {
if (_hit == "") then {
if ((_source != player) and _isPlayer) then {
+ //Dog defends player if within 50meters
+ _listTalk = _pos nearEntities [["DZ_Fin, DZ_Pastor"], 100];
+ {
+ if (_x getVariable ["characterID", "0"] == dayz_characterID) then {
+ _targets = _x getVariable ["targets",[]];
+ _targets set [count _targets, _source];
+ _x setVariable ["targets", _targets, true];
+ };
+ }foreach _listTalk;
+
//Enable aggressor Actions
+ if (_source isKindOf "CAManBase") then {
+ _source setVariable["startcombattimer",1];
+ };
_canHitFree = player getVariable ["freeTarget",false];
_isBandit = (typeOf player) == "Bandit1_DZ";
if (!_canHitFree and !_isBandit) then {
diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf
index fb7ea4897..33a804078 100644
--- a/dayz_code/compile/fn_selfActions.sqf
+++ b/dayz_code/compile/fn_selfActions.sqf
@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
-private["_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_Unlock","_lock","_allFixed","_hitpoints","_damage","_part","_cmpt","_color","_string","_handle","_trader_id","_category","_buy","_sell","_buy2","_sell2","_buy3","_sell3","_buy1","_sell1","_buy4","_sell4","_buy5","_sell5","_zparts1","_zparts2","_zparts3","_zparts4","_zparts5","_zparts6","_zparts7","_metals1","_metals2","_metals4","_metals3"];
+private["_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_Unlock","_lock","_allFixed","_hitpoints","_damage","_part","_cmpt","_color","_string","_handle","_trader_id","_category","_buy","_buy2","_buy3","_buy1","_buy4","_buy5","_cantrader","_cantrader1","_buy6","_zparts1","_zparts2","_zparts3","_zparts4","_metals1","_metals2","_metals4","_metals3","_metals5","_dogHandle","_lieDown","_warn"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
@@ -50,6 +50,7 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
_traderType = typeOf cursorTarget;
_ownerID = cursorTarget getVariable ["characterID","0"];
_isAnimal = cursorTarget isKindOf "Animal";
+ _isDog = (cursorTarget isKindOf "DZ_Pastor" || cursorTarget isKindOf "DZ_Fin");
_isZombie = cursorTarget isKindOf "zZombie_base";
_isDestructable = cursorTarget isKindOf "BuiltItems";
_isTent = cursorTarget isKindOf "TentStorage";
@@ -300,8 +301,8 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
if (s_player_parts_crtl < 0) then {
// [_trader_id, _category, ];
- _cantrader = player addAction ["Trade 3 Empty Soda Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","ItemSodaEmpty",1,3,"buy","Empty Soda","Bio Meat"], 99, true, true, "",""];
- _cantrader1 = player addAction ["Trade 3 Empty Tin Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","TrashTinCan",1,3,"buy","Empty Tin Can","Bio Meat"], 99, true, true, "",""];
+ _cantrader = player addAction ["Trade 3 Empty Soda Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","ItemSodaEmpty",1,3,"buy","Empty Soda Cans","Copper Bar"], 99, true, true, "",""];
+ _cantrader1 = player addAction ["Trade 3 Empty Tin Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","TrashTinCan",1,3,"buy","Empty Tin Cans","Copper Bar"], 99, true, true, "",""];
_buy = player addAction ["Food and Drinks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[51,"Food and Drinks"], 99, true, false, "",""];
_buy2 = player addAction ["Backpacks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[52,"Backpacks"], 97, true, false, "",""];
@@ -346,18 +347,38 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
};
+
+ //boat_trader_1
+ if (_isMan and _traderType == boat_trader) then {
+
+ if (s_player_parts_crtl < 0) then {
+
+ // [_trader_id, _category, ];
+ _buy = player addAction ["Boats Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[49,"Boats Unarmed"], 97, true, false, "",""];
+ _buy1 = player addAction ["Boats Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[499,"Boats Armed"], 96, true, false, "",""];
+
+ s_player_parts set [count s_player_parts,_buy];
+ s_player_parts set [count s_player_parts,_buy1];
+
+ s_player_parts_crtl = 1;
+ };
+
+ };
+
+
//auto_trader_1
if (_isMan and _traderType == auto_trader) then {
if (s_player_parts_crtl < 0) then {
// [_trader_id, _category, ];
- _buy = player addAction ["Car", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[41,"Car"], 99, true, false, "",""];
- _buy1 = player addAction ["Truck", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[42,"Truck"], 97, true, false, "",""];
- _buy5 = player addAction ["Utility", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[46,"Utility"], 95, true, false, "",""];
- _buy2 = player addAction ["Offroad", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[43,"Offroad"], 93, true, false, "",""];
- _buy3 = player addAction ["Helicopter", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[44,"Helicopter"], 91, true, false, "",""];
- _buy4 = player addAction ["Military", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[45,"Military"], 89, true, false, "",""];
+ _buy = player addAction ["Cars", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[41,"Cars"], 99, true, false, "",""];
+ _buy1 = player addAction ["Trucks Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[42,"Truck Unarmed"], 97, true, false, "",""];
+ _buy2 = player addAction ["SUV", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[466,"SUV"], 95, true, false, "",""];
+ _buy3 = player addAction ["Buses and Vans", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[467,"Buses and Vans"], 95, true, false, "",""];
+ _buy4 = player addAction ["Offroad", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[43,"Offroad"], 93, true, false, "",""];
+ _buy5 = player addAction ["Helicopter Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[44,"Helicopter"], 91, true, false, "",""];
+ _buy6 = player addAction ["Military Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[45,"Military Unarmed"], 89, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];
s_player_parts set [count s_player_parts,_buy1];
@@ -365,19 +386,49 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_parts set [count s_player_parts,_buy3];
s_player_parts set [count s_player_parts,_buy4];
s_player_parts set [count s_player_parts,_buy5];
+ s_player_parts set [count s_player_parts,_buy6];
s_player_parts_crtl = 1;
};
};
+
+ //auto_trader_2
+ if (_isMan and _traderType == auto_trader_2) then {
+
+ if (s_player_parts_crtl < 0) then {
+
+ // [_trader_id, _category, ];
+ _buy = player addAction ["Muscle Cars", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[411,"Muscle Cars"], 99, true, false, "",""];
+ _buy1 = player addAction ["Trucks Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[422,"Truck Armed"], 97, true, false, "",""];
+ _buy2 = player addAction ["Utility", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[46,"Utility"], 95, true, false, "",""];
+ _buy3 = player addAction ["Helicopter Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[444,"Helicopter"], 91, true, false, "",""];
+ _buy4 = player addAction ["Military Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[455,"Military Armed"], 89, true, false, "",""];
+ _buy5 = player addAction ["Fuel Trucks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[47,"Fuel Trucks"], 88, true, false, "",""];
+ _buy6 = player addAction ["Heavy Armor Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[48,"Heavy Armor Unarmed"], 88, true, false, "",""];
+
+
+ s_player_parts set [count s_player_parts,_buy];
+ s_player_parts set [count s_player_parts,_buy1];
+ s_player_parts set [count s_player_parts,_buy2];
+ s_player_parts set [count s_player_parts,_buy3];
+ s_player_parts set [count s_player_parts,_buy4];
+ s_player_parts set [count s_player_parts,_buy5];
+ s_player_parts set [count s_player_parts,_buy6];
+
+ s_player_parts_crtl = 1;
+ };
+
+ };
+
// mad_sci
if (_isMan and _traderType == mad_sci) then {
if (s_player_parts_crtl < 0) then {
// [part_out, part_in, qty_out, qty_in,];
- _zparts1 = player addAction ["Trade Zombie Parts for Bio Meat", "\z\addons\dayz_code\actions\trade_items.sqf",["FoodBioMeat","ItemZombieParts",1,1,"buy","Zombie Parts","Bio Meat"], 99, true, true, "",""];
+ _zparts1 = player addAction ["Trade Zombie Parts for Bio Meat", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["FoodBioMeat","ItemZombieParts",1,1,"buy","Zombie Parts","Bio Meat"], 99, true, true, "",""];
_zparts2 = player addAction ["Medical Supplies", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[31,"Medical Supplies"], 97, true, false, "",""];
_zparts3 = player addAction ["Chem-lites/Flares", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[32,"Chem-lites/Flares"], 95, true, false, "",""];
_zparts4 = player addAction ["Smoke Grenades", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[33,"Smoke Grenades"], 93, true, false, "",""];
@@ -397,11 +448,11 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
if (s_player_parts_crtl < 0) then {
// [part_out, part_in, qty_out, qty_in,];
- _metals1 = player addAction ["Trade 6 Copper for 1 Silver", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemSilverBar","ItemCopperBar",1,6,"buy","Copper","Silver"], 99, true, true, "",""];
- _metals2 = player addAction ["Trade 1 Silver for 6 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","ItemSilverBar",6,1,"buy","Silver","Copper"], 98, true, true, "",""];
- _metals4 = player addAction ["Trade 6 Silver for 1 Gold", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemGoldBar","ItemSilverBar",1,6,"buy","Silver","Gold"], 97, true, true, "",""];
- _metals3 = player addAction ["Trade 1 Gold for 6 Silver", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemSilverBar","ItemGoldBar",6,1,"buy","Gold","Silver"], 97, true, true, "",""];
- _metals5 = player addAction ["Buy Vault for 12 Gold", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemVault","ItemGoldBar",1,12,"buy","Gold","Vault"], 96, true, true, "",""];
+ _metals1 = player addAction ["Trade 6 Copper for 1 Silver", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemSilverBar","ItemCopperBar",1,6,"buy","Copper","Silver"], 99, true, true, "",""];
+ _metals2 = player addAction ["Trade 1 Silver for 6 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","ItemSilverBar",6,1,"buy","Silver","Copper"], 98, true, true, "",""];
+ _metals4 = player addAction ["Trade 6 Silver for 1 Gold", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemGoldBar","ItemSilverBar",1,6,"buy","Silver","Gold"], 97, true, true, "",""];
+ _metals3 = player addAction ["Trade 1 Gold for 6 Silver", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemSilverBar","ItemGoldBar",6,1,"buy","Gold","Silver"], 97, true, true, "",""];
+ _metals5 = player addAction ["Buy Vault for 12 Gold", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemVault","ItemGoldBar",1,12,"buy","Gold","Vault"], 96, true, true, "",""];
s_player_parts set [count s_player_parts,_metals1];
s_player_parts set [count s_player_parts,_metals2];
@@ -422,6 +473,59 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_studybody = -1;
};
+ //Dog
+ if (_isDog and _isAlive and _hasRawMeat and _canDo and _ownerID == "0" and 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, "", ""];
+ };
+ } else {
+ player removeAction s_player_tamedog;
+ s_player_tamedog = -1;
+ };
+
+ if (_isDog and _ownerID == dayz_characterID and _isAlive and _canDo) then {
+ _dogHandle = player getVariable ["dogID", 0];
+ if (s_player_feeddog < 0 and _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 magazines player) 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 {
+ _lieDown = _dogHandle getFSMVariable "_actionLieDown";
+ if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
+ s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
+ };
+ if (s_player_trackdog < 0) then {
+ s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
+ };
+ if (s_player_barkdog < 0) then {
+ s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", cursorTarget, 3, false, true,"",""];
+ };
+ if (s_player_warndog < 0) then {
+ _warn = _dogHandle getFSMVariable "_watchDog";
+ if (_warn) then { _text = "Quiet"; _warn = false; } else { _text = "Alert"; _warn = true; };
+ s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
+ };
+ if (s_player_followdog < 0) then {
+ s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
+ };
+ } else {
+ player removeAction s_player_feeddog;
+ s_player_feeddog = -1;
+ player removeAction s_player_waterdog;
+ s_player_waterdog = -1;
+ player removeAction s_player_staydog;
+ s_player_staydog = -1;
+ player removeAction s_player_trackdog;
+ s_player_trackdog = -1;
+ player removeAction s_player_barkdog;
+ s_player_barkdog = -1;
+ player removeAction s_player_warndog;
+ s_player_warndog = -1;
+ player removeAction s_player_followdog;
+ s_player_followdog = -1;
+ };
} else {
//Engineering
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
diff --git a/dayz_code/compile/player_alertZombies.sqf b/dayz_code/compile/player_alertZombies.sqf
index cb472c192..cab60db27 100644
--- a/dayz_code/compile/player_alertZombies.sqf
+++ b/dayz_code/compile/player_alertZombies.sqf
@@ -1,4 +1,4 @@
-private["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_targets"];
+private["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_targets","_dog"];
//Alert Zed's to noise of shot
_unit = _this select 0;
_distance = _this select 1;
@@ -19,4 +19,17 @@ _listTalk = _pos nearEntities ["zZombie_Base",_distance];
} else {
_zombie setVariable ["myDest",_pos,true];
};
+} forEach _listTalk;
+_listTalk = _pos nearEntities [["DZ_Fin, DZ_Pastor"], _distance * 3];
+
+{
+ _dog = _x;
+ //Ensure dog is tamed AND is not players own dog
+ if (_doRun && (_dog getVariable ["characterID", 0]) != 0) then {
+ _targets = _dog getVariable ["targets",[]];
+ if (!(_unit in _targets)) then {
+ _targets set [count _targets,_unit];
+ _dog setVariable ["targets",_targets,true];
+ };
+ }
} forEach _listTalk;
\ No newline at end of file
diff --git a/dayz_code/compile/player_animalCheck.sqf b/dayz_code/compile/player_animalCheck.sqf
index 71a9892c7..e84455409 100644
--- a/dayz_code/compile/player_animalCheck.sqf
+++ b/dayz_code/compile/player_animalCheck.sqf
@@ -1,5 +1,5 @@
-private["_list","_animalssupported","_type","_root","_favouritezones","_randrefpoint","_PosList","_PosSelect","_Pos","_GroupMarker","_agent","_id","_pos","_tame"];
+private["_list","_animalssupported","_type","_root","_favouritezones","_randrefpoint","_PosList","_PosSelect","_Pos","_agent","_id","_pos","_near"];
_list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance];
if (count _list < dayz_maxAnimals) then {
@@ -38,22 +38,28 @@ if (count _list < dayz_maxAnimals) then {
_Pos = _PosSelect select 0;
_list = _Pos nearEntities [["CAAnimalBase","Man"],50];
- if (player distance _Pos < dayz_animalDistance and NOT surfaceIsWater _Pos and (count _list == 0)) then {
- //Create Marker
- /*
- DAYZ_agentnumber = DAYZ_agentnumber + 1;
- _GroupMarker = "animal_" + (str DAYZ_agentnumber) + "_" + str(dayz_characterID);
- createMarker [_GroupMarker, _Pos ];
- _GroupMarker setMarkerType "Dot";
- _GroupMarker setMarkerColor "ColorRed";
- _GroupMarker setMarkerText _type;
- */
- _agent = createAgent [_type, _Pos, [], 0, "FORM"];
+
+ 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"]; };
_agent setpos _Pos;
_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
- if ((_type == "DZ_Fin") || (_type == "DZ_Pastor")) then {
- _tame = _agent addAction ["Tame Dog", "\z\addons\dayz_code\compile\player_tameDog.sqf"];
- };
};
sleep 1;
-};
\ No newline at end of file
+};
+
+//Comment out above code and use code below for testing
+/*
+private["_type","_pos","_agent","_id"];
+_near = (position player) nearEntities ["DZ_Pastor",500];
+
+if (count _near == 0) then {
+ _type = "DZ_Pastor";
+ _pos = player modelToWorld [0,(count _near) + 1,0];
+ _agent = createAgent [_type, _pos, [], 0, "NONE"];
+ player reveal _agent;
+ _agent setpos _pos;
+ //_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
+ _id = 1;
+ _agent setVariable ["fsm_handle", _id];
+};
+*/
\ No newline at end of file
diff --git a/dayz_code/compile/player_checkStealth.sqf b/dayz_code/compile/player_checkStealth.sqf
index 14cf74225..bc82b0fcc 100644
--- a/dayz_code/compile/player_checkStealth.sqf
+++ b/dayz_code/compile/player_checkStealth.sqf
@@ -1,4 +1,4 @@
-private["_vel","_speed","_pos","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_scaleSound","_nearFlare","_scaler","_nearLight","_nearFire","_building","_isPlayerInside","_audial"];
+private["_lightOn","_vel","_speed","_pos","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_scaleSound","_nearFlare","_scaler","_nearLight","_nearFire","_building","_isPlayerInside","_audial"];
_vel = velocity (vehicle player);
_speed = (_vel distance [0,0,0]);
_pos = getPosATL player;
@@ -58,7 +58,7 @@ if (_scaleLight < 0.9) then {
};
};
_nearLight = nearestObject [(vehicle player),"StreetLamp"];
- if (!isNull _nearLight) then {
+ if (!isNull _nearLight && (lightIsOn _nearLight == "ON")) then {
_scaler = 50 - (_nearLight distance (vehicle player));
_scaleLight = ((_scaler / 50) * 2) + _scaleLight;
};
diff --git a/dayz_code/compile/player_spawnCheck.sqf b/dayz_code/compile/player_spawnCheck.sqf
index 9107fdee5..9eb34e2c6 100644
--- a/dayz_code/compile/player_spawnCheck.sqf
+++ b/dayz_code/compile/player_spawnCheck.sqf
@@ -16,15 +16,17 @@ dayz_inVehicle = _inVehicle;
//if (((time - dayz_spawnWait) < dayz_spawnDelay) and ((time - dayz_lootWait) < dayz_lootDelay)) exitWith {};
//diag_log("SPAWN CHECKING: Starting");
+ _radius = 300;
_locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
- _nearestCity = nearestLocations [getPos player, _locationstypes, 600];
+ _nearestCity = nearestLocations [getPos player, _locationstypes, _radius];
//_nearestCity = [_locationstypes,[position player,600],false] call bis_fnc_locations;
//diag_log ("0: " +str(_nearestCity));
- //_position = position (_nearestCity select 0);
- _radius = 160;
_position = getPosATL player;
+ if ((count _nearestCity) > 0) then {
+ _position = position (_nearestCity select 0);
+ };
_nearbytype = type (_nearestCity select 0);
_nearby = _position nearObjects ["Building",_radius];
@@ -47,13 +49,20 @@ switch (_nearbytype) do {
};
};
+//diag_log ("nearbytype: " +str(_nearbytype));
+
if (_inVehicle) then {
_maxZombies = _maxZombies / 2;
};
- _tooManyZs = count (_position nearEntities ["zZombie_Base",60]) > _maxZombies;
+ _age = 0;
+ _tooManyZs = count (_position nearEntities ["zZombie_Base",200]) > _maxZombies;
//diag_log("Too Many Zeds: " +str(_tooManyZs));
//diag_log(format["SPAWN CHECK: Building count is %1", count _nearby]);
+ _count = ({alive _x} count allMissionObjects "zZombie_Base");
+ //hint "Total Zeds: " +str(_count));
+ hint format["Total Zeds %1",_count];
+ diag_log ("Total Zeds: " +str(_count));
{
//diag_log("SPAWN CHECK: Start of Loop");
_type = typeOf _x;
@@ -61,33 +70,24 @@ if (_inVehicle) then {
_canZombie = isClass (_config);
_canLoot = ((count (getArray (_config >> "lootPos"))) > 0);
_dis = _x distance player;
+ //diag_log ("Type: " +str(sizeOf _type));
if ((!_inVehicle) and (_canLoot)) then {
- //diag_log("SPAWN LOOT: " + _type + " Building is lootable");
- //dayz_serverSpawnLoot = [_dis, _x];
- //publicVariableServer "dayz_serverSpawnLoot";
_keepAwayDist = ((sizeOf _type)+5);
_isNoone = {isPlayer _x} count (_x nearEntities ["CAManBase",_keepAwayDist]) == 0;
- //diag_log(format["SPAWN LOOT: isNoone: %1 | keepAwayDist %2 | %3", str(_isNoone), _keepAwayDist, _type]);
if (_isNoone) then {
- _looted = (_x getVariable ["looted",-0.1]);
+ _looted = (_x getVariable ["looted",0.0]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
- //diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if (_age > 8) then {
- //diag_log("SPAWN LOOT: Spawning loot");
- //Register
_x setVariable ["looted",_dateNow,true];
- //cleanup
- //_nearByObj = (getPosATL _x) nearObjects ["ReammoBox",((sizeOf _type)+5)];
- //{deleteVehicle _x} forEach _nearByObj;
- dayz_lootWait = time;
[_x] call building_spawnLoot;
};
};
};
+
if (_canZombie) then {
if (dayz_spawnZombies < _maxZombies) then {
if (!_tooManyZs) then {
@@ -95,10 +95,11 @@ if (_inVehicle) then {
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _zombied) * 525948;
- //diag_log(format["Date: %1 | ZombieSpawn: %2 | age: %3 | building: %4 (%5)", _dateNow, _zombied, _age, str(_x), _dis]);
+ diag_log(format["Date: %1 | ZombieSpawn: %2 | age: %3 | building: %4 (%5)", _dateNow, _zombied, _age, str(_x), _dis]);
if (_age > 1) then {
_bPos = getPosATL _x;
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
+ diag_log ("ZombiesNum: " +str(_zombiesNum));
if (_zombiesNum == 0) then {
//Randomize Zombies
_x setVariable ["zombieSpawn",_dateNow,true];
diff --git a/dayz_code/compile/player_spawnlootCheck.sqf b/dayz_code/compile/player_spawnlootCheck.sqf
new file mode 100644
index 000000000..2343971da
--- /dev/null
+++ b/dayz_code/compile/player_spawnlootCheck.sqf
@@ -0,0 +1,40 @@
+_isAir = vehicle player iskindof "Air";
+_inVehicle = (vehicle player != player);
+_dateNow = (DateToNumber date);
+_age = -1;
+
+ _radius = 300;
+ _locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
+ _nearestCity = nearestLocations [getPos player, _locationstypes, _radius];
+
+ _position = getPosATL player;
+ if ((count _nearestCity) > 0) then {
+ _position = position (_nearestCity select 0);
+ };
+
+ //_nearby = _position nearObjects ["Building",_radius / 2];
+ _nearby = nearestObjects [_position, ["Building"], _radius];
+
+ {
+ //diag_log("SPAWN CHECK: Start of Loop");
+ _type = typeOf _x;
+ _config = configFile >> "CfgBuildingLoot" >> _type;
+ _canZombie = isClass (_config);
+ _canLoot = ((count (getArray (_config >> "lootPos"))) > 0);
+ _dis = _x distance player;
+
+ if ((!_inVehicle) and (_canLoot)) then {
+ _keepAwayDist = ((sizeOf _type) + 5);
+ _isNoone = {isPlayer _x} count (_x nearEntities ["CAManBase",_keepAwayDist]) == 0;
+ if (_isNoone) then {
+ _looted = (_x getVariable ["looted",0.0]);
+ _cleared = (_x getVariable ["cleared",true]);
+ _dateNow = (DateToNumber date);
+ _age = (_dateNow - _looted) * 525948;
+ if (_age > 8) then {
+ _x setVariable ["looted",_dateNow,true];
+ [_x] call building_spawnLoot;
+ };
+ };
+ };
+ } forEach _nearby;
\ No newline at end of file
diff --git a/dayz_code/compile/player_updateGui.sqf b/dayz_code/compile/player_updateGui.sqf
index 24b9fa399..984843474 100644
--- a/dayz_code/compile/player_updateGui.sqf
+++ b/dayz_code/compile/player_updateGui.sqf
@@ -56,7 +56,7 @@ diag_log format["DEBUG: foodlvl: %1 dayz_hunger: %2 foodval: %3",_foodLvl, dayz_
diag_log format["DEBUG: templvl: %1 dayz_temperatur: %2 tempval: %3",_tempLvl, dayz_temperatur, _tempVal];
*/
-if (_bloodLvl == 0) then {
+if (_bloodLvl <= 0) then {
_blood = "\z\addons\dayz_code\gui\status_blood_inside_1_ca.paa";
} else {
_blood = "\z\addons\dayz_code\gui\status_blood_inside_" + str(_bloodLvl) + "_ca.paa";
diff --git a/dayz_code/compile/player_zombieAttack.sqf b/dayz_code/compile/player_zombieAttack.sqf
index 52d278bc7..c7a05e3f0 100644
--- a/dayz_code/compile/player_zombieAttack.sqf
+++ b/dayz_code/compile/player_zombieAttack.sqf
@@ -1,4 +1,4 @@
-private["_unit","_vehicle","_targets","_move","_rnd","_wound","_dir","_hpList","_hp","_damage","_chance","_strH","_dam","_total","_result","_tPos","_zPos","_inAngle","_cantSee","_isZombieInside","_building","_isPlayerInside"];
+private["_unit","_vehicle","_targets","_move","_rnd","_wound","_type","_dir","_hpList","_hp","_damage","_chance","_strH","_dam","_total","_result","_tPos","_zPos","_inAngle","_cantSee","_isZombieInside","_building","_isPlayerInside"];
_unit = _this;
_vehicle = (vehicle player);
@@ -15,8 +15,12 @@ if (r_player_unconscious && _vehicle == player) then {
_move = "ZombieFeed" + str(_rnd);
} else {
_unit doMove (getPos player);
+ if (_type == "zombie") then {
_rnd = round(random 9) + 1;
_move = "ZombieStandingAttack" + str(_rnd);
+ } else {
+ _move = "Dog_Attack";
+ };
};
_dir = [_unit,player] call BIS_Fnc_dirTo;
_unit setDir _dir;
@@ -76,17 +80,23 @@ if (_vehicle != player) then {
//LOS check
_cantSee = [_unit,_vehicle] call dayz_losCheck;
if (!_cantSee) then {
+ if (_type == "dog") then {
+ _wound = DAYZ_woundHit_dog call BIS_fnc_selectRandomWeighted;
+ _damage = 0.3 + random (1.0);
+ } else {
if (r_player_blood < (r_player_bloodTotal * 0.8)) then {
_wound = DAYZ_woundHit call BIS_fnc_selectRandomWeighted;
} else {
_wound = DAYZ_woundHit_ok call BIS_fnc_selectRandomWeighted;
};
_damage = 0.1 + random (1.2);
+ };
+
//diag_log ("START DAM: Player Hit on " + _wound + " for " + str(_damage));
[player, _wound, _damage, _unit,"zombie"] call fnc_usec_damageHandler;
//dayzHit = [player,_wound, _damage, _unit,"zombie"];
//publicVariable "dayzHit";
- [_unit,"hit",0,false] call dayz_zombieSpeak;
+ if (_type == "dog") then { [_unit,"dog_growl",0,false] call dayz_zombieSpeak; } else { [_unit,"hit",0,false] call dayz_zombieSpeak; };
} else {
/*
_isZombieInside = [_unit,_building] call fnc_isInsideBuilding;
diff --git a/dayz_code/compile/player_zombieCheck.sqf b/dayz_code/compile/player_zombieCheck.sqf
index 1dadcd35b..131cbf204 100644
--- a/dayz_code/compile/player_zombieCheck.sqf
+++ b/dayz_code/compile/player_zombieCheck.sqf
@@ -1,13 +1,25 @@
-private["_refObj","_listTalk","_pHeight","_attacked","_list","_dist","_group","_chance","_last","_entHeight","_delta","_isZInside","_building","_isPlayerInside","_targets","_cantSee","_tPos","_zPos","_eyeDir","_inAngle","_lowBlood"];
+private["_listTalk","_isZombie","_group","_eyeDir","_attacked","_chance","_last","_audial","_distance","_refObj","_list","_scaleMvmt","_scalePose","_scaleLight","_anim","_activators","_nearFire","_nearFlare","_scaleAlert","_inAngle","_scaler","_initial","_tPos","_zPos","_cantSee"];
_refObj = vehicle player;
//_listTalk = (position _refObj) nearEntities ["zZombie_Base",200];
_listTalk = (position _refObj) nearEntities ["zZombie_Base",100];
_pHeight = (getPosATL _refObj) select 2;
_attacked = false;
+_multiplier = 1;
//_list = list dayz_playerTrigger;
{
- if (alive _x) then {
+ _continue = true;
+
+ if (typeOf _x == "DZ_Fin" || typeOf _x == "DZ_Pastor") then { _type = "dog"; } else { _type = "zombie"; };
+ //check if untamed dog;
+ if (_type == "dog") then {
+ _multiplier = 2;
+ if ((_x getVariable ["characterID", "0"] == "0") || (_x getVariable ["state", "passive"] == "passive") || (_x getVariable ["characterID", "0"] == dayz_characterID)) then {
+ _continue = false;
+ };
+ };
+
+ if (alive _x && _continue) then {
private["_dist"];
_dist = (_x distance _refObj);
_group = _x;
@@ -22,7 +34,7 @@ _attacked = false;
_chance = 1;
//if ((_x in _list) and !(animationState _x == "ZombieFeed")) then {
if ((_x distance player < dayz_areaAffect) and !(animationState _x == "ZombieFeed")) then {
- [_x,"attack",(_chance),true] call dayz_zombieSpeak;
+ if (_type == "zombie") then { [_x,"attack",(_chance),true] call dayz_zombieSpeak; };
//perform an attack
_last = _x getVariable["lastAttack",0];
_entHeight = (getPosATL _x) select 2;
@@ -36,10 +48,12 @@ _attacked = false;
};
_attacked = true;
} else {
+ if (_type == "zombie") then {
if (speed _x < 4) then {
[_x,"idle",(_chance + 4),true] call dayz_zombieSpeak;
} else {
[_x,"chase",(_chance + 3),true] call dayz_zombieSpeak;
+ };
};
};
//Noise Activation
diff --git a/dayz_code/compile/spawn_loot.sqf b/dayz_code/compile/spawn_loot.sqf
index 7a42f0082..14033fd7f 100644
--- a/dayz_code/compile/spawn_loot.sqf
+++ b/dayz_code/compile/spawn_loot.sqf
@@ -1,28 +1,25 @@
-private["_itemType","_weights","_iItem","_iClass","_iPos","_radius","_item","_arrayLootSpawn","_qty","_max","_tQty","_indexLootSpawn","_canType","_mags","_ipos"];
-// [_itemType,_weights]
+private["_iItem","_iClass","_iPos","_radius","_itemTypes","_index","_item","_qty","_max","_tQty","_canType","_weights","_cntWeights","_dateNow"];
_iItem = _this select 0;
_iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
+
switch (_iClass) do {
default {
//Item is food, add random quantity of cans along with an item (if exists)
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
- _arrayLootSpawn = [] + getArray (configFile >> "cfgLoot" >> _iClass);
- _itemType = _arrayLootSpawn select 0;
- _weights = _arrayLootSpawn call fnc_buildWeightedArray;
+
+ _itemTypes = [] + ((getArray (configFile >> "cfgLoot" >> _iClass)) select 0);
+ _index = dayz_CLBase find _iClass;
+ _weights = dayz_CLChances select _index;
+ _cntWeights = count _weights;
_qty = 0;
_max = ceil(random 2) + 1;
- //diag_log ("LOOTSPAWN: QTY: " + str(_max) + " ARRAY: " + str(_arrayLootSpawn));
while {_qty < _max} do {
- private["_tQty","_indexLootSpawn","_canType"];
- _tQty = floor(random 1) + 1;
- //diag_log ("LOOTSPAWN: ITEM QTY: " + str(_tQty));
-
- _indexLootSpawn = _weights call BIS_fnc_selectRandom;
- _canType = _itemType select _indexLootSpawn;
-
- //diag_log ("LOOTSPAWN: ITEM: " + str(_canType));
+ _tQty = round(random 1) + 1;
+ _index = floor(random _cntWeights);
+ _index = _weights select _index;
+ _canType = _itemTypes select _index;
_item addMagazineCargoGlobal [_canType,_tQty];
_qty = _qty + _tQty;
};
@@ -35,8 +32,8 @@ switch (_iClass) do {
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_iItem,1];
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
- if (count _mags > 0) then {
- _item addMagazineCargoGlobal [(_mags select 0),(round(random 1))];
+ if ((count _mags) > 0) then {
+ _item addMagazineCargoGlobal [(_mags select 0), (round(random 2))];
};
};
case "magazine": {
@@ -49,6 +46,11 @@ switch (_iClass) do {
_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
};
};
-if (count _iPos > 2) then {
- _item setPosATL _ipos;
+
+// timestamp for later clearing
+_dateNow = (DateToNumber date);
+_item setVariable ["looted",_dateNow,true];
+
+if ((count _iPos) > 2) then {
+ _item setPosATL _iPos;
};
\ No newline at end of file
diff --git a/dayz_code/compile/tame_dog.sqf b/dayz_code/compile/tame_dog.sqf
new file mode 100644
index 000000000..e4c399ad8
--- /dev/null
+++ b/dayz_code/compile/tame_dog.sqf
@@ -0,0 +1,36 @@
+/*
+ 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", "_pos", "_fsmid"];
+_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];
+sleep 1;
+diag_log format["DEBUG: %1, id: %2 [%3]",_dog,_animalID,completedFSM _animalID];
+if (!moveToCompleted _dog) then {
+ _dog moveTo (position _dog);
+};
+_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];
\ No newline at end of file
diff --git a/dayz_code/compile/zombie_generate.sqf b/dayz_code/compile/zombie_generate.sqf
index e7965145c..c3cb9ecaa 100644
--- a/dayz_code/compile/zombie_generate.sqf
+++ b/dayz_code/compile/zombie_generate.sqf
@@ -58,7 +58,7 @@ if (!_doLoiter) then {
_attempt = 0;
while {_nearByPlayer} do {
//_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos; Orignal
- _position = [_position,0,20,20,0,20,0] call BIS_fnc_findSafePos;
+ _position = [_position,0,50,20,0,20,0] call BIS_fnc_findSafePos;
_agent setPos _position;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
_attempt = _attempt + 1;
diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp
index 99f559fc6..523d64508 100644
--- a/dayz_code/config.cpp
+++ b/dayz_code/config.cpp
@@ -33,7 +33,7 @@ class CfgMods
hidePicture = 0;
hideName = 0;
action = "http://www.dayzmod.com";
- version = "1.7.5.D1207";
+ version = "1.7.5.D1210";
hiveVersion = 0.96; //0.93
};
};
@@ -218,6 +218,7 @@ class CfgBuildingLoot {
lootChance = 0.3;
lootPos[] = {};
itemType[] = {
+ { "WeaponHolder_ItemGenerator","object" },
{ "","generic" },
{ "","trash" },
{ "","military" },
@@ -235,6 +236,7 @@ class CfgBuildingLoot {
{"ItemTankTrap","magazine"}
};
itemChance[] = {
+ 0.01,
0.18,
0.29,
0.04,
diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf
index e866d9ea6..b3a033390 100644
--- a/dayz_code/init/compiles.sqf
+++ b/dayz_code/init/compiles.sqf
@@ -48,7 +48,6 @@ if (!isDedicated) then {
player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
- player_tameDog = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_tameDog.sqf";
//Objects
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
@@ -59,6 +58,9 @@ if (!isDedicated) then {
zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
+ //Dogs
+ dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
+
// Vehicle damage fix
vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
@@ -223,7 +225,7 @@ if (!isDedicated) then {
_btnRespawn ctrlEnable false;
};
- /*
+
dayz_disableAbort = {
private["_display","_btnAbort","_combattimeout"];
_combattimeout = player getVariable["combattimeout",0];
@@ -236,7 +238,7 @@ if (!isDedicated) then {
_btnAbort = _display displayCtrl 104;
_btnAbort ctrlEnable false;
};
- */
+
dayz_spaceInterrupt = {
private ["_dikCode", "_handled"];
diff --git a/dayz_code/init/loot_init.sqf b/dayz_code/init/loot_init.sqf
new file mode 100644
index 000000000..922c4243e
--- /dev/null
+++ b/dayz_code/init/loot_init.sqf
@@ -0,0 +1,43 @@
+private["_cfgCount","_i","_j","_k","_l","_config","_defaultCfg","_itemTypes","_itemChances","_itemCount","_weighted","_weight"];
+dayz_CBLChances = [];
+dayz_CBLCounts = [];
+
+_cfgCount = count (configFile >> "CfgBuildingLoot");
+for "_i" from 0 to ((_cfgCount) - 1) do {
+ _config = (configFile >> "CfgBuildingLoot") select _i;
+ if ((count (getArray (_config >> "ItemChance"))) > 0) then {
+ _itemChances = getArray (_config >> "itemChance");
+ _itemCount = count _itemChances;
+ if ((dayz_CBLCounts find _itemCount) < 0) then {
+ _weighted = [];
+ _j = 0;
+ for "_l" from 0 to ((count _itemChances) - 1) do {
+ _weight = round ((_itemChances select _l) * 100);
+ for "_k" from 0 to _weight - 1 do {
+ _weighted set [_j + _k, _l];
+ };
+ _j = _j + _weight;
+ };
+ dayz_CBLCounts set [count dayz_CBLCounts, _itemCount];
+ dayz_CBLChances set [count dayz_CBLChances, _weighted];
+ };
+ };
+};
+
+dayz_CLChances = [];
+dayz_CLBase = [];
+_config = configFile >> "cfgLoot";
+for "_i" from 0 to ((count (_config)) - 1) do {
+ _itemChances = (getArray (_config select _i)) select 1;
+ _weighted = [];
+ _j = 0;
+ for "_l" from 0 to ((count _itemChances) - 1) do {
+ _weight = round ((_itemChances select _l) * 100);
+ for "_k" from 0 to _weight - 1 do {
+ _weighted set [_j + _k, _l];
+ };
+ _j = _j + _weight;
+ };
+ dayz_CLBase set [count dayz_CLBase, configName (_config select _i)];
+ dayz_CLChances set [count dayz_CLChances, _weighted];
+};
diff --git a/dayz_code/init/object_generator.sqf b/dayz_code/init/object_generator.sqf
new file mode 100644
index 000000000..c77a56720
--- /dev/null
+++ b/dayz_code/init/object_generator.sqf
@@ -0,0 +1,7 @@
+private["_holder","_type","_classname","_name"];
+_holder = _this select 0;
+_type = _this select 1;
+_classname = _this select 2;
+_name = getText (configFile >> _type >> _classname >> "displayName");
+null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
+player reveal _holder;
\ No newline at end of file
diff --git a/dayz_code/init/publicEH.sqf b/dayz_code/init/publicEH.sqf
index d7330e1c4..38f51a1f4 100644
--- a/dayz_code/init/publicEH.sqf
+++ b/dayz_code/init/publicEH.sqf
@@ -22,22 +22,23 @@
//Server only
if (isServer) then {
- "dayzDeath" addPublicVariableEventHandler {(_this select 1) call server_playerDied};
+ "dayzDeath" addPublicVariableEventHandler {(_this select 1) call server_playerDied};
"dayzDiscoAdd" addPublicVariableEventHandler {dayz_disco set [count dayz_disco,(_this select 1)];};
"dayzDiscoRem" addPublicVariableEventHandler {dayz_disco = dayz_disco - [(_this select 1)];};
- "dayzPlayerSave" addPublicVariableEventHandler {(_this select 1) call server_playerSync;};
+ "dayzPlayerSave" addPublicVariableEventHandler {(_this select 1) call server_playerSync;};
"dayzPublishObj" addPublicVariableEventHandler {(_this select 1) call server_publishObj};
"dayzUpdateVehicle" addPublicVariableEventHandler {(_this select 1) call server_updateObject};
- "dayzDeleteObj" addPublicVariableEventHandler {(_this select 1) call local_deleteObj};
+ "dayzDeleteObj" addPublicVariableEventHandler {(_this select 1) call local_deleteObj};
"dayzPublishVeh" addPublicVariableEventHandler {(_this select 1) call server_publishVeh}; // for vehicle traders
+ "dayzTradeObject" addPublicVariableEventHandler {(_this select 1) call server_tradeObj}; // for vehicle traders
"dayzTraderMenu" addPublicVariableEventHandler {(_this select 1) call server_traders}; // for all traders
- "dayzLogin" addPublicVariableEventHandler {(_this select 1) call server_playerLogin};
+ "dayzLogin" addPublicVariableEventHandler {(_this select 1) call server_playerLogin};
"dayzLogin2" addPublicVariableEventHandler {(_this select 1) call server_playerSetup};
// "dayzPlayerMorph" addPublicVariableEventHandler {(_this select 1) call server_playerMorph};
// "dayzUpdate" addPublicVariableEventHandler {_id = (_this select 1) spawn dayz_processUpdate};
- "dayzLoginRecord" addPublicVariableEventHandler {(_this select 1) call dayz_recordLogin};
-// "dayzCharSave" addPublicVariableEventHandler {(_this select 1) call server_playerSync};
- "dayzCharDisco" addPublicVariableEventHandler {(_this select 1) call server_characterSync};
+ "dayzLoginRecord" addPublicVariableEventHandler {(_this select 1) call dayz_recordLogin};
+// "dayzCharSave" addPublicVariableEventHandler {(_this select 1) call server_playerSync};
+ "dayzCharDisco" addPublicVariableEventHandler {(_this select 1) call server_characterSync};
};
//Client only
diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf
index 52504c4c6..b6becdf44 100644
--- a/dayz_code/init/variables.sqf
+++ b/dayz_code/init/variables.sqf
@@ -72,6 +72,16 @@ dayz_resetSelfActions = {
s_player_deleteBuild = -1;
s_player_forceSave = -1;
s_player_flipveh = -1;
+ s_player_movedog = -1;
+ s_player_speeddog = -1;
+ s_player_calldog = -1;
+ s_player_feeddog = -1;
+ s_player_waterdog = -1;
+ s_player_staydog = -1;
+ s_player_trackdog = -1;
+ s_player_barkdog = -1;
+ s_player_warndog = -1;
+ s_player_followdog = -1;
};
call dayz_resetSelfActions;
@@ -115,6 +125,22 @@ r_action_repair = false;
r_action_targets = [];
r_pitchWhine = false;
r_isBandit = false;
+
+//ammo routine
+r_player_actions2 = [];
+r_action2 = false;
+r_player_lastVehicle = objNull;
+r_player_lastSeat = [];
+r_player_removeActions2 = {
+ if (!isNull r_player_lastVehicle) then {
+ {
+ r_player_lastVehicle removeAction _x;
+ } forEach r_player_actions2;
+ r_player_actions2 = [];
+ r_action2 = false;
+ };
+};
+
USEC_woundHit = [
"",
"body",
@@ -146,6 +172,17 @@ DAYZ_woundHit_ok = [
0.2
]
];
+DAYZ_woundHit_dog = [
+ [
+ "body",
+ "hands",
+ "legs"
+ ],[
+ 0.1,
+ 0.45,
+ 0.35
+ ]
+];
USEC_MinorWounds = [
"hands",
"legs"
@@ -176,6 +213,7 @@ dayzPublishObj = []; //used for eventhandler to spawn a mirror of players tent
dayzHideBody = objNull;
dayzPublishVeh = []; // for vehicle traders
+dayzTradeObject = []; // For all traders increment qty
dayzTraderMenu = []; // For all traders
//DayZ settings
@@ -192,13 +230,13 @@ if(isnil "dayz_maxLocalZombies") then {
dayz_spawnPos = getPosATL player;
+//init global arrays for Loot Chances
+call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\loot_init.sqf";
if(isServer) then {
- dayz_disco = [];
dayz_players = [];
dead_bodyCleanup = [];
needUpdate_objects = [];
- botPlayers = [];
};
if(!isDedicated) then {
diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp
index 4e3fe2586..591d5a139 100644
--- a/dayz_code/rscTitles.hpp
+++ b/dayz_code/rscTitles.hpp
@@ -87,7 +87,7 @@ class RscDisplayMain : RscStandardDisplay
class DAYZ_Version : CA_Version
{
idc = -1;
- text = "DayZ 1.7.5.D1207";
+ text = "DayZ 1.7.5.D1210";
y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)";
};
class CA_TitleMainMenu;
diff --git a/dayz_code/stringtable.xml b/dayz_code/stringtable.xml
index 25fc0be51..3724de30a 100644
--- a/dayz_code/stringtable.xml
+++ b/dayz_code/stringtable.xml
@@ -645,5 +645,77 @@