1.7.5.D1202

This commit is contained in:
A Clark
2012-12-07 20:29:23 -06:00
parent 73f951f1cf
commit 5521090b9e
74 changed files with 1258 additions and 576 deletions

View File

@@ -1,21 +1,15 @@
private["_serial","_positions","_lootGroup","_iArray","_iItem","_iClass","_iPos","_item","_mags","_qty","_max","_tQty","_canType","_obj","_type","_nearBy","_allItems","_items","_itemType","_itemChance","_lootChance","_weights","_index"];
private["_obj","_type","_config","_positions","_lootChance","_itemType","_itemChance","_iPos2","_rnd","_nearBy","_weights","_index","_iArray","_item"];
_obj = _this select 0;
_fastRun = _this select 1;
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
_positions = [] + getArray (_config >> "lootPos");
//diag_log ("LOOTSPAWN: READ:" + str(_type));
_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;
@@ -38,13 +32,10 @@ _itemChance = [] + getArray (_config >> "itemChance");
_iArray set [3,0];
_iArray call spawn_loot;
_iArray = [];
diag_log ("LOOTSPAWN");
//diag_log ("LOOTSPAWN");
};
_item setVariable ["created",(DateToNumber date),true];
};
if (!_fastRun) then {
sleep 0.1;
};
};
};
} forEach _positions;

View File

