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 @@ Bandit Бандит + + Tame Dog + Tame Dog + zahmen Hund + Приручить собаку + + + Move To + Move To + + Иди туда + + + Dog: %1 + Dog: %1 + + + + + Call Dog + Call Dog + + Позвать собаку + + + Feed Dog + Feed Dog + + Позвать собаку + + + Water Dog + Water Dog + + Позвать собаку + + + Dog: Sit + Dog: Sit + + Позвать собаку + + + Dog: Lie Down + Dog: Lie Down + + Позвать собаку + + + Dog: Track + Dog: Track + + Позвать собаку + + + Dog: Bark + Dog: Bark + + Позвать собаку + + + Dog: %1 + Dog: %1 + + Позвать собаку + + + Dog: Follow + Dog: Follow + + Позвать собаку + \ No newline at end of file diff --git a/dayz_code/system/animal_agent.fsm b/dayz_code/system/animal_agent.fsm index f91a4d448..5c139b3d7 100644 --- a/dayz_code/system/animal_agent.fsm +++ b/dayz_code/system/animal_agent.fsm @@ -2,37 +2,33 @@ /*%FSM*/ /* item0[] = {"init",0,250,-150.000000,75.000000,-50.000000,125.000000,0.000000,"init"}; -item1[] = {"",7,210,-104.000000,321.000000,-96.000000,329.000000,0.000000,""}; -item2[] = {"End",1,250,100.000000,75.000000,200.000000,125.000000,0.000000,"End"}; -item3[] = {"",7,210,-104.000000,396.000000,-96.000000,404.000000,0.000000,""}; -item4[] = {"Not_Alive",4,218,-25.000000,300.000000,75.000000,350.000000,5.000000,"Not" \n "Alive"}; -item5[] = {"Nobody_Near",4,218,-25.000000,375.000000,75.000000,425.000000,4.000000,"Nobody" \n "Near"}; -item6[] = {"Loiter",2,4346,-150.000000,225.000000,-50.000000,275.000000,0.000000,"Loiter"}; -item7[] = {"In_Position",4,218,-25.000000,225.000000,75.000000,275.000000,1.000000,"In Position"}; -item8[] = {"preloaded",4,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"preloaded"}; -item9[] = {"",7,210,146.000000,321.000000,154.000000,329.000000,0.000000,""}; -item10[] = {"",7,210,146.000000,396.000000,154.000000,404.000000,0.000000,""}; -item11[] = {"Cleanup",2,250,100.000000,225.000000,200.000000,275.000000,0.000000,"Cleanup"}; -item12[] = {"time_up",4,218,100.000000,150.000000,200.000000,200.000000,0.000000,"time" \n "up"}; -item13[] = {"player_check",4,218,-250.000000,175.000000,-150.000000,225.000000,0.000000,"player" \n "check"}; -link0[] = {0,8}; -link1[] = {1,3}; -link2[] = {1,4}; -link3[] = {3,5}; -link4[] = {4,9}; -link5[] = {5,10}; -link6[] = {6,1}; -link7[] = {6,7}; -link8[] = {6,13}; -link9[] = {7,6}; -link10[] = {8,6}; -link11[] = {9,11}; -link12[] = {10,9}; -link13[] = {11,12}; -link14[] = {12,2}; -link15[] = {13,6}; -globals[] = {25.000000,1,0,0,0,640,480,1,84,6316128,1,-297.044281,256.119873,569.827881,-79.569984,776,911,1}; -window[] = {2,-1,-1,-32000,-32000,1026,25,1233,25,3,794}; +item1[] = {"wait",2,250,-25.000000,300.000000,75.000000,350.000000,0.000000,"wait"}; +item2[] = {"End",1,250,100.000000,225.000000,200.000000,275.000000,0.000000,"End"}; +item3[] = {"Not_Alive",4,218,-150.000000,300.000000,-50.000000,350.000000,4.000000,"Not" \n "Alive"}; +item4[] = {"Loiter",2,250,-150.000000,225.000000,-50.000000,275.000000,0.000000,"Loiter"}; +item5[] = {"In_Position",4,4314,-250.000000,275.000000,-150.000000,325.000000,2.000000,"In Position"}; +item6[] = {"preloaded",4,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"preloaded"}; +item7[] = {"time_up",4,218,-25.000000,225.000000,75.000000,275.000000,0.000000,"time" \n "up"}; +item8[] = {"player_check",4,218,-250.000000,175.000000,-150.000000,225.000000,1.000000,"player" \n "check"}; +item9[] = {"player_check",4,218,100.000000,300.000000,200.000000,350.000000,1.000000,"player" \n "check"}; +item10[] = {"tamed",4,218,-25.000000,150.000000,75.000000,200.000000,3.000000,"tamed"}; +link0[] = {0,6}; +link1[] = {1,7}; +link2[] = {1,9}; +link3[] = {3,1}; +link4[] = {4,3}; +link5[] = {4,5}; +link6[] = {4,7}; +link7[] = {4,8}; +link8[] = {4,10}; +link9[] = {5,4}; +link10[] = {6,4}; +link11[] = {7,2}; +link12[] = {8,4}; +link13[] = {9,1}; +link14[] = {10,2}; +globals[] = {25.000000,1,0,0,0,640,480,1,89,6316128,1,-299.424194,296.746490,405.380127,-436.653168,303,856,1}; +window[] = {0,-1,-1,-1,-1,1076,75,1283,75,1,321}; *//*%FSM*/ class FSM { @@ -43,11 +39,12 @@ class FSM class init { name = "init"; - init = /*%FSM*/"_position = _this select 0;" \n + init = /*%FSM*/"_pos = _this select 0;" \n "_agent = _this select 1;" \n "" \n - "_pos = _position;" \n - "_isSomeone = true;"/*%FSM*/; + "_isSomeone = true;" \n + "_timeA = time;" \n + "_isTamed = false;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -64,16 +61,55 @@ class FSM }; }; /*%FSM*/ + /*%FSM*/ + class wait + { + name = "wait"; + init = /*%FSM*/"_entityTime = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class player_check + { + priority = 1.000000; + to="wait"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _entityTime) > 30"/*%FSM*/; + action=/*%FSM*/"_entityTime = time;" \n + "" \n + "_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],300];" \n + "_isSomeone = ({isPlayer _x} count _list) > 0;" \n + "" \n + "if (_isSomeone) then {" \n + " _timeA = time;" \n + "};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class time_up + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(time - _timeA) > 120 and !_isSomeone"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ /*%FSM*/ class End { name = "End"; - init = /*%FSM*/"if (!_isSomeone) then {" \n - " deleteVehicle _agent;" \n - "} else {" \n - " dayz_bodyMonitor set [count dayz_bodyMonitor,_agent];" \n - "};" \n - ""/*%FSM*/; + init = /*%FSM*/"if (!_isTamed) then {" \n + " if (!_isSomeone) then {" \n + " deleteVehicle _agent;" \n + " } else {" \n + " dayz_bodyMonitor set [count dayz_bodyMonitor,_agent];" \n + " };" \n + "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -94,65 +130,58 @@ class FSM /*%FSM*/ class Not_Alive { - priority = 5.000000; - to="Cleanup"; + priority = 4.000000; + to="wait"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!_isAlive"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/"_timeA = time;"/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class Nobody_Near + /*%FSM*/ + class tamed { - priority = 4.000000; - to="Cleanup"; + priority = 3.000000; + to="End"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!_isSomeone"/*%FSM*/; + condition=/*%FSM*/"_isTamed"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class In_Position { - priority = 1.000000; + priority = 2.000000; to="Loiter"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_agent distance _pos < 3"/*%FSM*/; - action=/*%FSM*/"_pos = [_position,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n + action=/*%FSM*/"_pos = [_pos,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n "_agent moveTo _pos;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class player_check { - priority = 0.000000; + priority = 1.000000; to="Loiter"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(time - _entityTime) > 30"/*%FSM*/; action=/*%FSM*/"_entityTime = time;" \n "" \n "_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],300];" \n - "_isSomeone = ({isPlayer _x} count _list) > 0;"/*%FSM*/; + "_isSomeone = ({isPlayer _x} count _list) > 0;" \n + "" \n + "if (_isSomeone) then {" \n + " _timeA = time;" \n + "};"/*%FSM*/; }; /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Cleanup - { - name = "Cleanup"; - init = /*%FSM*/"_timeA = time;"/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { /*%FSM*/ class time_up { priority = 0.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(time - _timeA) > 120"/*%FSM*/; + condition=/*%FSM*/"(time - _timeA) > 120 and !_isSomeone"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ diff --git a/dayz_code/system/dog_agent.fsm b/dayz_code/system/dog_agent.fsm index 2939f990c..3305430fc 100644 --- a/dayz_code/system/dog_agent.fsm +++ b/dayz_code/system/dog_agent.fsm @@ -1,234 +1,267 @@ -/*%FSM*/ +/*%FSM*/ /*%FSM*/ /* item0[] = {"init",0,250,-150.000000,-75.000000,-50.000000,-25.000000,0.000000,"init"}; item1[] = {"idle_exceeded",4,218,0.000000,225.000000,100.000000,275.000000,0.000000,"idle" \n "exceeded"}; item2[] = {"master_moved",4,218,-150.000000,300.000000,-50.000000,350.000000,0.000000,"master" \n "moved"}; item3[] = {"Moving",2,250,-150.000000,375.000000,-50.000000,425.000000,0.000000,"Moving"}; -item4[] = {"close",4,4314,-275.000000,300.000000,-175.000000,350.000000,0.000000,"close"}; +item4[] = {"close",4,218,-275.000000,300.000000,-175.000000,350.000000,1.000000,"close"}; item5[] = {"",7,210,-229.000000,246.000000,-221.000000,254.000000,0.000000,""}; item6[] = {"Waiting",2,250,-150.000000,225.000000,-50.000000,275.000000,0.000000,"Waiting"}; item7[] = {"preloaded",4,218,-150.000000,0.000000,-50.000000,50.000000,0.000000,"preloaded"}; item8[] = {"reorientate",4,218,-150.000000,450.000000,-50.000000,500.000000,0.000000,"reorientate"}; item9[] = {"Sitting",2,250,150.000000,225.000000,250.000000,275.000000,0.000000,"Sitting"}; -item10[] = {"master_moved",4,218,150.000000,300.000000,250.000000,350.000000,0.000000,"master" \n "moved"}; -item11[] = {"Getting_Up",2,250,150.000000,375.000000,250.000000,425.000000,0.000000,"Getting Up"}; -item12[] = {"Up",4,218,0.000000,375.000000,100.000000,425.000000,0.000000,"Up"}; -item13[] = {"dead",4,218,0.000000,300.000000,100.000000,350.000000,3.000000,"dead"}; -item14[] = {"End",1,250,0.000000,450.000000,100.000000,500.000000,0.000000,"End"}; +item10[] = {"master_moved",4,218,350.000000,275.000000,450.000000,325.000000,0.000000,"master" \n "moved"}; +item11[] = {"Getting_Up",2,250,525.000000,200.000000,625.000000,250.000000,0.000000,"Getting Up"}; +item12[] = {"Up",4,218,525.000000,500.000000,625.000000,550.000000,0.000000,"Up"}; +item13[] = {"dead",4,218,0.000000,300.000000,100.000000,350.000000,9.000000,"dead"}; +item14[] = {"End",1,250,0.000000,375.000000,100.000000,425.000000,0.000000,"End"}; item15[] = {"stay",4,218,0.000000,125.000000,100.000000,175.000000,1.000000,"stay"}; item16[] = {"",7,210,-29.000002,245.999985,-20.999998,254.000015,0.000000,""}; item17[] = {"",7,210,-29.000000,146.000000,-21.000000,153.999985,0.000000,""}; item18[] = {"Staying",2,250,150.000000,125.000000,250.000000,175.000000,0.000000,"Staying"}; -item19[] = {"commanded",4,218,375.000000,175.000000,475.000000,225.000000,0.000000,"commanded"}; -item20[] = {"",7,210,421.000031,146.000000,428.999969,154.000000,0.000000,""}; -item21[] = {"",7,210,571.000000,146.000000,579.000000,154.000000,0.000000,""}; -item22[] = {"too_long",4,218,525.000000,175.000000,625.000000,225.000000,0.000000,"too long"}; -item23[] = {"Reset",2,250,450.000000,300.000000,550.000000,350.000000,0.000000,"Reset"}; -item24[] = {"true",8,218,450.000000,375.000000,550.000000,425.000000,0.000000,"true"}; -item25[] = {"",7,210,421.000000,321.000000,429.000000,329.000000,0.000000,""}; -item26[] = {"track",4,218,0.000000,25.000000,100.000000,75.000000,0.000000,"track"}; -item27[] = {"",7,210,-29.000000,46.000008,-21.000000,53.999996,0.000000,""}; -item28[] = {"Tracking",2,250,275.000000,-50.000000,375.000000,0.000000,0.000000,"Tracking"}; -item29[] = {"commanded",4,218,425.000000,-50.000000,525.000000,0.000000,0.000000,"commanded"}; -item30[] = {"Checking",2,250,150.000000,25.000000,250.000000,75.000000,0.000000,"Checking"}; -item31[] = {"has_target",4,218,150.000000,-50.000000,250.000000,0.000000,1.000000,"has target"}; -item32[] = {"no_target",4,218,425.000000,25.000000,525.000000,75.000000,4.000000,"no target"}; -item33[] = {"Reset_1",2,250,600.000000,25.000000,700.000000,75.000000,0.000000,"Reset"}; -item34[] = {"",7,210,721.000000,46.000008,729.000000,53.999996,0.000000,""}; -item35[] = {"",7,210,396.000000,46.000008,404.000000,53.999989,0.000000,""}; -item36[] = {"",7,210,396.000000,-28.999994,404.000000,-21.000006,0.000000,""}; -item37[] = {"",7,210,396.000000,-129.000000,404.000000,-121.000008,0.000000,""}; -item38[] = {"at_target",4,218,425.000000,-150.000000,525.000000,-100.000000,0.000000,"at target"}; -item39[] = {"",7,210,571.000000,-28.999992,579.000000,-21.000008,0.000000,""}; -item40[] = {"",7,210,571.000000,46.000008,579.000000,53.999996,0.000000,""}; -item41[] = {"Chasing",2,250,550.000000,-150.000000,650.000000,-100.000000,0.000000,"Chasing"}; -item42[] = {"",7,210,721.000000,-179.000015,729.000000,-171.000000,0.000000,""}; -item43[] = {"",7,210,-179.000000,-179.000000,-171.000000,-171.000000,0.000000,""}; -item44[] = {"",7,210,-179.000000,171.000000,-171.000000,179.000000,0.000000,""}; -item45[] = {"reorientate",4,218,225.000000,-125.000000,325.000000,-75.000000,0.000000,"reorientate"}; -item46[] = {"action_init",2,250,-150.000000,75.000000,-50.000000,125.000000,0.000000,"action init"}; -item47[] = {"true",8,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"true"}; -item48[] = {"commanded",4,218,275.000000,300.000000,375.000000,350.000000,0.000000,"commanded"}; -item49[] = {"instant",4,218,-350.000000,375.000000,-250.000000,425.000000,0.000000,"instant"}; -item50[] = {"",7,210,-304.000000,246.000000,-296.000000,253.999985,0.000000,""}; -item51[] = {"",7,210,-29.000000,321.000000,-21.000000,329.000000,0.000000,""}; -item52[] = {"",7,210,196.000000,196.000000,204.000000,204.000000,0.000000,""}; -item53[] = {"",7,210,46.000000,196.000000,54.000000,204.000000,0.000000,""}; -item54[] = {"reorientate",4,218,600.000000,-75.000000,700.000000,-25.000000,0.000000,"reorientate"}; -item55[] = {"",7,210,596.000000,-78.999992,604.000000,-71.000008,0.000000,""}; -item56[] = {"",7,210,396.000000,-78.999992,404.000000,-71.000008,0.000000,""}; -item57[] = {"",7,210,395.999969,95.999992,404.000000,104.000000,0.000000,""}; -item58[] = {"",7,210,196.000000,96.000000,204.000000,104.000000,0.000000,""}; -item59[] = {"",7,210,-29.000000,96.000000,-21.000000,104.000000,0.000000,""}; -item60[] = {"",7,210,571.000000,321.000000,579.000000,329.000000,0.000000,""}; -item61[] = {"move",4,218,0.000000,-350.000000,100.000000,-300.000000,0.000000,"move"}; -item62[] = {"Get_Position",2,250,125.000000,-350.000000,225.000000,-300.000000,0.000000,"Get Position"}; -item63[] = {"valid_position",4,218,125.000000,-425.000000,225.000000,-375.000000,0.000000,"valid position"}; -item64[] = {"Moving_1",2,250,250.000000,-425.000000,350.000000,-375.000000,0.000000,"Moving"}; -item65[] = {"no_position",4,218,125.000000,-275.000000,225.000000,-225.000000,0.000000,"no position"}; -item66[] = {"Nothing",2,250,250.000000,-275.000000,350.000000,-225.000000,0.000000,"Nothing"}; -item67[] = {"commanded",4,218,250.000000,-350.000000,350.000000,-300.000000,0.000000,"commanded"}; -item68[] = {"",7,210,295.999969,-179.000000,304.000031,-171.000000,0.000000,""}; -item69[] = {"lost",4,218,375.000000,-425.000000,475.000000,-375.000000,0.000000,"lost"}; -item70[] = {"call_back",4,218,375.000000,-275.000000,475.000000,-225.000000,0.000000,"call back"}; -item71[] = {"Wander",2,250,375.000000,-350.000000,475.000000,-300.000000,0.000000,"Wander"}; -item72[] = {"In_Position",4,218,475.000000,-300.000000,575.000000,-250.000000,1.000000,"In Position"}; -item73[] = {"",7,210,-28.999996,-329.000000,-21.000002,-321.000000,0.000000,""}; -item74[] = {"",7,210,296.000000,-454.000000,304.000000,-446.000000,0.000000,""}; -item75[] = {"",7,210,746.000000,-454.000000,753.999939,-446.000000,0.000000,""}; -item76[] = {"",7,210,746.000000,-329.000000,754.000000,-321.000000,0.000000,""}; -item77[] = {"",7,210,746.000000,446.000000,754.000000,453.999969,0.000000,""}; -item78[] = {"",7,210,-29.000000,246.000000,-21.000000,254.000000,0.000000,""}; -item79[] = {"",7,210,121.000000,446.000000,129.000000,454.000000,0.000000,""}; -item80[] = {"",7,210,121.000000,371.000000,129.000000,379.000000,0.000000,""}; -item81[] = {"",7,210,-29.000000,-404.000000,-21.000000,-396.000000,0.000000,""}; -item82[] = {"player_enter__ve",8,218,-150.000000,-425.000000,-50.000000,-375.000000,2.000000,"player enter " \n "vehicle"}; -item83[] = {"in_vehicle",2,250,-525.000000,-425.000000,-425.000000,-375.000000,0.000000,"in vehicle"}; -item84[] = {"player_exit__veh",4,218,-525.000000,-350.000000,-425.000000,-300.000000,0.000000,"player exit " \n "vehicle"}; -item85[] = {"",7,210,-228.999985,-454.000000,-221.000015,-446.000000,0.000000,""}; -item86[] = {"move_to_vehicle",2,250,-275.000000,-425.000000,-175.000000,-375.000000,0.000000,"move to vehicle"}; -item87[] = {"at_vehicle",4,218,-400.000000,-425.000000,-300.000000,-375.000000,0.000000,"at vehicle"}; -item88[] = {"",7,210,-478.999969,-454.000000,-471.000031,-446.000000,0.000000,""}; -item89[] = {"",7,210,-229.000000,-454.000000,-221.000000,-446.000000,0.000000,""}; -item90[] = {"vehicle_too_far",4,218,-275.000000,-350.000000,-175.000000,-300.000000,0.000000,"vehicle too far"}; -item91[] = {"Wait",2,250,-400.000000,-350.000000,-300.000000,-300.000000,0.000000,"Wait"}; -item92[] = {"call_back",4,218,-400.000000,-275.000000,-300.000000,-225.000000,0.000000,"call back"}; +item19[] = {"commanded",4,218,350.000000,175.000000,450.000000,225.000000,0.000000,"commanded"}; +item20[] = {"",7,210,271.000000,146.000000,279.000000,154.000000,0.000000,""}; +item21[] = {"",7,210,271.000000,196.000000,279.000000,204.000000,0.000000,""}; +item22[] = {"too_long",4,218,350.000000,125.000000,450.000000,175.000000,0.000000,"too long"}; +item23[] = {"",7,210,271.000000,246.000000,279.000000,254.000000,0.000000,""}; +item24[] = {"",7,210,271.000000,296.000000,279.000000,304.000000,0.000000,""}; +item25[] = {"track",4,218,0.000000,25.000000,100.000000,75.000000,0.000000,"track"}; +item26[] = {"",7,210,-29.000000,46.000008,-21.000000,53.999996,0.000000,""}; +item27[] = {"Tracking",2,250,275.000000,-50.000000,375.000000,0.000000,0.000000,"Tracking"}; +item28[] = {"commanded",4,218,425.000000,-50.000000,525.000000,0.000000,0.000000,"commanded"}; +item29[] = {"Checking",2,250,150.000000,25.000000,250.000000,75.000000,0.000000,"Checking"}; +item30[] = {"has_target",4,218,150.000000,-50.000000,250.000000,0.000000,1.000000,"has target"}; +item31[] = {"no_target",4,218,425.000000,25.000000,525.000000,75.000000,4.000000,"no target"}; +item32[] = {"",7,210,571.000000,-41.500000,579.000000,-33.500000,0.000000,""}; +item33[] = {"",7,210,571.000000,-154.000000,579.000000,-146.000000,0.000000,""}; +item34[] = {"",7,210,396.000000,46.000008,404.000000,53.999989,0.000000,""}; +item35[] = {"",7,210,396.000000,-28.999994,404.000000,-21.000006,0.000000,""}; +item36[] = {"at_target",4,218,350.000000,-125.000000,450.000000,-75.000000,1.000000,"at target"}; +item37[] = {"",7,210,571.000000,-28.999992,579.000000,-21.000008,0.000000,""}; +item38[] = {"",7,210,571.000000,46.000008,579.000000,53.999996,0.000000,""}; +item39[] = {"",7,210,-229.000000,-154.000000,-221.000000,-146.000000,0.000000,""}; +item40[] = {"",7,210,421.000000,-404.000000,429.000000,-396.000000,0.000000,""}; +item41[] = {"reorientate",4,218,225.000000,-125.000000,325.000000,-75.000000,0.000000,"reorientate"}; +item42[] = {"action_init",2,250,-150.000000,75.000000,-50.000000,125.000000,0.000000,"action init"}; +item43[] = {"true",8,218,-150.000000,150.000000,-50.000000,200.000000,0.000000,"true"}; +item44[] = {"commanded",4,218,350.000000,225.000000,450.000000,275.000000,0.000000,"commanded"}; +item45[] = {"",7,210,-304.000000,246.000000,-296.000000,253.999985,0.000000,""}; +item46[] = {"",7,210,-29.000000,321.000000,-21.000000,329.000000,0.000000,""}; +item47[] = {"",7,210,196.000000,196.000000,204.000000,204.000000,0.000000,""}; +item48[] = {"",7,210,46.000000,196.000000,54.000000,204.000000,0.000000,""}; +item49[] = {"",7,210,395.999969,95.999992,404.000000,104.000000,0.000000,""}; +item50[] = {"",7,210,196.000000,96.000000,204.000000,104.000000,0.000000,""}; +item51[] = {"",7,210,-29.000000,96.000000,-21.000000,104.000000,0.000000,""}; +item52[] = {"move",4,218,0.000000,-300.000000,100.000000,-250.000000,8.000000,"move"}; +item53[] = {"Get_Position",2,250,125.000000,-300.000000,225.000000,-250.000000,0.000000,"Get Position"}; +item54[] = {"valid_position",4,218,125.000000,-375.000000,225.000000,-325.000000,0.000000,"valid position"}; +item55[] = {"Moving_1",2,250,250.000000,-375.000000,350.000000,-325.000000,0.000000,"Moving"}; +item56[] = {"no_position",4,218,125.000000,-225.000000,225.000000,-175.000000,0.000000,"no position"}; +item57[] = {"commanded",4,218,250.000000,-225.000000,350.000000,-175.000000,0.000000,"commanded"}; +item58[] = {"",7,210,170.999969,-154.000000,179.000031,-146.000000,0.000000,""}; +item59[] = {"lost",4,218,400.000000,-325.000000,500.000000,-275.000000,0.000000,"lost"}; +item60[] = {"",7,210,658.500000,-354.000000,666.500000,-346.000000,0.000000,""}; +item61[] = {"",7,210,496.000000,-504.000000,504.000000,-496.000000,0.000000,""}; +item62[] = {"",7,210,696.000000,-553.999939,704.000000,-546.000000,0.000000,""}; +item63[] = {"",7,210,-28.999996,-279.000000,-21.000002,-271.000000,0.000000,""}; +item64[] = {"",7,210,296.000000,-404.000000,304.000000,-396.000000,0.000000,""}; +item65[] = {"",7,210,721.000061,-404.000000,728.999939,-396.000000,0.000000,""}; +item66[] = {"",7,210,721.000000,-279.000000,729.000000,-271.000000,0.000000,""}; +item67[] = {"",7,210,721.000000,358.500000,729.000000,366.499969,0.000000,""}; +item68[] = {"",7,210,-29.000000,246.000000,-21.000000,254.000000,0.000000,""}; +item69[] = {"",7,210,120.999992,358.500000,129.000000,366.500000,0.000000,""}; +item70[] = {"",7,210,-29.000000,-354.000000,-21.000000,-346.000000,0.000000,""}; +item71[] = {"player_enter__ve",4,218,-150.000000,-375.000000,-50.000000,-325.000000,2.000000,"player enter " \n "vehicle"}; +item72[] = {"in_vehicle",2,250,-525.000000,-375.000000,-425.000000,-325.000000,0.000000,"in vehicle"}; +item73[] = {"player_exit__veh",4,218,-525.000000,-300.000000,-425.000000,-250.000000,0.000000,"player exit " \n "vehicle"}; +item74[] = {"",7,210,-228.999985,-404.000000,-221.000015,-396.000000,0.000000,""}; +item75[] = {"move_to_vehicle",2,250,-275.000000,-375.000000,-175.000000,-325.000000,0.000000,"move to vehicle"}; +item76[] = {"at_vehicle",4,218,-400.000000,-375.000000,-300.000000,-325.000000,0.000000,"at vehicle"}; +item77[] = {"",7,210,-478.999969,-404.000000,-471.000031,-396.000000,0.000000,""}; +item78[] = {"",7,210,-229.000000,-404.000000,-221.000000,-396.000000,0.000000,""}; +item79[] = {"vehicle_too_far",4,218,-275.000000,-300.000000,-175.000000,-250.000000,0.000000,"vehicle too far"}; +item80[] = {"Wait",2,250,-400.000000,-300.000000,-300.000000,-250.000000,0.000000,"Wait"}; +item81[] = {"call_back",4,218,-400.000000,-225.000000,-300.000000,-175.000000,0.000000,"call back"}; +item82[] = {"",7,210,-354.000000,246.000000,-346.000000,254.000000,0.000000,""}; +item83[] = {"In_Position",4,218,-300.000000,-250.000000,-200.000000,-200.000000,1.000000,"In Position"}; +item84[] = {"reorientate",4,218,-175.000000,-325.000000,-75.000000,-275.000000,0.000000,"reorientate"}; +item85[] = {"",7,210,-479.000000,96.000008,-471.000000,103.999992,0.000000,""}; +item86[] = {"",7,210,96.000000,96.000000,104.000000,104.000000,0.000000,""}; +item87[] = {"",7,210,296.000000,-154.000000,304.000000,-146.000015,0.000000,""}; +item88[] = {"",7,210,471.000000,146.000000,479.000000,154.000000,0.000000,""}; +item89[] = {"",7,210,471.000000,196.000000,479.000000,204.000000,0.000000,""}; +item90[] = {"",7,210,471.000000,246.000000,479.000000,254.000000,0.000000,""}; +item91[] = {"",7,210,471.000000,296.000000,479.000000,304.000000,0.000000,""}; +item92[] = {"",7,210,-304.000000,520.999939,-296.000000,529.000000,0.000000,""}; item93[] = {"",7,210,-354.000000,246.000000,-346.000000,254.000000,0.000000,""}; -item94[] = {"In_Position",4,218,-300.000000,-300.000000,-200.000000,-250.000000,1.000000,"In Position"}; -item95[] = {"reorientate",4,218,-175.000000,-375.000000,-75.000000,-325.000000,0.000000,"reorientate"}; -item96[] = {"",7,210,-479.000000,96.000008,-471.000000,103.999992,0.000000,""}; -item97[] = {"",7,210,96.000000,96.000000,104.000000,104.000000,0.000000,""}; +item94[] = {"has_target",4,218,250.000000,-475.000000,350.000000,-425.000000,2.000000,"has target"}; +item95[] = {"chase",2,250,375.000000,-475.000000,475.000000,-425.000000,0.000000,"chase"}; +item96[] = {"reorientate",4,218,375.000000,-550.000000,475.000000,-500.000000,0.000000,"reorientate"}; +item97[] = {"",7,210,658.500000,-454.000000,666.500000,-446.000000,0.000000,""}; +item98[] = {"",7,210,495.999969,-454.000000,504.000000,-446.000000,0.000000,""}; +item99[] = {"",7,210,658.500000,-503.999969,666.500000,-496.000000,0.000000,""}; +item100[] = {"",7,210,496.000000,-554.000000,504.000000,-546.000000,0.000000,""}; +item101[] = {"commanded",4,218,525.000000,-575.000000,625.000000,-525.000000,0.000000,"commanded"}; +item102[] = {"target_lost",4,218,525.000000,-475.000000,625.000000,-425.000000,0.000000,"target lost"}; +item103[] = {"target_dead",4,218,525.000000,-525.000000,625.000000,-475.000000,0.000000,"target dead"}; +item104[] = {"",7,210,696.000000,-154.000000,704.000000,-146.000000,0.000000,""}; +item105[] = {"find_target",4,218,350.000000,-275.000000,450.000000,-225.000000,1.000000,"find target"}; +item106[] = {"DayZ_Dog_Agent_FSM",-1,250,-475.000000,-625.000000,-75.000000,-425.000000,0.000000,"DayZ Dog Agent FSM" \n "Created by Rocket and Alby"}; +item107[] = {"____FAKE____",9,4280,0.000000,0.000000,0.000000,0.000000,0.000000,"____FAKE____"}; +version=1; +class LayoutItems +{ + class Item106 + { + class ItemInfo + { + FontFace="Arial"; + FontHeight=19; + lStyle=1; + lColor=-1; + }; + }; +}; link0[] = {0,7}; link1[] = {1,9}; link2[] = {2,3}; link3[] = {3,4}; link4[] = {3,8}; -link5[] = {3,49}; -link6[] = {3,51}; -link7[] = {4,5}; -link8[] = {5,6}; -link9[] = {6,2}; -link10[] = {6,13}; -link11[] = {6,16}; -link12[] = {7,46}; -link13[] = {8,3}; -link14[] = {9,10}; -link15[] = {9,13}; -link16[] = {9,48}; -link17[] = {9,52}; -link18[] = {10,11}; -link19[] = {11,12}; -link20[] = {11,80}; -link21[] = {12,6}; -link22[] = {13,14}; -link23[] = {15,18}; -link24[] = {16,1}; -link25[] = {16,17}; -link26[] = {17,15}; -link27[] = {17,59}; -link28[] = {18,20}; -link29[] = {18,58}; -link30[] = {19,25}; -link31[] = {20,19}; -link32[] = {20,21}; -link33[] = {21,22}; -link34[] = {22,60}; -link35[] = {23,24}; -link36[] = {24,11}; -link37[] = {25,23}; -link38[] = {26,30}; -link39[] = {27,26}; -link40[] = {27,73}; -link41[] = {28,36}; +link5[] = {3,46}; +link6[] = {4,5}; +link7[] = {5,6}; +link8[] = {6,2}; +link9[] = {6,13}; +link10[] = {6,16}; +link11[] = {7,42}; +link12[] = {8,3}; +link13[] = {9,13}; +link14[] = {9,23}; +link15[] = {9,47}; +link16[] = {10,91}; +link17[] = {11,12}; +link18[] = {11,67}; +link19[] = {12,92}; +link20[] = {13,14}; +link21[] = {15,18}; +link22[] = {16,1}; +link23[] = {16,17}; +link24[] = {17,15}; +link25[] = {17,51}; +link26[] = {18,20}; +link27[] = {18,50}; +link28[] = {19,89}; +link29[] = {20,21}; +link30[] = {20,22}; +link31[] = {21,19}; +link32[] = {22,88}; +link33[] = {23,24}; +link34[] = {23,44}; +link35[] = {24,10}; +link36[] = {25,29}; +link37[] = {26,25}; +link38[] = {26,63}; +link39[] = {27,35}; +link40[] = {27,36}; +link41[] = {27,41}; link42[] = {28,37}; -link43[] = {28,45}; -link44[] = {29,39}; -link45[] = {30,31}; -link46[] = {30,35}; -link47[] = {31,28}; -link48[] = {32,40}; -link49[] = {33,34}; -link50[] = {34,42}; -link51[] = {35,32}; -link52[] = {35,57}; -link53[] = {36,29}; -link54[] = {36,35}; -link55[] = {37,38}; -link56[] = {38,41}; -link57[] = {39,40}; -link58[] = {40,33}; -link59[] = {41,54}; -link60[] = {41,55}; -link61[] = {42,68}; -link62[] = {43,44}; -link63[] = {44,47}; -link64[] = {45,28}; -link65[] = {46,47}; -link66[] = {47,6}; -link67[] = {48,11}; -link68[] = {49,50}; -link69[] = {50,5}; -link70[] = {51,13}; -link71[] = {51,78}; -link72[] = {52,53}; -link73[] = {53,15}; -link74[] = {54,41}; -link75[] = {55,56}; -link76[] = {56,36}; -link77[] = {57,58}; -link78[] = {58,97}; -link79[] = {59,27}; -link80[] = {60,23}; -link81[] = {61,62}; -link82[] = {62,63}; -link83[] = {62,65}; -link84[] = {63,64}; -link85[] = {64,67}; -link86[] = {64,69}; -link87[] = {64,74}; -link88[] = {65,66}; -link89[] = {66,68}; -link90[] = {67,66}; -link91[] = {68,43}; -link92[] = {69,71}; -link93[] = {70,66}; -link94[] = {71,70}; -link95[] = {71,72}; -link96[] = {71,76}; -link97[] = {72,71}; -link98[] = {73,61}; -link99[] = {73,81}; -link100[] = {74,75}; -link101[] = {75,76}; -link102[] = {76,77}; -link103[] = {77,79}; -link104[] = {79,80}; -link105[] = {80,13}; -link106[] = {81,82}; -link107[] = {82,86}; -link108[] = {83,84}; -link109[] = {83,88}; -link110[] = {84,96}; -link111[] = {85,74}; -link112[] = {86,87}; -link113[] = {86,89}; -link114[] = {86,90}; -link115[] = {86,95}; -link116[] = {87,83}; -link117[] = {88,89}; -link118[] = {90,91}; -link119[] = {91,89}; -link120[] = {91,92}; -link121[] = {91,94}; -link122[] = {92,93}; -link123[] = {93,50}; -link124[] = {94,91}; -link125[] = {95,86}; -link126[] = {96,46}; -link127[] = {97,13}; -globals[] = {25.000000,1,0,0,0,640,480,1,260,6316128,1,-727.852478,476.612427,472.387665,-270.819122,974,601,1}; -window[] = {2,-1,-1,-1,-1,824,44,1252,44,3,991}; +link43[] = {29,30}; +link44[] = {29,34}; +link45[] = {30,27}; +link46[] = {31,38}; +link47[] = {32,33}; +link48[] = {33,87}; +link49[] = {34,31}; +link50[] = {34,49}; +link51[] = {35,28}; +link52[] = {35,34}; +link53[] = {36,27}; +link54[] = {38,32}; +link55[] = {39,5}; +link56[] = {40,65}; +link57[] = {41,27}; +link58[] = {42,43}; +link59[] = {43,6}; +link60[] = {44,90}; +link61[] = {45,5}; +link62[] = {46,13}; +link63[] = {46,68}; +link64[] = {47,48}; +link65[] = {48,15}; +link66[] = {49,50}; +link67[] = {50,86}; +link68[] = {51,26}; +link69[] = {52,53}; +link70[] = {53,54}; +link71[] = {53,56}; +link72[] = {54,55}; +link73[] = {55,57}; +link74[] = {55,59}; +link75[] = {55,64}; +link76[] = {55,94}; +link77[] = {55,105}; +link78[] = {56,58}; +link79[] = {57,87}; +link80[] = {58,39}; +link81[] = {59,55}; +link82[] = {60,55}; +link83[] = {61,100}; +link84[] = {61,103}; +link85[] = {62,104}; +link86[] = {63,52}; +link87[] = {63,70}; +link88[] = {64,40}; +link89[] = {65,66}; +link90[] = {66,67}; +link91[] = {67,69}; +link92[] = {69,13}; +link93[] = {70,71}; +link94[] = {71,75}; +link95[] = {72,73}; +link96[] = {72,77}; +link97[] = {73,85}; +link98[] = {74,64}; +link99[] = {75,76}; +link100[] = {75,78}; +link101[] = {75,79}; +link102[] = {75,84}; +link103[] = {76,72}; +link104[] = {77,78}; +link105[] = {79,80}; +link106[] = {80,78}; +link107[] = {80,81}; +link108[] = {80,83}; +link109[] = {81,82}; +link110[] = {82,45}; +link111[] = {83,80}; +link112[] = {84,75}; +link113[] = {85,42}; +link114[] = {86,13}; +link115[] = {87,58}; +link116[] = {88,89}; +link117[] = {89,11}; +link118[] = {90,11}; +link119[] = {91,90}; +link120[] = {92,45}; +link121[] = {94,95}; +link122[] = {95,40}; +link123[] = {95,96}; +link124[] = {95,98}; +link125[] = {96,95}; +link126[] = {97,60}; +link127[] = {98,61}; +link128[] = {98,102}; +link129[] = {99,97}; +link130[] = {100,101}; +link131[] = {101,62}; +link132[] = {102,97}; +link133[] = {103,99}; +link134[] = {104,33}; +link135[] = {105,55}; +link136[] = {28,107}; +globals[] = {25.000000,1,0,0,0,640,480,1,328,6316128,1,-1050.945190,1340.164185,622.805908,-920.993103,1411,911,1}; +window[] = {2,-1,-1,-1,-1,830,50,1258,50,3,1429}; *//*%FSM*/ class FSM { @@ -250,8 +283,10 @@ class FSM "_staySkill = 30;" \n "_senseSkill = 300; //x3 for tracking?" \n "_target = objNull;" \n + "_attackTarget = objNull;" \n "_target setVariable ['forceWalk',false];" \n - "_lastPos = [0,0,0];" \n + "_pos = position _dog;" \n + "_lastPos = _pos;" \n "_move = """";" \n "_movePos = [];" \n "_watchDog = true;" \n @@ -260,13 +295,16 @@ class FSM "" \n "_hunger = 0;" \n "_thrist = 0;" \n - "_actionLieDown = -1;" \n + "_actionLieDown = false;" \n "" \n "_character = player;" \n "" \n "_actionDir = ""\z\addons\dayz_code\actions\dog\"";" \n "" \n - "_speedVal = [1,6,-1];"/*%FSM*/; + "_speedVal = [1,8,-1];" \n + "" \n + "_dog setVariable [""state"", ""passive"", true];" \n + "_dog setVariable [""currentSpeed"", _maxSpeed];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -287,40 +325,32 @@ class FSM class Moving { name = "Moving"; - init = /*%FSM*/"_pos = (vehicle player) modelToWorld [-1,1,0];" \n + init = /*%FSM*/"_pos = [(getPos (vehicle player)),1,2,4,0,5,0] call BIS_fnc_findSafePos;" \n "" \n - "if(_lastPos distance _pos > 1 or _forceChange) then {" \n - " _lastPos = _pos;" \n - " _dog doMove _pos;" \n - " _dog forceSpeed (_speedVal select _maxSpeed);" \n - " _forceChange = false;" \n - "};" \n - "_waitTime = time;" \n + "_dog moveTo _pos;" \n + "_dog forceSpeed (_speedVal select _maxSpeed);" \n "" \n - "if (vehicle player != player) then {" \n - " diag_log format[""PLAYER IS IN: %1, str(vehicle player)];" \n - "};" \n - ""/*%FSM*/; + "_waitTime = time;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class instant + /*%FSM*/ + class close { - priority = 0.000000; + priority = 1.000000; to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!_waiting"/*%FSM*/; + condition=/*%FSM*/"(vehicle player) distance _dog < 5"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ @@ -330,17 +360,7 @@ class FSM priority = 0.000000; to="Moving"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > 0.5)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class close - { - priority = 0.000000; - to="Waiting"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(vehicle player) distance _dog < 5"/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > 1)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ @@ -352,29 +372,40 @@ class FSM { name = "Waiting"; init = /*%FSM*/"_waitTime = time;" \n - "_waiting = true;" \n - "_lastpos = player modelToWorld [-1,1,0];" \n - ""/*%FSM*/; + "_lastpos = _pos;" \n + "_lostTarget = false;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class move + { + priority = 8.000000; + to="Get_Position"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command == ""move"""/*%FSM*/; + action=/*%FSM*/"_command = ""none"";" \n + "_lost = false;" \n + "_dog setVariable [""state"", ""aggressive"", true];"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class player_enter__ve { priority = 2.000000; to="move_to_vehicle"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(vehicle _character != _character);"/*%FSM*/; + condition=/*%FSM*/"vehicle _character != _character"/*%FSM*/; action=/*%FSM*/"diag_log ""PLAYER ENTERED VEHICLE"";"/*%FSM*/; }; /*%FSM*/ @@ -398,16 +429,6 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class move - { - priority = 0.000000; - to="Get_Position"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command == ""move"""/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class idle_exceeded { @@ -420,7 +441,6 @@ class FSM " _move = ""Dog_LieDown"";" \n "} else {" \n " _move = ""Dog_SitDown"";" \n - " _actionLieDown = _dog addAction [""Lie Down"", _actionDir + ""stay.sqf"",_handle, 0, true, true];" \n "};" \n "[objNull, _dog, rSwitchMove,_move] call RE;"/*%FSM*/; }; @@ -432,7 +452,7 @@ class FSM to="Moving"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(vehicle player) distance _dog > 2"/*%FSM*/; - action=/*%FSM*/"_lastPos = position _dog;"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ }; @@ -450,7 +470,7 @@ class FSM /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; @@ -467,16 +487,6 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class commanded - { - priority = 0.000000; - to="Getting_Up"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command != ""none"""/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class master_moved { @@ -487,6 +497,16 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class commanded + { + priority = 0.000000; + to="Getting_Up"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command != ""none"""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ }; }; /*%FSM*/ @@ -504,14 +524,14 @@ class FSM "[objNull, _dog, rSwitchMove,_move] call RE;" \n "_waitTime = time;" \n "_standing = true;" \n - "_dog removeAction _actionLieDown;"/*%FSM*/; + "_actionLieDown = false;"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; @@ -539,25 +559,7 @@ class FSM "" \n "terminate _heartbeat;" \n "" \n - "_dog removeAction _actionWarn;" \n - "_dog removeAction _actionStay;" \n - "_dog removeAction _actionTrack;" \n - "_dog removeAction _actionBark;" \n - "_dog removeAction _actionFood;" \n - "_dog removeAction _actionWater;" \n - "" \n - "player removeAction _actionMove;" \n - "player removeAction _actionSpeedStealth;" \n - "player removeAction _actionSpeedFree;" \n - "" \n - "if(!isNil ""_actionCall"") then {" \n - " player removeAction _actionCall;" \n - "};" \n - "" \n - "if(!isNil ""_actionFollow"") then {" \n - " _dog removeAction _actionFollow;" \n - "};" \n - ""/*%FSM*/; + "player setVariable [""dogID"", 0];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -572,18 +574,14 @@ class FSM " _standing = false;" \n " if (!_watchDog) then {" \n " _move = ""Dog_LieDown"";" \n + " _actionLieDown = false;" \n " } else {" \n " _move = ""Dog_SitDown"";" \n - " _actionLieDown = _dog addAction [""Lie Down"", _actionDir + ""stay.sqf"",_handle, 0, true, true];" \n + " _actionLieDown = true;" \n " };" \n " [objNull, _dog, rSwitchMove,_move] call RE;" \n "};" \n "" \n - "_dog removeAction _actionStay;" \n - "" \n - "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n - "" \n "_waitTime = time;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; @@ -592,28 +590,18 @@ class FSM /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class too_long - { - priority = 0.000000; - to="Reset"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > _staySkill)"/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class commanded { priority = 0.000000; - to="Reset"; + to="Getting_Up"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""stay"""/*%FSM*/; action=/*%FSM*/"if (_command == ""return"") then {" \n @@ -624,32 +612,14 @@ class FSM "};"/*%FSM*/; }; /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Reset - { - name = "Reset"; - init = /*%FSM*/"_dog removeAction _actionLieDown;" \n - "" \n - "player removeAction _actionCall;" \n - "_dog removeAction _actionFollow;" \n - "" \n - "_actionStay = _dog addAction [""Stay"",_actionDir + ""stay.sqf"",_handle, 5, true, true];" \n - "_waiting = false;"/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { - /*%FSM*/ - class true + /*%FSM*/ + class too_long { priority = 0.000000; to="Getting_Up"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"true"/*%FSM*/; - action=/*%FSM*/"_forceWalk = false;" \n - "_dog forceSpeed -1;"/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > _staySkill)"/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; }; /*%FSM*/ }; @@ -659,54 +629,54 @@ class FSM class Tracking { name = "Tracking"; - init = /*%FSM*/"_pos = position _target;" \n - "if(_lastPos distance _pos > 1 or _forceChange) then {" \n - " _lastPos = _pos;" \n - " _dog doMove _pos;" \n - " _dog forceSpeed (_speedVal select _maxSpeed);" \n - " _forceChange = false;" \n - "};" \n + init = /*%FSM*/"_pos = [(getPos _target),1,2,4,0,5,0] call BIS_fnc_findSafePos;" \n + "_dog moveTo _pos;" \n + "_dog forceSpeed (_speedVal select _maxSpeed);" \n + "_forceChange = false;" \n "" \n "_waitTime = time;" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { - /*%FSM*/ - class no_target - { - priority = 4.000000; - to="Reset_1"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class no_target + { + priority = 4.000000; + to="Waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class at_target { - priority = 0.000000; - to="Chasing"; + priority = 1.000000; + to="Tracking"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_dog distance _target < 10"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; + action=/*%FSM*/"if (_watchDog) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + "};"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class commanded { priority = 0.000000; - to="Reset_1"; + to="____FAKE____"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""track"""/*%FSM*/; action=/*%FSM*/"if (_command == ""return"") then {" \n @@ -724,7 +694,7 @@ class FSM to="Tracking"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"((time - _waitTime) > 0.5)"/*%FSM*/; - action=/*%FSM*/"if ((random 1) < 0.3 and (time - _coolDown > 4)) then {" \n + action=/*%FSM*/"if ((random 1) < 0.3 and (time - _coolDown > 4) and _dog distance _target > 10 ) then {" \n " _dog playActionNow ""GestureSniff"";" \n " _coolDown = time;" \n "};"/*%FSM*/; @@ -737,8 +707,7 @@ class FSM class Checking { name = "Checking"; - init = /*%FSM*/"_dog removeAction _actionTrack;" \n - "_lastPos = position _dog;" \n + init = /*%FSM*/"_lastPos = position _dog;" \n "" \n "_list = (position _dog) nearEntities [""Animal"",(_senseSkill * 3)];" \n "_list = _list - [_dog];" \n @@ -754,26 +723,26 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; class Links { - /*%FSM*/ - class no_target - { - priority = 4.000000; - to="Reset_1"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class no_target + { + priority = 4.000000; + to="Waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class has_target { @@ -781,101 +750,7 @@ class FSM to="Tracking"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; - action=/*%FSM*/"_lastPos = position _dog;" \n - "" \n - "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];"/*%FSM*/; - }; - /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Reset_1 - { - name = "Reset_1"; - init = /*%FSM*/"_actionTrack = _dog addAction [""Track"",_actionDir + ""track.sqf"",_handle, 4, true, true];" \n - "" \n - "player removeAction _actionCall;" \n - "_dog removeAction _actionFollow;" \n - ""/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { - /*%FSM*/ - class true - { - priority = 0.000000; - to="Waiting"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"true"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Chasing - { - name = "Chasing"; - init = /*%FSM*/"_pos = position _target;" \n - "if(_lastPos distance _pos > 1 or _forceChange) then {" \n - " _lastPos = _pos;" \n - " _dog doMove _pos;" \n - " _dog forceSpeed (_speedVal select _maxSpeed);" \n - " _forceChange = false;" \n - "};" \n - "_waitTime = time;"/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { - /*%FSM*/ - class no_target - { - priority = 4.000000; - to="Reset_1"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"isNull _target and ((time - _waitTime) > 2)"/*%FSM*/; - action=/*%FSM*/"_command = ""none"";"/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class dead - { - priority = 3.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class commanded - { - priority = 0.000000; - to="Reset_1"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command != ""track"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""return"") then {" \n - " if ((player distance _dog > 5) and (_watchDog)) then {" \n - " _dog playActionNow ""GestureBark"";" \n - " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n - " };" \n - "};"/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class reorientate - { - priority = 0.000000; - to="Chasing"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"((time - _waitTime) > 1)"/*%FSM*/; - action=/*%FSM*/"if (_watchDog) then {" \n - " _dog playActionNow ""GestureBark"";" \n - " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n - "};"/*%FSM*/; + action=/*%FSM*/"_lastPos = position _dog;"/*%FSM*/; }; /*%FSM*/ }; @@ -885,18 +760,7 @@ class FSM class action_init { name = "action_init"; - init = /*%FSM*/"_actionFood = _dog addAction [""Feed"",_actionDir + ""feed.sqf"",[_handle,0], 1, false, false,"""",""'FoodSteakRaw' in magazines player;""];" \n - "_actionWater = _dog addAction [""Water"",_actionDir + ""feed.sqf"",[_handle,1], 1, false, false,"""",""'ItemWaterbottle' in magazines player;""];" \n - "_actionStay = _dog addAction [""Stay"",_actionDir + ""stay.sqf"",_handle, 5, true, true];" \n - "_actionTrack = _dog addAction [""Track"",_actionDir + ""track.sqf"",_handle, 4, true, true];" \n - "_actionBark = _dog addAction [""Speak"",_actionDir + ""speak.sqf"",_handle, 3, false, false];" \n - "_actionWarn = _dog addAction [""Alert"",_actionDir + ""warn.sqf"",[_handle,true], 2, false, true];" \n - "" \n - "_actionMove = player addAction [""Move To"", _actionDir + ""move.sqf"", _handle, 0, false, false];" \n - "_actionSpeedStealth = player addAction [""Walk"", _actionDir + ""speed.sqf"",[_handle,true,true], 0, false, false, """", ""_maxSpeed == 1;""];" \n - "_actionSpeedFree = player addAction [""Run"", _actionDir + ""speed.sqf"",[_handle,true,false], 0, false, false, """", ""_maxSpeed == 0;""];" \n - "" \n - "_heartbeat = [_dog,_handle] spawn {" \n + init = /*%FSM*/"_heartbeat = [_dog,_handle] spawn {" \n " disableSerialization;" \n "" \n " _dog = _this select 0;" \n @@ -937,7 +801,7 @@ class FSM " if (_foodVal <= 0 || _thirstVal <= 0) then {" \n " _cantSee = [player, _dog] call dayz_losCheck;" \n " while {alive _dog && !(_cantSee)} do {" \n - " _dog doMove [0, ((random (10000)) + 1000), 0];" \n + " _dog moveTo [0, ((random (10000)) + 1000), 0];" \n " sleep 2;" \n " _cantSee = [player, _dog] call dayz_losCheck;" \n " };" \n @@ -950,8 +814,7 @@ class FSM " };" \n "};" \n "" \n - "_script = [_dog,1,2,[_handle,true]] execVM (_actionDir + ""warn.sqf"");" \n - ""/*%FSM*/; + "_script = [_dog,1,2,[_handle,true]] execVM (_actionDir + ""warn.sqf"");"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -972,7 +835,8 @@ class FSM class Get_Position { name = "Get_Position"; - init = /*%FSM*/"_movePos = screenToWorld [0.5, 0.5];"/*%FSM*/; + init = /*%FSM*/"_pos = screenToWorld [0.5, 0.5];" \n + ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -980,7 +844,7 @@ class FSM class no_position { priority = 0.000000; - to="Nothing"; + to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(count _movePos <= 0)" \n ""/*%FSM*/; @@ -993,10 +857,9 @@ class FSM priority = 0.000000; to="Moving_1"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(count _movePos > 0)" \n + condition=/*%FSM*/"(count _pos > 0)" \n ""/*%FSM*/; - action=/*%FSM*/"_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];"/*%FSM*/; + action=/*%FSM*/"_lostTime = time;"/*%FSM*/; }; /*%FSM*/ }; @@ -1006,39 +869,66 @@ class FSM class Moving_1 { name = "Moving_1"; - init = /*%FSM*/"_dog doMove _movePos;" \n + init = /*%FSM*/"_dog moveTo _pos;" \n "_dog forceSpeed (_speedVal select _maxSpeed);" \n "_forceChange = false;" \n "" \n - "_waitTime = time;"/*%FSM*/; + "_waitTime = time;" \n + "" \n + "diag_log ""DEBUG: MOVING"";"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { /*%FSM*/ class dead { - priority = 3.000000; + priority = 9.000000; to="End"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class has_target + { + priority = 2.000000; + to="chase"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(isNull _attackTarget)"/*%FSM*/; + action=/*%FSM*/"_command = ""none"";" \n + "if (!moveToCompleted _dog) then {" \n + " _dog moveTo (position _dog);" \n + "};" \n + "diag_log ""DEBUG: HAS TARGET"";"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class find_target + { + priority = 1.000000; + to="Moving_1"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_dog distance _pos < 100 && (time - _waitTime) > 0.5"/*%FSM*/; + action=/*%FSM*/"_attackTarget = _dog call dog_findTargetAgent;"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class lost { priority = 0.000000; - to="Wander"; + to="Moving_1"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"(((time - _waitTime) > 60)&& (player distance _dog > 100))"/*%FSM*/; - action=/*%FSM*/"_pos = position _dog;"/*%FSM*/; + condition=/*%FSM*/"((time - _lostTime) > 60 && _waitTime > 1) || (_lostTarget && _waitTime > 1)"/*%FSM*/; + action=/*%FSM*/"_dog playActionNow ""GestureSniff"";" \n + "_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ class commanded { priority = 0.000000; - to="Nothing"; + to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""none"""/*%FSM*/; action=/*%FSM*/"if (_command == ""return"") then {" \n @@ -1046,80 +936,7 @@ class FSM " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n " };" \n - "};" \n - "" \n - "player removeAction _actionCall;" \n - "_dog removeAction _actionFollow;"/*%FSM*/; - }; - /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Nothing - { - name = "Nothing"; - init = /*%FSM*/""/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { - /*%FSM*/ - class true - { - priority = 0.000000; - to="Waiting"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"true"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - }; - }; - /*%FSM*/ - /*%FSM*/ - class Wander - { - name = "Wander"; - init = /*%FSM*/"_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n - "_dog moveTo _pos;"/*%FSM*/; - precondition = /*%FSM*/""/*%FSM*/; - class Links - { - /*%FSM*/ - class dead - { - priority = 3.000000; - to="End"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class In_Position - { - priority = 1.000000; - to="Wander"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_dog distance _pos < 3"/*%FSM*/; - action=/*%FSM*/""/*%FSM*/; - }; - /*%FSM*/ - /*%FSM*/ - class call_back - { - priority = 0.000000; - to="Nothing"; - precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"_command == ""return"""/*%FSM*/; - action=/*%FSM*/"if ((player distance _dog > 5) and (_watchDog)) then {" \n - " _dog playActionNow ""GestureBark"";" \n - " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n - "};" \n - "" \n - "player removeAction _actionCall;" \n - "_dog removeAction _actionFollow;" \n - ""/*%FSM*/; + "};"/*%FSM*/; }; /*%FSM*/ }; @@ -1130,17 +947,6 @@ class FSM { name = "in_vehicle"; init = /*%FSM*/"terminate _heartbeat;" \n - "" \n - "_dog removeAction _actionWarn;" \n - "_dog removeAction _actionStay;" \n - "_dog removeAction _actionTrack;" \n - "_dog removeAction _actionBark;" \n - "_dog removeAction _actionFood;" \n - "_dog removeAction _actionWater;" \n - "" \n - "player removeAction _actionMove;" \n - "player removeAction _actionSpeedStealth;" \n - "player removeAction _actionSpeedFree;" \n "" \n "deleteVehicle _dog;" \n "" \n @@ -1156,8 +962,9 @@ class FSM precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"(vehicle _character == _character)"/*%FSM*/; action=/*%FSM*/"if (isNull _dog) then {" \n - " _dog = (group player) createUnit [ _type, player modelToWorld [-1,1,0], [], 0, ""FORM""];" \n - " _dog disableAI ""FSM"";" \n + " _dog = createAgent [_type, _Pos, [], 0, ""NONE""];" \n + " _pos = [(getPos player),1,3,4,0,5,0] call BIS_fnc_findSafePos;" \n + " _dog setpos _pos;" \n "} ;" \n "" \n "diag_log ""DOG RECREATED"";"/*%FSM*/; @@ -1171,7 +978,7 @@ class FSM { name = "move_to_vehicle"; init = /*%FSM*/"_playerloc = getPos (vehicle player);" \n - "_dog doMove _playerloc;" \n + "_dog moveTo _playerloc;" \n "" \n "diag_log ""DOG MOVING TO VEHICLE"";" \n "_waitTime = time;"/*%FSM*/; @@ -1185,10 +992,7 @@ class FSM to="Wait"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_dog distance (vehicle player) > 300"/*%FSM*/; - action=/*%FSM*/"_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n - "" \n - "diag_log ""VEHICLE TOO FAR"";"/*%FSM*/; + action=/*%FSM*/"diag_log ""VEHICLE TOO FAR"";"/*%FSM*/; }; /*%FSM*/ /*%FSM*/ @@ -1240,10 +1044,7 @@ class FSM to="Waiting"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command == ""return"""/*%FSM*/; - action=/*%FSM*/"_dog removeAction _actionFollow;" \n - "player removeAction _actionCall;" \n - "" \n - "if ((player distance _dog > 5) and (_watchDog)) then {" \n + action=/*%FSM*/"if ((player distance _dog > 5) and (_watchDog)) then {" \n " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n "};"/*%FSM*/; @@ -1252,6 +1053,99 @@ class FSM }; }; /*%FSM*/ + /*%FSM*/ + class chase + { + name = "chase"; + init = /*%FSM*/"_attackTarget = _dog call dog_findTargetAgent;" \n + "" \n + "if (!(isNull _attackTarget)) then { " \n + " _pos = getPosATL _attackTarget;" \n + " _dog moveTo _pos;" \n + " _dog forceSpeed (_speedVal select _maxSpeed);" \n + "};" \n + "" \n + " _waitTime = time;" \n + "" \n + "diag_log ""DEBUG: CHASE"";"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class dead + { + priority = 9.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class target_lost + { + priority = 0.000000; + to="Moving_1"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(isNull _attackTarget)"/*%FSM*/; + action=/*%FSM*/"_lostTarget = true;" \n + "diag_log ""DEBUG: TARGET LOST"";"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class target_dead + { + priority = 0.000000; + to="Moving_1"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _attackTarget)"/*%FSM*/; + action=/*%FSM*/"_attackTarget = objNull;" \n + "_lostTarget = true;" \n + "diag_log ""DEBUG: TARGET DEAD"";"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class commanded + { + priority = 0.000000; + to="Waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command != ""none"""/*%FSM*/; + action=/*%FSM*/"_attackTarget = objNull;" \n + "_dog setVariable [""state"", ""passive"", true];" \n + "" \n + "if (_command == ""return"") then {" \n + " if ((player distance _dog > 5) and (_watchDog)) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + " };" \n + "};"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class reorientate + { + priority = 0.000000; + to="chase"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"((time - _waitTime) > 1)"/*%FSM*/; + action=/*%FSM*/"diag_log ""DEBUG: REORIENTATING"";"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class ____FAKE____ + { + name = "____FAKE____"; + init = /*%FSM*/""/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + }; + }; + /*%FSM*/ }; initState="init"; finalStates[] = diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index 26a389ad3..e9d02f236 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -1,4 +1,4 @@ -/*%FSM*/ +/*%FSM*/ /*%FSM*/ /* item0[] = {"init",0,250,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"init"}; @@ -114,7 +114,7 @@ link56[] = {49,50}; link57[] = {50,49}; link58[] = {51,52}; link59[] = {52,29}; -globals[] = {25.000000,1,0,0,0,640,480,1,81,6316128,1,-536.745972,551.148315,1344.204346,288.206512,955,927,1}; +globals[] = {25.000000,1,0,0,0,640,480,1,81,6316128,1,-561.815979,576.218079,1245.283447,529.096497,955,601,1}; window[] = {2,-1,-1,-32000,-32000,802,22,993,22,3,972}; *//*%FSM*/ class FSM @@ -280,10 +280,10 @@ class FSM " _temp = round(player getVariable [""temperature"",100]);" \n " _currentState = [_currentWpn,_currentAnim,_temp];" \n " " \n - " dayzCharDisco = [dayz_characterID,_playerPos,[weapons player,_magazineArray],[typeOf (unitbackpack player),getWeaponCargo (unitbackpack player),getMagazineCargo (unitbackpack player)],_medical,_currentState,_currentModel];" \n + " //dayzCharDisco = [dayz_characterID,_playerPos,[weapons player,_magazineArray],[typeOf (unitbackpack player),getWeaponCargo (unitbackpack player),getMagazineCargo (unitbackpack player)],_medical,_currentState,_currentModel];" \n " //diag_log str(dayzCharDisco); " \n "" \n - " publicVariableServer ""dayzCharDisco"";" \n + " //publicVariableServer ""dayzCharDisco"";" \n " // remove isServer from player space" \n " dayz_lastSave = time;" \n " dayz_Magazines = [];" \n @@ -423,27 +423,9 @@ class FSM "dayzLogin = [_playerUID,player];" \n "dayzPlayerLogin = [];" \n "publicVariableServer ""dayzLogin"";" \n - "penaltyTimeout = true;" \n - "" \n - "[] spawn {" \n - " private[""_doLoop""];" \n - " _doLoop = 0;" \n - " sleep 1;" \n - "" \n - " while { penaltyTimeout && _doLoop < 60 } do {" \n - "// diag_log ""DEBUG: penalty timeout running.""; " \n - " _doLoop=_doLoop + 1;" \n - "// TODO: localize this msg " \n - " dayz_loadScreenMsg = format[""Combatmode timeout: %1"",_doLoop]; " \n - " progressLoadingScreen (_doLoop/60);" \n - " sleep 1;" \n - " };" \n - " dayz_loadScreenMsg = "" ""; " \n - "};" \n - "" \n - "" \n - "// remove isServer from player space" \n - ""/*%FSM*/; + "if (isServer) then {" \n + " dayzLogin call server_playerLogin;" \n + "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -1107,17 +1089,25 @@ class FSM " _runOnce = false;" \n " while {true} do {" \n "" \n - " ods(""dayz_lootCheck"");" \n - "" \n - " call player_spawnCheck; " \n + "//loot" \n + " call player_spawnLootCheck;" \n + "//zeds" \n + " call player_spawnZedCheck; " \n "" \n " call stream_locationCheck;" \n - " sleep 10;" \n + " sleep 2;" \n " };" \n "};" \n "// TODO: questionably" \n "{ _x call fnc_vehicleEventHandler; } forEach vehicles;" \n - "{ nul = [_x,2,0,false,false] spawn BIS_Effects_Burn; } forEach allMissionObjects ""UH1Wreck_DZ"";" \n + "" \n + "private[""_fadeFire""];" \n + "{" \n + " _fadeFire = _x getVariable['fadeFire', true];" \n + " if (!_fadeFire) then {" \n + " nul = [_x,2,0,false,false] spawn BIS_Effects_Burn;" \n + " };" \n + "} forEach allMissionObjects ""SpawnableWreck"";" \n ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links diff --git a/dayz_equip/config.cpp b/dayz_equip/config.cpp index 837d914eb..d14752cae 100644 --- a/dayz_equip/config.cpp +++ b/dayz_equip/config.cpp @@ -1034,9 +1034,61 @@ class CfgMagazines class Skin_Rocket_DZ: SkinBase { scope = 2; - displayName = "Rocket Suit"; - descriptionShort = "Rocket Suit"; + displayName = "Officer Suit"; + descriptionShort = "Officer Suit"; }; + class Skin_RU_Policeman_DZ: SkinBase + { + scope = 2; + displayName = "Police Officer Uniform"; + descriptionShort = "Police Officer Uniform; + }; + class Skin_Pilot_EP1_DZ: SkinBase + { + scope = 2; + displayName = "Pilot Uniform"; + descriptionShort = "Pilot Uniform; + }; + class Skin_Haris_Press_EP1_DZ: SkinBase + { + scope = 2; + displayName = "Press Uniform"; + descriptionShort = "Press Uniform; + }; + class Skin_Ins_Soldier_GL_DZ: SkinBase + { + scope = 2; + displayName = "Terrorist Uniform"; + descriptionShort = "Terrorist Uniform; + }; + class Skin_GUE_Commander_DZ: SkinBase + { + scope = 2; + displayName = "Rebel Uniform"; + descriptionShort = "Rebel Uniform; + }; + class Skin_Functionary1_EP1_DZ: SkinBase + { + scope = 2; + displayName = "Business Suit"; + descriptionShort = "Rebel Uniform; + }; + class Skin_Priest_DZ: SkinBase + { + scope = 2; + displayName = "Priest Outfit"; + descriptionShort = "Rebel Uniform; + }; + class Skin_Rocker2_DZ: SkinBase + { + scope = 2; + displayName = "Rocker Outfit"; + descriptionShort = "Rebel Uniform; + }; + + + + class Skin_Camo1_DZ: SkinBase { scope = 2; diff --git a/dayz_server/compile/server_onPlayerDisconnect.sqf b/dayz_server/compile/server_onPlayerDisconnect.sqf index 885db807f..22c677c66 100644 --- a/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -30,10 +30,6 @@ if (!isNull _object) then { (nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]); if (alive _object) then { [_object,[],true] call server_playerSync; - if ((_timeout - time) > 0) then { - // spawn bot, if player in combat mode - [_object,_playerID,_characterID,30] spawn disco_playerMorph; - }; _id = [_playerID,_characterID,2] spawn dayz_recordLogin; _myGroup = group _object; deleteVehicle _object; diff --git a/dayz_server/compile/server_playerLogin.sqf b/dayz_server/compile/server_playerLogin.sqf index 2a6a77143..49b7e3cd0 100644 --- a/dayz_server/compile/server_playerLogin.sqf +++ b/dayz_server/compile/server_playerLogin.sqf @@ -36,12 +36,6 @@ if (_playerID == "") then { if ((_playerID == "") or (isNil "_playerID")) exitWith { diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID"); }; -// spawn a waituntil if bot still on server, then run server_playerLogin later again -_botActive = _playerID in botPlayers; -if (_botActive) then { _this spawn server_waitForBotFinished;}; -if (_botActive) exitWith{}; -penaltyTimeout = false; -(owner _playerObj) publicVariableClient "penaltyTimeout"; //??? endLoadingScreen; diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName); @@ -86,7 +80,7 @@ if (!_isNew) then { _model = _primary select 7; _hiveVer = _primary select 8; - if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Rocket_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ"])) then { + if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Rocket_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ","Rocker2_DZ","Priest_DZ","Functionary1_EP1_DZ","GUE_Commander_DZ","Ins_Soldier_GL_DZ","Haris_Press_EP1_DZ","Pilot_EP1_DZ","RU_Policeman_DZ"])) then { _model = "Survivor2_DZ"; }; diff --git a/dayz_server/compile/server_spawnCrashSite.sqf b/dayz_server/compile/server_spawnCrashSite.sqf new file mode 100644 index 000000000..98d0648ae --- /dev/null +++ b/dayz_server/compile/server_spawnCrashSite.sqf @@ -0,0 +1,117 @@ +private["_position","_num","_config","_itemType","_itemChance","_weights","_index","_iArray","_crashModel","_lootTable","_guaranteedLoot","_randomizedLoot","_frequency","_variance","_spawnChance","_spawnMarker","_spawnRadius","_spawnFire","_permanentFire","_crashName"]; + +waitUntil{!isNil "BIS_fnc_selectRandom"}; + +_crashModel = _this select 0; +_lootTable = _this select 1; +_guaranteedLoot = _this select 2; +_randomizedLoot = _this select 3; +_frequency = _this select 4; +_variance = _this select 5; +_spawnChance = _this select 6; +_spawnMarker = _this select 7; +_spawnRadius = _this select 8; +_spawnFire = _this select 9; +_fadeFire = _this select 10; + +_crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName"); + +diag_log(format["CRASHSPAWNER: Starting spawn logic for '%1' with loot table '%2'", _crashName, _lootTable]); + +while {true} do { + private["_timeAdjust","_timeToSpawn","_spawnRoll","_crash","_hasAdjustment","_newHeight","_adjustedPos"]; + // Allows the variance to act as +/- from the spawn frequency timer + _timeAdjust = round(random(_variance * 2) - _variance); + _timeToSpawn = time + _frequency + _timeAdjust; + + diag_log(format["CRASHSPAWNER: %1%2 chance to spawn '%3' with loot table '%4' at %5", round(_spawnChance * 100), '%', _crashName, _lootTable, _timeToSpawn]); + + // Apprehensive about using one giant long sleep here given server time variances over the life of the server daemon + while {time < _timeToSpawn} do { + sleep 5; + }; + + _spawnRoll = random 1; + + // Percentage roll + if (_spawnRoll <= _spawnChance) then { + + _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos; + + diag_log(format["CRASHSPAWNER: Spawning '%1' with loot table '%2' NOW! (%3) at: %4", _crashName, _lootTable, time, str(_position)]); + + _crash = createVehicle [_crashModel,_position, [], 0, "CAN_COLLIDE"]; + + // Randomize the direction the wreck is facing + _crash setDir round(random 360); + + // Using "custom" wrecks (using the destruction model of a vehicle vs. a prepared wreck model) will result + // in the model spawning halfway in the ground. To combat this, an OPTIONAL configuration can be tied to + // the CfgVehicles class you've created for the custom wreck to define how high above the ground it should + // spawn. This is optional. + _config = configFile >> "CfgVehicles" >> _crashModel >> "heightAdjustment"; + _hasAdjustment = isNumber(_config); + _newHeight = 0; + if (_hasAdjustment) then { + _newHeight = getNumber(_config); + //diag_log(format["DIAG: ADJUSTMENT FOUND FOR %1, IT IS: %2", _crashName, _newHeight]); + }; + + // Must setPos after a setDir otherwise the wreck won't level itself with the terrain + _adjustedPos = [(_position select 0), (_position select 1), _newHeight]; + //diag_log(format["DIAG: Designated Position: %1", str(_adjustedPos)]); + _crash setPos _adjustedPos; + + // I don't think this is needed (you can't get "in" a crash), but it was in the original DayZ Crash logic + dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_crash]; + + _crash setVariable ["ObjectID",1,true]; + + if (_spawnFire) then { + dayzFire = [_crash,2,time,false,_fadeFire]; + publicVariable "dayzFire"; + nul=dayzFire spawn BIS_Effects_Burn; + _crash setvariable ["fadeFire",_fadeFire,true]; + }; + + _num = round(random _randomizedLoot) + _guaranteedLoot; + _config = configFile >> "CfgBuildingLoot" >> _lootTable; + _itemType = [] + getArray (_config >> "itemType"); + _itemChance = [] + getArray (_config >> "itemChance"); + + waituntil {!isnil "fnc_buildWeightedArray"}; + + for "_x" from 1 to _num do { + private["_totalItems","_randomNum"]; + + // _weights is rebuilt every itteration of this loop since there's some weird bug that causes _weights + // to lose data each itteration of the 'for' loop despite no manipulation of it. That's why the original wreck + // code had the condition "if (count _itemType > _index) then {" since sometimes _index would be larger than + // the data left in the array. So, yes, this is not performant -- but this code is called so infrequently + // that this seems to be more tolerable than the prior way which meant some loot simply wouldn't spawn in for the wreck. + _weights = []; + _weights = [_itemType,_itemChance] call fnc_buildWeightedArray; + _totalItems = (count _weights) - 1; + _randomNum = round(random _totalItems); + _index = _weights select _randomNum; + //diag_log(format["DIAG: Total Items: %1 | Random Num: %2 | Index: %3 | Selection: %4 | Weights: %5", _totalItems, _randomNum, _index, str(_itemType select _index), count _weights]); + + _iArray = (_itemType select _index); + _iArray set [2,_position]; + _iArray set [3,5]; // Spawn radius: May need to expose this as configurable or use sizeOf(_crashModel) here. Some wreck models have GIANT sizeOf though and may scatter loot too far + //diag_log(format["DIAG: _iArray => %1 <=", str(_iArray)]); + _iArray call spawn_loot; + + diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2': %3 (%4)", _crashName, _lootTable, _iArray select 0, _iArray select 1]); + + // ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items. + _nearby = _position nearObjects ["ReammoBox", sizeOf(_crashModel)]; + { + _x setVariable ["permaLoot",true]; + } forEach _nearBy; + }; + + } else { + diag_log(format["CRASHSPAWNER: Roll chance to spawn '%1' with loot table '%2' failed", _crashName, _lootTable]); + }; +}; \ No newline at end of file diff --git a/dayz_server/compile/server_tradeObject.sqf b/dayz_server/compile/server_tradeObject.sqf new file mode 100644 index 000000000..7276885f6 --- /dev/null +++ b/dayz_server/compile/server_tradeObject.sqf @@ -0,0 +1,26 @@ +private["_character","_traderid","_buyorsell","_data","_result","_oid","_key","_outcome"]; + +_character = _this select 0; +_traderid = _this select 1; +_buyorsell = _this select 2; + +diag_log format["DEBUG PVEH: %1", _character]; + +_clientID = owner _character; +diag_log ("TRADE: Trade Request by ClientID: "+ str(_clientID)); + +_oid = "ERROR"; + +//Send request +_key = format["CHILD:398:%1:%2:",_traderid,_buyorsell]; +diag_log ("TRADE: WRITE: "+ str(_key)); + +_data = "HiveEXT" callExtension _key; +_result = call compile format ["%1",_data]; + +diag_log ("TRADE: RES: "+ str(_result)); + +_outcome = _result select 0; + +dayzTradeResult = _outcome; +_clientID publicVariableClient "dayzTradeResult"; \ No newline at end of file diff --git a/dayz_server/compile/server_traders.sqf b/dayz_server/compile/server_traders.sqf index dc0a100a1..12a13450a 100644 --- a/dayz_server/compile/server_traders.sqf +++ b/dayz_server/compile/server_traders.sqf @@ -26,9 +26,8 @@ if (_status == "ObjectStreamStart") then { _data = "HiveEXT" callExtension _key; _result = call compile format ["%1",_data]; _status = _result select 0; - if (_status == "TRD") then { - _retrader set [count _retrader,_result]; - }; + _retrader set [count _retrader,_result]; + //diag_log ("HIVE: Loop "); }; //diag_log ("HIVE: Streamed " + str(_val) + " objects"); diff --git a/dayz_server/init/server_functions.sqf b/dayz_server/init/server_functions.sqf index c9ff4c5e6..e19a67341 100644 --- a/dayz_server/init/server_functions.sqf +++ b/dayz_server/init/server_functions.sqf @@ -15,23 +15,16 @@ server_updateObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\ server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf"; server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf"; server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; // Custom to add vehicles -server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf"; + +server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf"; + +server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf"; local_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_publishObj.sqf"; //Creates the object in DB local_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_deleteObj.sqf"; //Creates the object in DB local_createObj = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_createObj.sqf"; //Creates the object in DB server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf"; zombie_findOwner = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\zombie_findOwner.sqf"; -//server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf"; -disco_playerMorph = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\disco_playerMorph.sqf"; -disco_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\disco_damageHandler.sqf"; -disco_playerDeath = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\disco_playerDeath.sqf"; - -server_waitForBotFinished = { - private ["_playerId"]; - _playerID = _this select 0; - waituntil{sleep 1; !(_playerID in botPlayers)}; - _this call server_playerLogin; -}; +server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf"; vehicle_handleInteract = { private["_object"]; @@ -141,54 +134,36 @@ if(isnil "HeliCrashArea") then { spawn_heliCrash = { - private["_position","_veh","_num","_config","_itemType","_itemChance","_weights","_index","_iArray"]; + private["_position","_veh","_config","_itemType","_itemTypes","_weights","_cntWeights","_index","_num","_i"]; - waitUntil{!isNil "BIS_fnc_selectRandom"}; - if (isDedicated) then { _position = [getMarkerPos "center",0,HeliCrashArea,10,0,2000,0] call BIS_fnc_findSafePos; _veh = createVehicle ["UH1Wreck_DZ",_position, [], 0, "CAN_COLLIDE"]; dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_veh]; _veh setVariable ["ObjectID",1,true]; dayzFire = [_veh,2,time,false,false]; publicVariable "dayzFire"; - if (isServer) then { - nul=dayzFire spawn BIS_Effects_Burn; - }; - _num = round(random 4) + 3; + _config = configFile >> "CfgBuildingLoot" >> "HeliCrash"; - _itemType = [] + getArray (_config >> "itemType"); - //diag_log ("DW_DEBUG: _itemType: " + str(_itemType)); - _itemChance = [] + getArray (_config >> "itemChance"); - //diag_log ("DW_DEBUG: _itemChance: " + str(_itemChance)); - //diag_log ("DW_DEBUG: (isnil fnc_buildWeightedArray): " + str(isnil "fnc_buildWeightedArray")); - - waituntil {!isnil "fnc_buildWeightedArray"}; - - _weights = []; - _weights = [_itemType,_itemChance] call fnc_buildWeightedArray; - //diag_log ("DW_DEBUG: _weights: " + str(_weights)); - for "_x" from 1 to _num do { + _itemTypes = [] + getArray (_config >> "itemType"); + _index = dayz_CBLCounts find (count _itemTypes); + _weights = dayz_CBLChances select _index; + _cntWeights = count _weights; + _num = round(random 4) + 3; + for "_i" from 1 to _num do { //create loot - _index = _weights call BIS_fnc_selectRandom; - sleep 1; - if (count _itemType > _index) then { - //diag_log ("DW_DEBUG: " + str(count (_itemType)) + " select " + str(_index)); - _iArray = _itemType select _index; - _iArray set [2,_position]; - _iArray set [3,5]; - _iArray call spawn_loot; - _nearby = _position nearObjects ["WeaponHolder",20]; - { - _x setVariable ["permaLoot",true]; - } forEach _nearBy; - }; - }; + _index = floor(random _cntWeights); + _index = _weights select _index; + _itemType = _itemTypes select _index; + [_itemType select 0, _itemType select 1, _position, 5] call spawn_loot; + _nearby = _position nearObjects ["WeaponHolder", 5]; + { + _x setVariable ["permaLoot",true]; + } forEach _nearBy; }; }; - // Get all buildings and roads only once MarkerPosition = getMarkerPos "center"; RoadList = MarkerPosition nearRoads DynamicVehicleArea; @@ -282,10 +257,6 @@ spawn_vehicles = { clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; - _veh setVehicleInit "this lock true; this lockCargo true;"; - processInitCommands; - - [_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh; }; }; diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index 81dd07c98..43f7c6f16 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -232,12 +232,15 @@ for "_x" from 1 to MaxDynamicDebris do { }; //Spawn crashed helos -for "_x" from 1 to MaxHeliCrashes do { - _id = [] spawn spawn_heliCrash; +//for "_x" from 1 to MaxHeliCrashes do { + //_id = [] spawn spawn_heliCrash; //waitUntil{scriptDone _id}; -}; +//}; // Allow connection after road debris spawns allowConnection = true; + +// [_crashModel, _lootTable, _guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire] +nul = ['UH1Wreck_DZ', 'HeliCrash', 3, 4, (50 * 60), (15 * 60), 0.75, 'center', 4000, true, false] call server_spawnCrashSite; \ No newline at end of file