1.7.5.D1208

This commit is contained in:
A Clark
2012-12-15 08:37:22 -06:00
parent 8842939a7b
commit f378947145
56 changed files with 2061 additions and 1157 deletions

View File

@@ -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"];
};

View File

@@ -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];

View File

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

View File

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

View File

@@ -1,5 +1,4 @@
_array = _this select 3;
_handle = _array;
private ["_handle"];
_handle = _this select 3;
_handle setFSMVariable ["_command","move"];

View File

@@ -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;
};
*/

View File

@@ -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];
_handle setFSMVariable ["_maxSpeed", _speed];
_dog setVariable ["currentSpeed", _speed];

View File

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

View File

@@ -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];

View File

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

View File

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

View File

@@ -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];

View File

@@ -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];

View File

@@ -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"];
};

View File

@@ -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;
};
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
s_player_parts_crtl = -1;
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,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;

View File

@@ -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];
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
s_player_parts_crtl = -1;
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;
} else {
cutText [format[("Error insufficient quality %1"),_textPartIn] , "PLAIN DOWN"];
};
dayzTradeResult = nil;
} else {
_needed = _qty_in - _qty;

View File

@@ -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;
};
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
// server_tradeObject [_activatingPlayer,_traderID,_bos]
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
publicVariableServer "dayzTradeObject";
if (isServer) then {
dayzTradeObject call server_tradeObject;
};
// [player,"repair",0,false] call dayz_zombieSpeak;
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 {
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;
} else {
_needed = _qty_in - _qty;

View File

@@ -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"];
};

View File

@@ -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;
};
// server_tradeObject [_activatingPlayer,_traderID,_bos]
dayzTradeObject = [_activatingPlayer,_traderID,_bos];
publicVariableServer "dayzTradeObject";
if (isServer) then {
dayzTradeObject call server_tradeObject;
};
for "_x" from 1 to _qty_out do {
if(_buy_o_sell == "buy") then {
player addWeapon _part_out;
} else {
player addMagazine _part_out;
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"];
};
// [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;
dayzTradeResult = nil;
} else {
_needed = _qty_in - _qty;

View File

@@ -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";

View File

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

View File

@@ -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 {

View File

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

View File

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

View File

@@ -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 {

View File

@@ -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,6 +386,36 @@ 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;
};
@@ -377,7 +428,7 @@ 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,];
_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 = [];

View File

@@ -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;
@@ -20,3 +20,16 @@ _listTalk = _pos nearEntities ["zZombie_Base",_distance];
_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;

View File

@@ -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;
};
//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];
};
*/

View File

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

View File

@@ -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];

View File

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

View File

@@ -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";

View File

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

View File

@@ -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

View File

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

View File

@@ -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];

View File

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

View File

@@ -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,

View File

@@ -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"];

View File

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

View File

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

View File

@@ -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

View File