@@ -1,27 +1,21 @@
private["_serial","_positions","_min","_lootGroup","_iArray","_iItem","_iClass","_iPos","_item","_mags","_qty","_max","_tQty","_canType","_obj","_type","_nearBy","_clean","_unitTypes","_max","_isNoone","_config","_num","_originalPos","_zombieChance","_rnd","_fastRun"];
private["_obj","_type","_config","_canLoot","_originalPos","_unitTypes","_min","_max","_num","_clean","_positions","_zombieChance","_rnd","_iPos","_nearBy","_nearByPlayer"];
_obj = _this select 0;
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canLoot = isClass (_config);
_fastRun = _this select 1;
_originalPos = getPosATL _obj;
if (_canLoot) then {
//Get zombie class
_unitTypes = getArray (_config >> "zombieClass");
_min = getNumber (_config >> "maxRoaming");
_max = getNumber (_config >> "minRoaming");
//Walking Zombies
_num = round(random _max) max _min; // + round(_max / 3);
//diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
for "_i" from 1 to _num do
{
[_originalPos,true,_unitTypes] call zombie_generate;
if (!_fastRun) then {
sleep 0.1;
};
};
//Add Internal Zombies
_clean = {alive _x} count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
if (_clean) then {
@@ -39,9 +33,6 @@ if (_canLoot) then {
[_iPos,false,_unitTypes] call zombie_generate;
};
};
if (!_fastRun) then {
sleep 0.1;
};
} forEach _positions;
};
dayz_buildingMonitor set [count dayz_buildingMonitor,_obj];

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_damageHandler.sqf";
- Function
- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
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"];
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"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
@@ -47,9 +47,6 @@ if (_unit == player) then {
if (_hit == "") then {
if ((_source != player) and _isPlayer) then {
//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 {
@@ -108,11 +105,12 @@ if (_hit in USEC_MinorWounds) then {
};
};
/*
if (_unit == player) then {
player sideChat str(_damage);
//incombat
_unit setVariable["startcombattimer", 1, false];
};
*/
if (_damage > 0.1) then {
if (_unit == player) then {
//shake the cam, frighten them!
@@ -131,7 +129,7 @@ if (_damage > 0.4) then { //0.25
_isHit = _unit getVariable[_wound,false];
if (_unit == player) then {
_rndPain = (random 10);
_rndInfection = (random 1000);
_rndInfection = (random 500);
_hitPain = (_rndPain < _damage);
if ((_isHeadHit) or (_damage > 1.2 and _hitPain)) then {
_hitPain = true;

View File

@@ -1,59 +1,22 @@
/*
File: inString.sqf
Author: Mika Hannola
private["_findarray","_stringarray","_findcount","_stringcount","_found","_y","_i","_x"];
Description:
Find a string within a string.
Parameter(s):
_this select 0: BOOL - when true, displays all units, otherwise just player positions
_this select 0: <string> string to be found
_this select 1: <string> string to search from
_this select 2 (Optional): search is case sensitive (default: false)
Returns:
Boolean (true when string is found).
How to use:
BIS_fnc_inString = compile preprocessFile "inString.sqf"; //Compile the function
_found = ["string","String",true] call BIS_fnc_inString; //Find a string within a string
*/
private ["_casesensitive","_find","_string","_findarray","_stringarray","_findcount","_stringcount","_found","_match","_y","_i","_x"];
_find = _this select 0;
_string = _this select 1;
//modification : default _casesensitive is false
_casesensitive = false;
if(count(_this) > 2) then {_casesensitive = _this select 2;};
_findarray = toArray _find;
_stringarray = toArray _string;
_findarray = toArray (_this select 0);
_stringarray = toArray (_this select 1);
_findcount = count _findarray;
_stringcount = count _stringarray;
_found = false;
scopeName "main";
if (_findcount <= _stringcount and !_found) then
{
for "_y" from 0 to (_stringcount - _findcount) do
{
_match = [];
for "_i" from 0 to (_findcount - 1) do
{
_match set [count _match,_stringarray select (_y + _i)];
};
_found = true;
if (_findcount <= _stringcount) then {
for "_y" from 0 to (_stringcount - _findcount) do {
_i = 0;
{
if (_x != _match select _i) then
{
_found = false;
};
scopeName "loop1";
if (_x == (_stringarray select (_y + _i))) then {
_i = _i + 1;
} else {breakOut "loop1";};
} forEach _findarray;
if (_found) then {breakTo "main";};
if (_i == _findcount) then {_found = true; breakTo "main";};
};
};
_found;
_found

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
private["_menClose","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_vehicle","_inVehicle","_color","_part","_traderType"];
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"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
@@ -45,6 +45,7 @@ if (_canPickLight and !dayz_hasLight) then {
if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) then { //Has some kind of target
_isHarvested = cursorTarget getVariable["meatHarvested",false];
_isVehicle = cursorTarget isKindOf "AllVehicles";
_isVehicletype = typeOf cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
_isMan = cursorTarget isKindOf "Man";
_traderType = typeOf cursorTarget;
_ownerID = cursorTarget getVariable ["characterID","0"];
@@ -54,6 +55,7 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
_isTent = cursorTarget isKindOf "TentStorage";
_isFuel = false;
_isAlive = alive cursorTarget;
_canmove = canmove cursorTarget;
_text = getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName");
if (_hasFuelE) then {
_isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_fuel_tank_stairs_ep1") or (cursorTarget isKindOf "Land_wagon_tanker") or (cursorTarget isKindOf "Land_fuelstation") or (cursorTarget isKindOf "Land_fuelstation_army");
@@ -101,6 +103,15 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_forceSave = -1;
};
*/
//flip vehicle
if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2)) then {
if (s_player_flipveh < 0) then {
s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_flipveh;
s_player_flipveh = -1;
};
//Allow player to fill jerrycan
if(_hasFuelE and _isFuel and _canDo) then {
@@ -144,14 +155,6 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_fireout = -1;
};
//place tent
//if(_hasTent and _canDo) then {
// s_player_placetent = player addAction [localize "Place Tent", "\z\addons\dayz_code\actions\tent_pitch.sqf",cursorTarget, 0, false, true, "", ""];
//} else {
// player removeAction s_player_placetent;
// s_player_placetent = -1;
//};
//Packing my tent
if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
if ((s_player_packtent < 0) and (player distance cursorTarget < 3)) then {
@@ -411,11 +414,60 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
if (s_player_parts_crtl < 0) then {
// [_trader_id, _category, ];
_buy = player addAction ["Buy Vehicle", "\z\addons\dayz_code\actions\buy_db.sqf",[41], 99, true, false, "",""];
_sell = player addAction ["Sell Vehicle", "\z\addons\dayz_code\actions\sell_db.sqf",[41], 98, true, false, "",""];
_buy = player addAction ["Buy Car", "\z\addons\dayz_code\actions\buy_db.sqf",[41], 99, true, false, "",""];
_sell = player addAction ["Sell Car", "\z\addons\dayz_code\actions\sell_db.sqf",[41], 98, true, false, "",""];
_buy1 = player addAction ["Buy Truck", "\z\addons\dayz_code\actions\buy_db.sqf",[42], 99, true, false, "",""];
_sell1 = player addAction ["Sell Truck", "\z\addons\dayz_code\actions\sell_db.sqf",[42], 98, true, false, "",""];
_buy2 = player addAction ["Buy Offroad", "\z\addons\dayz_code\actions\buy_db.sqf",[43], 99, true, false, "",""];
_sell2 = player addAction ["Sell Offroad", "\z\addons\dayz_code\actions\sell_db.sqf",[43], 98, true, false, "",""];
_buy2 = player addAction ["Buy Helicopter", "\z\addons\dayz_code\actions\buy_db.sqf",[44], 99, true, false, "",""];
_sell2 = player addAction ["Sell Helicopter", "\z\addons\dayz_code\actions\sell_db.sqf",[44], 98, true, false, "",""];
_buy2 = player addAction ["Buy Helicopter", "\z\addons\dayz_code\actions\buy_db.sqf",[44], 99, true, false, "",""];
_sell2 = player addAction ["Sell Helicopter", "\z\addons\dayz_code\actions\sell_db.sqf",[44], 98, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];
s_player_parts set [count s_player_parts,_sell];
s_player_parts set [count s_player_parts,_buy1];
s_player_parts set [count s_player_parts,_sell1];
s_player_parts set [count s_player_parts,_buy2];
s_player_parts set [count s_player_parts,_sell2];
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 ["Buy Car", "\z\addons\dayz_code\actions\buy_db.sqf",[41], 99, true, false, "",""];
_sell = player addAction ["Sell Car", "\z\addons\dayz_code\actions\sell_db.sqf",[41], 98, true, false, "",""];
_buy1 = player addAction ["Buy Truck", "\z\addons\dayz_code\actions\buy_db.sqf",[42], 99, true, false, "",""];
_sell1 = player addAction ["Sell Truck", "\z\addons\dayz_code\actions\sell_db.sqf",[42], 98, true, false, "",""];
_buy2 = player addAction ["Buy Offroad", "\z\addons\dayz_code\actions\buy_db.sqf",[43], 99, true, false, "",""];
_sell2 = player addAction ["Sell Offroad", "\z\addons\dayz_code\actions\sell_db.sqf",[43], 98, true, false, "",""];
_buy2 = player addAction ["Buy Helicopter", "\z\addons\dayz_code\actions\buy_db.sqf",[44], 99, true, false, "",""];
_sell2 = player addAction ["Sell Helicopter", "\z\addons\dayz_code\actions\sell_db.sqf",[44], 98, true, false, "",""];
_buy2 = player addAction ["Buy Helicopter", "\z\addons\dayz_code\actions\buy_db.sqf",[45], 99, true, false, "",""];
_sell2 = player addAction ["Sell Helicopter", "\z\addons\dayz_code\actions\sell_db.sqf",[45], 98, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];
s_player_parts set [count s_player_parts,_sell];
s_player_parts set [count s_player_parts,_buy1];
s_player_parts set [count s_player_parts,_sell1];
s_player_parts set [count s_player_parts,_buy2];
s_player_parts set [count s_player_parts,_sell2];
s_player_parts_crtl = 1;
};

View File

@@ -19,7 +19,7 @@ Missing:
*/
private ["_looptime","_sun_factor","_building_factor","_vehicle_factor","_fire_factor","_water_factor","_rain_factor","_night_factor","_wind_factor","_difference","_hasfireffect","_isinbuilding","_isinvehicle","_raining","_sunrise","_building"];
private["_looptime","_vehicle_factor","_moving_factor","_fire_factor","_rain_factor","_night_factor","_wind_factor","_building_factor","_sun_factor","_water_factor","_difference","_hasfireffect","_isinbuilding","_isinvehicle","_raining","_sunrise","_vel","_speed","_fireplaces","_building","_daytime","_height_mod","_temp"];
_looptime = _this;
@@ -56,7 +56,7 @@ Missing:
private["_vel","_speed"];
_vel = velocity player;
_speed = round((_vel distance [0,0,0]) * 3.5);
_difference = (_moving_factor * (_speed / 20)) min 1;
_difference = (_moving_factor * (_speed / 20)) min 7;
};
//fire
@@ -124,21 +124,31 @@ Missing:
//rain
if(_raining && !_isinvehicle && !_isinbuilding) then {
_difference = _difference + _rain_factor;
_difference = _difference + (rain * _rain_factor);
};
//night
private ["_daytime"];
if((daytime < _sunrise || daytime < (24 - _sunrise)) && !_isinvehicle && !_isinbuilding) then {
if((daytime < _sunrise || daytime > (24 - _sunrise)) && !_isinvehicle) then {
_daytime = if(daytime < 12) then {daytime + 24} else {daytime};
if(_isinbuilding) then {
_difference = _difference + ((((_night_factor * -1) / (_sunrise^2)) * ((_daytime - 24)^2) + _night_factor)) / 2;
} else {
_difference = _difference + (((_night_factor * -1) / (_sunrise^2)) * ((_daytime - 24)^2) + _night_factor);
};
};
//wind
if(((wind select 0) > 4 || (wind select 1) > 4) && !_isinvehicle && !_isinbuilding ) then {
_difference = _difference + _wind_factor;
};
//height
if (!_isinvehicle && overcast >= 0.6) then {
_height_mod = ((getPosASL player select 2) / 100) / 2;
_difference = _difference - _height_mod;
};
//Calculate Change Value Basic Factor Looptime Correction Adjust Value to current used temperatur scala
_difference = _difference * SleepTemperatur / (60 / _looptime) * ((dayz_temperaturmax - dayz_temperaturmin) / 100);

View File

@@ -1,6 +1,6 @@
private["_unit","_distance","_i","_listTalk","_zombie","_targets","_pos"];
private["_unit","_distance","_doRun","_pos","_listTalk","_zombie","_targets"];
//Alert Zed's to noise of shot
_pos = _this select 0;
_unit = _this select 0;
_distance = _this select 1;
_doRun = _this select 2;
_pos = _this select 3;

View File

@@ -1,5 +1,5 @@
private["_list","_Pos","_randrefpoint","_PosList","_PosSelect","_Pos","_list","_animalssupported","_type","_root","_favouritezones","_GroupMarker","_agent","_id","_tame"];
private["_list","_animalssupported","_type","_root","_favouritezones","_randrefpoint","_PosList","_PosSelect","_Pos","_GroupMarker","_agent","_id","_pos","_tame"];
_list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance];
if (count _list < dayz_maxAnimals) then {

View File

@@ -1,4 +1,4 @@
private["_vel","_speed","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_isDay","_nearFlare","_nearFire","_nearLight","_scaler","_pos"];
private["_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;

View File

@@ -1,4 +1,4 @@
private["_unit","_ammo","_audible","_distance","_listTalk","_weapon"];
private["_unit","_weapon","_ammo","_projectile","_audible","_caliber","_distance","_i","_listTalk","_group","_targets","_id"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_unit = _this select 0;
_weapon = _this select 1;
@@ -12,10 +12,9 @@ _distance = round(_audible * 10 * _caliber);
dayz_disAudial = _distance;
dayz_firedCooldown = time;
// Put everyone in range of the bullet into combat
//_id = _this spawn player_projectileNear;
// Color in the combat icon
dayz_combat = 1;
if (_ammo isKindOf "Melee") exitWith {
_unit playActionNow "GestureSwing";
};
@@ -41,7 +40,6 @@ if (_ammo isKindOf "SmokeShell") then {
} forEach _listTalk;
} else {
_id = [_unit,_distance,true,(getPosATL player)] spawn player_alertZombies;
//Check if need to place arrow
if (_ammo isKindOf "Bolt") then {
_id = _this spawn player_crossbowBolt;

View File

@@ -1,12 +1,10 @@
private ["_objects"];
private["_objects","_dialog","_magazineArray","_control","_i","_item","_val","_max"];
_objects = nearestObjects [getPosATL player, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage","VaultStorage"], 10];
{
dayzUpdateVehicle = [_x,"all"];
publicVariableServer "dayzUpdateVehicle";
} foreach _objects;
private["_dialog","_magazineArray","_control","_item","_val","_max"];
disableSerialization;
_dialog = _this select 0;
_magazineArray = [];

View File

@@ -1,76 +1,114 @@
_isAir = vehicle player iskindof "Air";
_inVehicle = (vehicle player != player);
_fastRun = _this select 0;
_dateNow = (DateToNumber date);
_maxZombies = dayz_maxLocalZombies;
_age = -1;
if (!_inVehicle) then {
// If they just got out of a vehicle, boost their per-player zombie limit by 5 in hopes of allowing insta-spawn zombies
if (dayz_inVehicle and !_inVehicle) then {
dayz_spawnWait = -300;
//_maxZombies = _maxZombies + 2;
};
dayz_inVehicle = _inVehicle;
//if (((time - dayz_spawnWait) < dayz_spawnDelay) or ((time - dayz_lootWait) < dayz_lootDelay)) exitWith {diag_log("Skipping Check since neither loot or zombies are ready");};
//if (((time - dayz_spawnWait) < dayz_spawnDelay) and ((time - dayz_lootWait) < dayz_lootDelay)) exitWith {};
//diag_log("SPAWN CHECKING: Starting");
_locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
_nearestCity = nearestLocations [getPos player, _locationstypes, 600];
//_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;
//waitUntil{_position nearObjectsReady 200};
_nearby = _position nearObjects ["building",200]; //nearestObjects [player, ["building"], 200];
_tooManyZs = {alive _x} count (_position nearEntities ["zZombie_Base",400]) > dayz_maxLocalZombies;
{
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canLoot = isClass (_config);
if (_canLoot) then {
_dis = _x distance player;
if ((_dis < 120) and (_dis > 30)) then {
_nearbytype = type (_nearestCity select 0);
_nearby = _position nearObjects ["Building",_radius];
switch (_nearbytype) do {
default {
_maxZombies = 20;
};
case "NameLocal": {
_maxZombies = 40;
};
case "NameVillage": {
_maxZombies = 60;
};
case "NameCity": {
_maxZombies = 80;
};
case "NameCityCapital": {
_maxZombies = 100;
};
};
if (_inVehicle) then {
_maxZombies = _maxZombies / 2;
};
_tooManyZs = count (_position nearEntities ["zZombie_Base",60]) > _maxZombies;
//diag_log("Too Many Zeds: " +str(_tooManyZs));
//diag_log(format["SPAWN CHECK: Building count is %1", count _nearby]);
{
//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 {
//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]);
_cleared = (_x getVariable ["cleared",true]);
/*
if(isServer) then {
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
} else {
_dateNow = serverTime;
_age = (_dateNow * 60) - _looted;
};
*/
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
//diag_log ("SPAWN LOOT: " + _type + " Building is " + str(_age) + " old" );
if ((_age > 10) and (!_cleared) and !_inVehicle) then {
_nearByObj = nearestObjects [(getPosATL _x), ["WeaponHolder","WeaponHolderBase"],((sizeOf _type)+5)];
{deleteVehicle _x} forEach _nearByObj;
_x setVariable ["cleared",true,true];
_x setVariable ["looted",_dateNow,true];
};
if ((_age > 10) and (_cleared) and !_inVehicle) then {
if (_age > 8) then {
//diag_log("SPAWN LOOT: Spawning loot");
//Register
_x setVariable ["looted",_dateNow,true];
//cleanup
_handle = [_x,_fastRun] spawn building_spawnLoot;
waitUntil{scriptDone _handle};
//_nearByObj = (getPosATL _x) nearObjects ["ReammoBox",((sizeOf _type)+5)];
//{deleteVehicle _x} forEach _nearByObj;
dayz_lootWait = time;
[_x] call building_spawnLoot;
};
};
if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
if (dayz_spawnZombies < dayz_maxLocalZombies) then {
if (!_tooManyZs) then {
private["_zombied"];
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _zombied) * 525948;
if (_age > 5) then {
_bPos = getPosATL _x;
_zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
if (_zombiesNum == 0) then {
//Randomize Zombies
_x setVariable ["zombieSpawn",_dateNow,true];
_handle = [_x,_fastRun] spawn building_spawnZombies;
waitUntil{scriptDone _handle};
//} else {
//_x setVariable ["zombieSpawn",_dateNow,true];
};
};
if (_canZombie) then {
if (dayz_spawnZombies < _maxZombies) then {
if (!_tooManyZs) then {
private["_zombied"];
_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]);
if (_age > 1) then {
_bPos = getPosATL _x;
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
if (_zombiesNum == 0) then {
//Randomize Zombies
_x setVariable ["zombieSpawn",_dateNow,true];
[_x] call building_spawnZombies;
};
};
} else {
dayz_spawnWait = time;
dayz_spawnZombies = 0;
};
//} else {
//dayz_spawnWait = time;
//dayz_spawnZombies = 0;
};
};
if (!_fastRun) then {
sleep 0.1;
};
} forEach _nearby;
};
} forEach _nearby;

View File

@@ -1,9 +1,9 @@
private["_display","_ctrlBlood","_bloodVal","_ctrlFood","_ctrlThirst","_foodVal","_ctrlTemp","_tempVal","_array"];
private["_foodVal","_thirstVal","_tempVal","_combatVal","_array","_display","_ctrlBlood","_ctrlBleed","_bloodVal","_ctrlFood","_ctrlThirst","_ctrlTemp","_ctrlEar","_ctrlEye","_ctrlHumanity","_ctrlCombat","_ctrlFracture","_bloodLvl","_thirstLvl","_foodLvl","_blood","_thirst","_food","_temp","_tempImg","_tempLvl","_ca","_visualtext","_visual","_audibletext","_audible","_humanity","_guiHumanity","_humanityText"];
disableSerialization;
_foodVal = 1 - (dayz_hunger / SleepFood);
_thirstVal = 1 - (dayz_thirst / SleepWater);
_tempVal = (dayz_temperatur / dayz_temperaturnormal); //TeeChange
_tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
_combatVal = 1 - dayz_combat; // May change later to be a range of red/green to loosely indicate 'time left in combat'
if (uiNamespace getVariable ['DZ_displayUI', 0] == 1) exitWith {
@@ -21,7 +21,7 @@ _ctrlThirst = _display displayCtrl 1302;
_ctrlTemp = _display displayCtrl 1306; //TeeChange
_ctrlEar = _display displayCtrl 1304;
_ctrlEye = _display displayCtrl 1305;
_ctrlHumanity = _display displayCtrl 1207;
//_ctrlHumanity = _display displayCtrl 1207;
_ctrlCombat = _display displayCtrl 1307;
_ctrlFracture = _display displayCtrl 1203;
@@ -29,9 +29,108 @@ _ctrlFracture = _display displayCtrl 1203;
_ctrlBlood ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_bloodVal))),(Dayz_GUI_G * _bloodVal),(Dayz_GUI_B * _bloodVal), 0.5];
_ctrlFood ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_foodVal))),(Dayz_GUI_G * _foodVal),(Dayz_GUI_B * _foodVal), 0.5];
_ctrlThirst ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_thirstVal))),(Dayz_GUI_G * _thirstVal),(Dayz_GUI_B * _thirstVal), 0.5];
_ctrlTemp ctrlSetTextColor [(Dayz_GUI_R + (0.3 * _tempVal)),(Dayz_GUI_G * _tempVal),(Dayz_GUI_B + (0.25 * (1/_tempVal))), 0.5]; //TeeChange Coulor should change into red if value is higher as normale temp and into blue if coulor is lower as normal temp
_ctrlTemp ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_tempVal))), (Dayz_GUI_G * _tempVal), _tempVal, 0.5]; // Color ranges from iceblue (cold) to red (hot)
_ctrlCombat ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_combatVal))),(Dayz_GUI_G * _combatVal),(Dayz_GUI_B * _combatVal), 0.5];
/*
Blood: round((r_player_blood / 2) / 1000) = _bloodLvl (6 = full, 1 = empty)
Thirst: round(_thirstVal / 0.25) = _thirstLvl (4 = full, 0 = empty)
Hunger: round(_foodVal / 0.25) = _foodLvl (4 = full, 0 = empty)
Temp: round(dayz_temperatur) = tempLvl (>= 36 = full <= 28 = empty)
*/
_blood = "";
_thirst = "";
_food = "";
_temp = "";
_tempImg = 0;
_bloodLvl = round((r_player_blood / 2) / 1000);
_thirstLvl = round(_thirstVal / 0.25);
_foodLvl = round(_foodVal / 0.25);
_tempLvl = round(dayz_temperatur);
/*
diag_log format["DEBUG: bloodlvl: %1 r_player_blood: %2 bloodval: %3",_bloodLvl, r_player_blood, _bloodVal];
diag_log format["DEBUG: thirstlvl: %1 dayz_thirst: %2 thirstval: %3",_thirstLvl, dayz_thirst, _thirstVal];
diag_log format["DEBUG: foodlvl: %1 dayz_hunger: %2 foodval: %3",_foodLvl, dayz_hunger, _foodVal];
diag_log format["DEBUG: templvl: %1 dayz_temperatur: %2 tempval: %3",_tempLvl, dayz_temperatur, _tempVal];
*/
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";
};
_thirst = "\z\addons\dayz_code\gui\status_thirst_inside_" + str(_thirstLvl) + "_ca.paa";
_food = "\z\addons\dayz_code\gui\status_food_inside_" + str(_foodLvl) + "_ca.paa";
if ( _tempLvl >= 36 ) then { _tempImg = 4 };
if ( _tempLvl > 33 and _tempLvl < 36 ) then { _tempImg = 3 };
if ( _tempLvl >= 30 and _tempLvl <= 33 ) then { _tempImg = 2 };
if ( _tempLvl > 28 and _tempLvl < 30 ) then { _tempImg = 1 };
if ( _tempLvl <= 28 ) then { _tempImg = 0 };
_temp = "\z\addons\dayz_code\gui\status_temp_" + str(_tempImg) + "_ca.paa";
_ctrlBlood ctrlSetText _blood;
_ctrlThirst ctrlSetText _thirst;
_ctrlFood ctrlSetText _food;
_ctrlTemp ctrlSetText _temp;
/*
Visual:
*/
_visualtext = "";
_visual = round((dayz_disVisual / 100) * 4) min 5;
if (_visual > 0) then {_visualtext = "\z\addons\dayz_code\gui\val_" + str(_visual) + "_ca.paa"};
_ctrlEye ctrlSetText _visualtext;
/*
Audible:
*/
_audibletext = "";
_audible = round((dayz_disAudial / 50) * 4) min 5;
if (_audible > 0) then {_audibletext = "\z\addons\dayz_code\gui\val_" + str(_audible) + "_ca.paa"};
_ctrlEar ctrlSetText _audibletext;
/*
Fracture:
*/
if (!canStand player) then {
if (!(ctrlShown _ctrlFracture)) then {
r_fracture_legs = true;
_ctrlFracture ctrlShow true;
};
};
/*
Flashing:
*/
if (_combatVal == 0) then {
_ctrlCombat call player_guiControlFlash;
};
if (_bloodVal < 0.2) then {
_ctrlBlood call player_guiControlFlash;
};
if (_thirstVal < 0.2) then {
_ctrlThirst call player_guiControlFlash;
};
if (_foodVal < 0.2) then {
_ctrlFood call player_guiControlFlash;
};
if (_tempVal > 0.8) then { //TeeChange
_ctrlTemp call player_guiControlFlash;
};
if (r_player_injured) then {
_ctrlBleed call player_guiControlFlash;
};
/*
_humanity = player getVariable["humanity",0];
_guiHumanity = 0;
@@ -50,47 +149,5 @@ if(_humanity != dayz_lastHumanity) then {
};
*/
_visualtext = "";
_visual = round((dayz_disVisual / 100) * 4) min 5;
if (_visual > 0) then {_visualtext = "\z\addons\dayz_code\gui\val_" + str(_visual) + "_ca.paa"};
_audibletext = "";
_audible = round((dayz_disAudial / 50) * 4) min 5;
if (_audible > 0) then {_audibletext = "\z\addons\dayz_code\gui\val_" + str(_audible) + "_ca.paa"};
_ctrlEye ctrlSetText _visualtext;
_ctrlEar ctrlSetText _audibletext;
if (_combatVal == 0) then {
_ctrlCombat call player_guiControlFlash;
};
if (_bloodVal < 0.2) then {
_ctrlBlood call player_guiControlFlash;
};
if (_thirstVal < 0.2) then {
_ctrlThirst call player_guiControlFlash;
};
if (_foodVal < 0.2) then {
_ctrlFood call player_guiControlFlash;
};
if (_tempVal < 0.833) then { //TeeChange
_ctrlTemp call player_guiControlFlash;
};
if (r_player_injured) then {
_ctrlBleed call player_guiControlFlash;
};
if (!canStand player) then {
if (!(ctrlShown _ctrlFracture)) then {
r_fracture_legs = true;
_ctrlFracture ctrlShow true;
};
};
_array = [_foodVal,_thirstVal];
_array

