mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
1.7.5.D1208
This commit is contained in:
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
22
dayz_code/compile/dog_findTargetAgent.sqf
Normal file
22
dayz_code/compile/dog_findTargetAgent.sqf
Normal 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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
|
||||
- Function
|
||||
- [] call fnc_usec_selfActions;
|
||||
************************************************************/
|
||||
private["_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_Unlock","_lock","_allFixed","_hitpoints","_damage","_part","_cmpt","_color","_string","_handle","_trader_id","_category","_buy","_sell","_buy2","_sell2","_buy3","_sell3","_buy1","_sell1","_buy4","_sell4","_buy5","_sell5","_zparts1","_zparts2","_zparts3","_zparts4","_zparts5","_zparts6","_zparts7","_metals1","_metals2","_metals4","_metals3"];
|
||||
private["_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_Unlock","_lock","_allFixed","_hitpoints","_damage","_part","_cmpt","_color","_string","_handle","_trader_id","_category","_buy","_buy2","_buy3","_buy1","_buy4","_buy5","_cantrader","_cantrader1","_buy6","_zparts1","_zparts2","_zparts3","_zparts4","_metals1","_metals2","_metals4","_metals3","_metals5","_dogHandle","_lieDown","_warn"];
|
||||
|
||||
_vehicle = vehicle player;
|
||||
_inVehicle = (_vehicle != player);
|
||||
@@ -50,6 +50,7 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
_traderType = typeOf cursorTarget;
|
||||
_ownerID = cursorTarget getVariable ["characterID","0"];
|
||||
_isAnimal = cursorTarget isKindOf "Animal";
|
||||
_isDog = (cursorTarget isKindOf "DZ_Pastor" || cursorTarget isKindOf "DZ_Fin");
|
||||
_isZombie = cursorTarget isKindOf "zZombie_base";
|
||||
_isDestructable = cursorTarget isKindOf "BuiltItems";
|
||||
_isTent = cursorTarget isKindOf "TentStorage";
|
||||
@@ -300,8 +301,8 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [_trader_id, _category, ];
|
||||
_cantrader = player addAction ["Trade 3 Empty Soda Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","ItemSodaEmpty",1,3,"buy","Empty Soda","Bio Meat"], 99, true, true, "",""];
|
||||
_cantrader1 = player addAction ["Trade 3 Empty Tin Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","TrashTinCan",1,3,"buy","Empty Tin Can","Bio Meat"], 99, true, true, "",""];
|
||||
_cantrader = player addAction ["Trade 3 Empty Soda Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","ItemSodaEmpty",1,3,"buy","Empty Soda Cans","Copper Bar"], 99, true, true, "",""];
|
||||
_cantrader1 = player addAction ["Trade 3 Empty Tin Cans for 1 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","TrashTinCan",1,3,"buy","Empty Tin Cans","Copper Bar"], 99, true, true, "",""];
|
||||
|
||||
_buy = player addAction ["Food and Drinks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[51,"Food and Drinks"], 99, true, false, "",""];
|
||||
_buy2 = player addAction ["Backpacks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[52,"Backpacks"], 97, true, false, "",""];
|
||||
@@ -346,18 +347,38 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
|
||||
};
|
||||
|
||||
|
||||
//boat_trader_1
|
||||
if (_isMan and _traderType == boat_trader) then {
|
||||
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [_trader_id, _category, ];
|
||||
_buy = player addAction ["Boats Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[49,"Boats Unarmed"], 97, true, false, "",""];
|
||||
_buy1 = player addAction ["Boats Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[499,"Boats Armed"], 96, true, false, "",""];
|
||||
|
||||
s_player_parts set [count s_player_parts,_buy];
|
||||
s_player_parts set [count s_player_parts,_buy1];
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
//auto_trader_1
|
||||
if (_isMan and _traderType == auto_trader) then {
|
||||
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [_trader_id, _category, ];
|
||||
_buy = player addAction ["Car", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[41,"Car"], 99, true, false, "",""];
|
||||
_buy1 = player addAction ["Truck", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[42,"Truck"], 97, true, false, "",""];
|
||||
_buy5 = player addAction ["Utility", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[46,"Utility"], 95, true, false, "",""];
|
||||
_buy2 = player addAction ["Offroad", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[43,"Offroad"], 93, true, false, "",""];
|
||||
_buy3 = player addAction ["Helicopter", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[44,"Helicopter"], 91, true, false, "",""];
|
||||
_buy4 = player addAction ["Military", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[45,"Military"], 89, true, false, "",""];
|
||||
_buy = player addAction ["Cars", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[41,"Cars"], 99, true, false, "",""];
|
||||
_buy1 = player addAction ["Trucks Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[42,"Truck Unarmed"], 97, true, false, "",""];
|
||||
_buy2 = player addAction ["SUV", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[466,"SUV"], 95, true, false, "",""];
|
||||
_buy3 = player addAction ["Buses and Vans", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[467,"Buses and Vans"], 95, true, false, "",""];
|
||||
_buy4 = player addAction ["Offroad", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[43,"Offroad"], 93, true, false, "",""];
|
||||
_buy5 = player addAction ["Helicopter Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[44,"Helicopter"], 91, true, false, "",""];
|
||||
_buy6 = player addAction ["Military Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[45,"Military Unarmed"], 89, true, false, "",""];
|
||||
|
||||
s_player_parts set [count s_player_parts,_buy];
|
||||
s_player_parts set [count s_player_parts,_buy1];
|
||||
@@ -365,19 +386,49 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
s_player_parts set [count s_player_parts,_buy3];
|
||||
s_player_parts set [count s_player_parts,_buy4];
|
||||
s_player_parts set [count s_player_parts,_buy5];
|
||||
s_player_parts set [count s_player_parts,_buy6];
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
//auto_trader_2
|
||||
if (_isMan and _traderType == auto_trader_2) then {
|
||||
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [_trader_id, _category, ];
|
||||
_buy = player addAction ["Muscle Cars", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[411,"Muscle Cars"], 99, true, false, "",""];
|
||||
_buy1 = player addAction ["Trucks Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[422,"Truck Armed"], 97, true, false, "",""];
|
||||
_buy2 = player addAction ["Utility", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[46,"Utility"], 95, true, false, "",""];
|
||||
_buy3 = player addAction ["Helicopter Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[444,"Helicopter"], 91, true, false, "",""];
|
||||
_buy4 = player addAction ["Military Armed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[455,"Military Armed"], 89, true, false, "",""];
|
||||
_buy5 = player addAction ["Fuel Trucks", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[47,"Fuel Trucks"], 88, true, false, "",""];
|
||||
_buy6 = player addAction ["Heavy Armor Unarmed", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[48,"Heavy Armor Unarmed"], 88, true, false, "",""];
|
||||
|
||||
|
||||
s_player_parts set [count s_player_parts,_buy];
|
||||
s_player_parts set [count s_player_parts,_buy1];
|
||||
s_player_parts set [count s_player_parts,_buy2];
|
||||
s_player_parts set [count s_player_parts,_buy3];
|
||||
s_player_parts set [count s_player_parts,_buy4];
|
||||
s_player_parts set [count s_player_parts,_buy5];
|
||||
s_player_parts set [count s_player_parts,_buy6];
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// mad_sci
|
||||
if (_isMan and _traderType == mad_sci) then {
|
||||
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [part_out, part_in, qty_out, qty_in,];
|
||||
_zparts1 = player addAction ["Trade Zombie Parts for Bio Meat", "\z\addons\dayz_code\actions\trade_items.sqf",["FoodBioMeat","ItemZombieParts",1,1,"buy","Zombie Parts","Bio Meat"], 99, true, true, "",""];
|
||||
_zparts1 = player addAction ["Trade Zombie Parts for Bio Meat", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["FoodBioMeat","ItemZombieParts",1,1,"buy","Zombie Parts","Bio Meat"], 99, true, true, "",""];
|
||||
_zparts2 = player addAction ["Medical Supplies", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[31,"Medical Supplies"], 97, true, false, "",""];
|
||||
_zparts3 = player addAction ["Chem-lites/Flares", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[32,"Chem-lites/Flares"], 95, true, false, "",""];
|
||||
_zparts4 = player addAction ["Smoke Grenades", "\z\addons\dayz_code\actions\buy_or_sell.sqf",[33,"Smoke Grenades"], 93, true, false, "",""];
|
||||
@@ -397,11 +448,11 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
if (s_player_parts_crtl < 0) then {
|
||||
|
||||
// [part_out, part_in, qty_out, qty_in,];
|
||||
_metals1 = player addAction ["Trade 6 Copper for 1 Silver", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemSilverBar","ItemCopperBar",1,6,"buy","Copper","Silver"], 99, true, true, "",""];
|
||||
_metals2 = player addAction ["Trade 1 Silver for 6 Copper", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemCopperBar","ItemSilverBar",6,1,"buy","Silver","Copper"], 98, true, true, "",""];
|
||||
_metals4 = player addAction ["Trade 6 Silver for 1 Gold", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemGoldBar","ItemSilverBar",1,6,"buy","Silver","Gold"], 97, true, true, "",""];
|
||||
_metals3 = player addAction ["Trade 1 Gold for 6 Silver", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemSilverBar","ItemGoldBar",6,1,"buy","Gold","Silver"], 97, true, true, "",""];
|
||||
_metals5 = player addAction ["Buy Vault for 12 Gold", "\z\addons\dayz_code\actions\trade_items.sqf",["ItemVault","ItemGoldBar",1,12,"buy","Gold","Vault"], 96, true, true, "",""];
|
||||
_metals1 = player addAction ["Trade 6 Copper for 1 Silver", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemSilverBar","ItemCopperBar",1,6,"buy","Copper","Silver"], 99, true, true, "",""];
|
||||
_metals2 = player addAction ["Trade 1 Silver for 6 Copper", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemCopperBar","ItemSilverBar",6,1,"buy","Silver","Copper"], 98, true, true, "",""];
|
||||
_metals4 = player addAction ["Trade 6 Silver for 1 Gold", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemGoldBar","ItemSilverBar",1,6,"buy","Silver","Gold"], 97, true, true, "",""];
|
||||
_metals3 = player addAction ["Trade 1 Gold for 6 Silver", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemSilverBar","ItemGoldBar",6,1,"buy","Gold","Silver"], 97, true, true, "",""];
|
||||
_metals5 = player addAction ["Buy Vault for 12 Gold", "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",["ItemVault","ItemGoldBar",1,12,"buy","Gold","Vault"], 96, true, true, "",""];
|
||||
|
||||
s_player_parts set [count s_player_parts,_metals1];
|
||||
s_player_parts set [count s_player_parts,_metals2];
|
||||
@@ -422,6 +473,59 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
|
||||
s_player_studybody = -1;
|
||||
};
|
||||
|
||||
//Dog
|
||||
if (_isDog and _isAlive and _hasRawMeat and _canDo and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
|
||||
if (s_player_tamedog < 0) then {
|
||||
s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", cursorTarget, 1, false, true, "", ""];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_tamedog;
|
||||
s_player_tamedog = -1;
|
||||
};
|
||||
|
||||
if (_isDog and _ownerID == dayz_characterID and _isAlive and _canDo) then {
|
||||
_dogHandle = player getVariable ["dogID", 0];
|
||||
if (s_player_feeddog < 0 and _hasRawMeat) then {
|
||||
s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
|
||||
};
|
||||
if (s_player_waterdog < 0 and "ItemWaterbottle" in magazines player) then {
|
||||
s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
|
||||
};
|
||||
if (s_player_staydog < 0) then {
|
||||
_lieDown = _dogHandle getFSMVariable "_actionLieDown";
|
||||
if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
|
||||
s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
|
||||
};
|
||||
if (s_player_trackdog < 0) then {
|
||||
s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
|
||||
};
|
||||
if (s_player_barkdog < 0) then {
|
||||
s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", cursorTarget, 3, false, true,"",""];
|
||||
};
|
||||
if (s_player_warndog < 0) then {
|
||||
_warn = _dogHandle getFSMVariable "_watchDog";
|
||||
if (_warn) then { _text = "Quiet"; _warn = false; } else { _text = "Alert"; _warn = true; };
|
||||
s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
|
||||
};
|
||||
if (s_player_followdog < 0) then {
|
||||
s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_feeddog;
|
||||
s_player_feeddog = -1;
|
||||
player removeAction s_player_waterdog;
|
||||
s_player_waterdog = -1;
|
||||
player removeAction s_player_staydog;
|
||||
s_player_staydog = -1;
|
||||
player removeAction s_player_trackdog;
|
||||
s_player_trackdog = -1;
|
||||
player removeAction s_player_barkdog;
|
||||
s_player_barkdog = -1;
|
||||
player removeAction s_player_warndog;
|
||||
s_player_warndog = -1;
|
||||
player removeAction s_player_followdog;
|
||||
s_player_followdog = -1;
|
||||
};
|
||||
} else {
|
||||
//Engineering
|
||||
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_targets"];
|
||||
private["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_targets","_dog"];
|
||||
//Alert Zed's to noise of shot
|
||||
_unit = _this select 0;
|
||||
_distance = _this select 1;
|
||||
@@ -19,4 +19,17 @@ _listTalk = _pos nearEntities ["zZombie_Base",_distance];
|
||||
} else {
|
||||
_zombie setVariable ["myDest",_pos,true];
|
||||
};
|
||||
} forEach _listTalk;
|
||||
_listTalk = _pos nearEntities [["DZ_Fin, DZ_Pastor"], _distance * 3];
|
||||
|
||||
{
|
||||
_dog = _x;
|
||||
//Ensure dog is tamed AND is not players own dog
|
||||
if (_doRun && (_dog getVariable ["characterID", 0]) != 0) then {
|
||||
_targets = _dog getVariable ["targets",[]];
|
||||
if (!(_unit in _targets)) then {
|
||||
_targets set [count _targets,_unit];
|
||||
_dog setVariable ["targets",_targets,true];
|
||||
};
|
||||
}
|
||||
} forEach _listTalk;
|
||||
@@ -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];
|
||||
};
|
||||
*/
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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];
|
||||
|
||||
40
dayz_code/compile/player_spawnlootCheck.sqf
Normal file
40
dayz_code/compile/player_spawnlootCheck.sqf
Normal 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;
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
36
dayz_code/compile/tame_dog.sqf
Normal file
36
dayz_code/compile/tame_dog.sqf
Normal 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];
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user