@@ -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 {

View File

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

View File

@@ -645,5 +645,77 @@
<German>Bandit</German>
<Russian>Бандит</Russian>
</Key>
<Key ID="str_actions_tamedog">
<Original>Tame Dog</Original>
<English>Tame Dog</English>
<German>zahmen Hund</German>
<Russian>Приручить собаку</Russian>
</Key>
<Key ID="str_actions_movedog">
<Original>Move To</Original>
<English>Move To</English>
<German></German>
<Russian>Иди туда</Russian>
</Key>
<Key ID="str_actions_speeddog">
<Original>Dog: %1</Original>
<English>Dog: %1</English>
<German></German>
<Russian></Russian>
</Key>
<Key ID="str_actions_calldog">
<Original>Call Dog</Original>
<English>Call Dog</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_feeddog">
<Original>Feed Dog</Original>
<English>Feed Dog</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_waterdog">
<Original>Water Dog</Original>
<English>Water Dog</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_sitdog">
<Original>Dog: Sit</Original>
<English>Dog: Sit</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_liedog">
<Original>Dog: Lie Down</Original>
<English>Dog: Lie Down</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_trackdog">
<Original>Dog: Track</Original>
<English>Dog: Track</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_barkdog">
<Original>Dog: Bark</Original>
<English>Dog: Bark</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_warndog">
<Original>Dog: %1</Original>
<English>Dog: %1</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
<Key ID="str_actions_followdog">
<Original>Dog: Follow</Original>
<English>Dog: Follow</English>
<German></German>
<Russian>Позвать собаку</Russian>
</Key>
</Package>
</Project>

View File

@@ -2,37 +2,33 @@
/*%FSM<HEAD>*/
/*
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</HEAD>*/
class FSM
{
@@ -43,11 +39,12 @@ class FSM
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"_position = _this select 0;" \n
init = /*%FSM<STATEINIT""">*/"_pos = _this select 0;" \n
"_agent = _this select 1;" \n
"" \n
"_pos = _position;" \n
"_isSomeone = true;"/*%FSM</STATEINIT""">*/;
"_isSomeone = true;" \n
"_timeA = time;" \n
"_isTamed = false;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -64,16 +61,55 @@ class FSM
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "wait">*/
class wait
{
name = "wait";
init = /*%FSM<STATEINIT""">*/"_entityTime = time;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "player_check">*/
class player_check
{
priority = 1.000000;
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_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</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_up">*/
class time_up
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeA) > 120 and !_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End">*/
class End
{
name = "End";
init = /*%FSM<STATEINIT""">*/"if (!_isSomeone) then {" \n
" deleteVehicle _agent;" \n
"} else {" \n
" dayz_bodyMonitor set [count dayz_bodyMonitor,_agent];" \n
"};" \n
""/*%FSM</STATEINIT""">*/;
init = /*%FSM<STATEINIT""">*/"if (!_isTamed) then {" \n
" if (!_isSomeone) then {" \n
" deleteVehicle _agent;" \n
" } else {" \n
" dayz_bodyMonitor set [count dayz_bodyMonitor,_agent];" \n
" };" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
@@ -94,65 +130,58 @@ class FSM
/*%FSM<LINK "Not_Alive">*/
class Not_Alive
{
priority = 5.000000;
to="Cleanup";
priority = 4.000000;
to="wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
action=/*%FSM<ACTION""">*/"_timeA = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Nobody_Near">*/
class Nobody_Near
/*%FSM<LINK "tamed">*/
class tamed
{
priority = 4.000000;
to="Cleanup";
priority = 3.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!_isSomeone"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_isTamed"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "In_Position">*/
class In_Position
{
priority = 1.000000;
priority = 2.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"_agent distance _pos < 3"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_pos = [_position,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n
action=/*%FSM<ACTION""">*/"_pos = [_pos,10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n
"_agent moveTo _pos;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "player_check">*/
class player_check
{
priority = 0.000000;
priority = 1.000000;
to="Loiter";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _entityTime) > 30"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_entityTime = time;" \n
"" \n
"_list = (getposATL _agent) nearEntities [[""CAManBase"",""AllVehicles""],300];" \n
"_isSomeone = ({isPlayer _x} count _list) > 0;"/*%FSM</ACTION""">*/;
"_isSomeone = ({isPlayer _x} count _list) > 0;" \n
"" \n
"if (_isSomeone) then {" \n
" _timeA = time;" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Cleanup">*/
class Cleanup
{
name = "Cleanup";
init = /*%FSM<STATEINIT""">*/"_timeA = time;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "time_up">*/
class time_up
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeA) > 120"/*%FSM</CONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(time - _timeA) > 120 and !_isSomeone"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/*%FSM<COMPILE "F:\DayZ\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Player Monitor">*/
/*%FSM<COMPILE "D:\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Player Monitor">*/
/*%FSM<HEAD>*/
/*
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</HEAD>*/
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</STATEINIT""">*/;
"if (isServer) then {" \n
" dayzLogin call server_playerLogin;" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
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</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links

View File

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

View File

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

View File

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

View File

@@ -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]);
};
};

View File

@@ -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";

View File

@@ -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");

View File

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

View File

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