View File

@@ -1,5 +1,5 @@
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
private["_unit","_magazine","_used","_quantity","_magsNet","_magsWhole","_key","_result","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_dmgDistance","_isBallistic","_handled"];
private["_unit","_firer","_distance","_weapon","_ammo","_killerID","_handled","_arc","_isBallistic","_dmgDistance","_isRocket","_isPlayer","_inVehicle","_evType","_recordable","_turretDir","_weaponDir","_pos1","_pos2","_facing","_firingArc","_isInFront","_isInRear","_id"];
//Init
//[unit, firer, distance, weapon, muzzle, mode, ammo]
_unit = _this select 0;
@@ -20,12 +20,13 @@ private["_unit","_magazine","_used","_quantity","_magsNet","_magsWhole","_key","
_recordable = false;
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
_firer setVariable["startcombattimer", 1, true];
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
_firer setVariable["startcombattimer", 1, false];
if (_distance <= 8) then {
_unit setVariable["startcombattimer", 1, true];
_unit setVariable["startcombattimer", 1, false];
};
if (_inVehicle) exitWith{};
if (_firer == player) exitWith{};

View File

@@ -1,18 +1,20 @@
private["_unit","_targets","_move","_damage","_wound","_sound","_local","_dir","_hpList","_hp","_strH","_dam","_total","_result","_vehicle","_tPos","_zPos","_cantSee","_inAngle"];
private["_unit","_vehicle","_targets","_move","_rnd","_wound","_dir","_hpList","_hp","_damage","_chance","_strH","_dam","_total","_result","_tPos","_zPos","_inAngle","_cantSee","_isZombieInside","_building","_isPlayerInside"];
_unit = _this;
_vehicle = (vehicle player);
_targets = _unit getVariable ["targets",[]];
if (!(_vehicle in _targets) and ((random 1) < 0.9)) exitWith {};
//if (!(_vehicle in _targets)) exitWith {};
//Do the attack
_move = "ZombieStandingAttack1";
_rnd = 0;
_wound = "";
if (r_player_unconscious) then {
if (r_player_unconscious && _vehicle == player) then {
_unit doMove (getPos player);
_rnd = round(random 4) + 1;
_move = "ZombieFeed" + str(_rnd);
} else {
_unit doMove (getPos player);
_rnd = round(random 9) + 1;
_move = "ZombieStandingAttack" + str(_rnd);
};
@@ -27,46 +29,41 @@ if (_vehicle != player) then {
_hpList = _vehicle call vehicle_getHitpoints;
_hp = _hpList call BIS_fnc_selectRandom;
_wound = getText(configFile >> "cfgVehicles" >> (typeOf _vehicle) >> "HitPoints" >> _hp >> "name");
_total = 0;
_damage = random 0.03;
_chance = round(random 12);
if(["Glass",_hp,false] call fnc_inString) then {
_damage = 0.03;
_strH = "hit_" + (_wound);
_dam = _vehicle getVariable [_strH,0];
_total = (_dam + _damage);
};
if(["Wheel",_hp,false] call fnc_inString) then {
_damage = 0.02;
_strH = "hit_" + (_wound);
_dam = _vehicle getVariable [_strH,0];
_total = (_dam + _damage);
};
if(["Body",_hp,false] call fnc_inString) then {
_damage = 0.01;
_strH = "hit_" + (_wound);
_dam = _vehicle getVariable [_strH,0];
_total = (_dam + _damage);
};
if(["Engine",_hp,false] call fnc_inString) then {
_damage = 0.01;
_strH = "hit_" + (_wound);
_dam = _vehicle getVariable [_strH,0];
_total = (_dam + _damage);
};
if(["Fuel",_hp,false] call fnc_inString) then {
if ((_wound == "Glass1") or (_wound == "Glass2") or (_wound == "Glass3") or (_wound == "Glass4") or (_wound == "Glass5") or (_wound == "Glass6")) then {
[_unit,"hit",0,false] call dayz_zombieSpeak;
_damage = 0.01;
_strH = "hit_" + (_wound);
_dam = _vehicle getVariable [_strH,0];
_total = (_dam + _damage);
//diag_log ("Hitpoints " +str(_wound) +str(_total));
//_result = [_vehicle, _wound,_total, _unit,"zombie"] call fnc_usec_damageVehicle;
//dayzHitV = [_vehicle,_wound,_total, _unit,"zombie"];
//publicVariable "dayzHitV";
if (_total >= 1) then {
if ((_chance % 4) == 0) then {
if ((_vehicle isKindOf "ATV_Base_EP1") or (_vehicle isKindOf "Motorcycle")) then { player action ["eject", _vehicle] };
};
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;
} else {
_result = [_vehicle, _wound,_total, _unit,"zombie"] call fnc_usec_damageVehicle;
dayzHitV = [_vehicle,_wound,_total, _unit,"zombie"];
publicVariable "dayzHitV";
};
};
if(_total > 0) then {
[_unit,"hit",0,false] call dayz_zombieSpeak;
_result = [_vehicle, _wound,_total, _unit,"zombie"] call fnc_usec_damageVehicle;
dayzHitV = [_vehicle,_wound,_total, _unit,"zombie"];
publicVariable "dayzHitV";
};
} else {
//Did he hit?
if ((_unit distance player) <= 3) then {
@@ -87,8 +84,8 @@ if (_vehicle != player) then {
_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";
//dayzHit = [player,_wound, _damage, _unit,"zombie"];
//publicVariable "dayzHit";
[_unit,"hit",0,false] call dayz_zombieSpeak;
} else {
/*
@@ -97,8 +94,8 @@ if (_vehicle != player) then {
_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";
//dayzHit = [player,_wound, _damage, _unit,"zombie"];
//publicVariable "dayzHit";
[_unit,"hit",0,false] call dayz_zombieSpeak;
};
*/

View File

@@ -1,6 +1,7 @@
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"];
private["_refObj","_listTalk","_pHeight","_attacked","_list","_dist","_group","_chance","_last","_entHeight","_delta","_isZInside","_building","_isPlayerInside","_targets","_cantSee","_tPos","_zPos","_eyeDir","_inAngle","_lowBlood"];
_refObj = vehicle player;
_listTalk = (position _refObj) nearEntities ["zZombie_Base",200];
//_listTalk = (position _refObj) nearEntities ["zZombie_Base",200];
_listTalk = (position _refObj) nearEntities ["zZombie_Base",100];
_pHeight = (getPosATL _refObj) select 2;
_attacked = false;

View File

@@ -1,4 +1,4 @@
private["_itemType","_iPos","_indexLootSpawn","_iArray","_iItem","_iClass","_item","_qty","_max","_tQty","_arrayLootSpawn","_canType"];
private["_itemType","_weights","_iItem","_iClass","_iPos","_radius","_item","_arrayLootSpawn","_qty","_max","_tQty","_indexLootSpawn","_canType","_mags","_ipos"];
// [_itemType,_weights]
_iItem = _this select 0;
_iClass = _this select 1;
@@ -12,7 +12,7 @@ switch (_iClass) do {
_itemType = _arrayLootSpawn select 0;
_weights = _arrayLootSpawn call fnc_buildWeightedArray;
_qty = 0;
_max = ceil(random 4) + 1;
_max = ceil(random 2) + 1;
//diag_log ("LOOTSPAWN: QTY: " + str(_max) + " ARRAY: " + str(_arrayLootSpawn));
while {_qty < _max} do {
private["_tQty","_indexLootSpawn","_canType"];
@@ -36,7 +36,7 @@ switch (_iClass) do {
_item addWeaponCargoGlobal [_iItem,1];
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
if (count _mags > 0) then {
_item addMagazineCargoGlobal [(_mags select 0),(round(random 3))];
_item addMagazineCargoGlobal [(_mags select 0),(round(random 1))];
};
};
case "magazine": {

View File

@@ -1,10 +1,10 @@
private["_group","_target","_targetMen","_targetDis","_c","_man","_manDis","_targets","_lead","_leadheight","_nearEnts","_rnd","_assigned"];
private["_group","_target","_lead","_targetMen","_targetDis","_range","_assigned","_targets","_obj","_dis","_fires","_rnd","_man","_manDis","_c"];
_group = _this;
_target = objNull;
_lead = leader _group;
_targetMen = [];
_targetDis = [];
_range = 500;
_range = 300;
_assigned = _group getVariable ["targets",[]];
{

View File

@@ -1,4 +1,4 @@
private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_myDest","_newDest","_lootType"];
private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_isAlive","_myDest","_newDest","_rnd","_lootType","_id"];
_position = _this select 0;
_doLoiter = _this select 1;
_unitTypes = _this select 2;
@@ -57,7 +57,8 @@ if (!_doLoiter) then {
if (_nearByPlayer) then {
_attempt = 0;
while {_nearByPlayer} do {
_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos;
//_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;
_agent setPos _position;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
_attempt = _attempt + 1;