mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Missing Files
This commit is contained in:
170
SQF/dayz_code/Configs/CfgVehicles/Car/CAR_HATCHBACK.hpp
Normal file
170
SQF/dayz_code/Configs/CfgVehicles/Car/CAR_HATCHBACK.hpp
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
class car_hatchback: SkodaBase {
|
||||||
|
armorcrash0[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_01", 0.707946, 1, 200};
|
||||||
|
armorcrash1[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_02", 0.707946, 1, 200};
|
||||||
|
armorcrash2[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_03", 0.707946, 1, 200};
|
||||||
|
armorcrash3[] = {"Ca\sounds\Vehicles\Crash\crash_vehicle_04", 0.707946, 1, 200};
|
||||||
|
brakedistance = 10;
|
||||||
|
buildcrash0[] = {"Ca\sounds\Vehicles\Crash\crash_building_01", 0.707946, 1, 200};
|
||||||
|
buildcrash1[] = {"Ca\sounds\Vehicles\Crash\crash_building_02", 0.707946, 1, 200};
|
||||||
|
buildcrash2[] = {"Ca\sounds\Vehicles\Crash\crash_building_03", 0.707946, 1, 200};
|
||||||
|
buildcrash3[] = {"Ca\sounds\Vehicles\Crash\crash_building_04", 0.707946, 1, 200};
|
||||||
|
cargoaction[] = {"Hatchback_Cargo01"};
|
||||||
|
cargoiscodriver[] = {1, 0};
|
||||||
|
crew = "";
|
||||||
|
displayname = $STR_VEH_NAME_OLD_HATCHBACK;
|
||||||
|
driveraction = "Hatchback_Driver";
|
||||||
|
faction = "CIV";
|
||||||
|
hiddenselections[] = {"Camo1"};
|
||||||
|
hiddenselectionstextures[] = {"\ca\wheeled\data\hatchback_co.paa"};
|
||||||
|
icon = "\Ca\wheeled\data\map_ico\icomap_skoda_CA.paa";
|
||||||
|
mapsize = 6;
|
||||||
|
maxspeed = 125;
|
||||||
|
model = "\ca\Wheeled\car_hatchback";
|
||||||
|
picture = "\Ca\wheeled\data\ico\car_hatchback_CA.paa";
|
||||||
|
rarityurban = 0.6;
|
||||||
|
scope = 2;
|
||||||
|
soundarmorcrash[] = {"ArmorCrash0", 0.25, "ArmorCrash1", 0.25, "ArmorCrash2", 0.25, "ArmorCrash3", 0.25};
|
||||||
|
soundbuildingcrash[] = {"buildCrash0", 0.25, "buildCrash1", 0.25, "buildCrash2", 0.25, "buildCrash3", 0.25};
|
||||||
|
soundengineoffext[] = {"ca\sounds\vehicles\Wheeled\sedan\ext\ext-sedan-stop-1", 0.398107, 1, 250};
|
||||||
|
soundengineoffint[] = {"ca\sounds\vehicles\Wheeled\sedan\int\int-sedan-stop-1", 0.398107, 1};
|
||||||
|
soundengineonext[] = {"ca\sounds\vehicles\Wheeled\sedan\ext\ext-sedan-start-1", 0.398107, 1, 250};
|
||||||
|
soundengineonint[] = {"ca\sounds\vehicles\Wheeled\sedan\int\int-sedan-start-1", 0.398107, 1};
|
||||||
|
soundgear[] = {"", "5.62341e-005", 1};
|
||||||
|
soundgetin[] = {"ca\sounds\vehicles\Wheeled\sedan\ext\ext-sedan-getout-1", 0.316228, 1};
|
||||||
|
soundgetout[] = {"ca\sounds\vehicles\Wheeled\sedan\ext\ext-sedan-getout-1", 0.316228, 1, 30};
|
||||||
|
soundwoodcrash[] = {"woodCrash0", 0.166, "woodCrash1", 0.166, "woodCrash2", 0.166, "woodCrash3", 0.166, "woodCrash4", 0.166, "woodCrash5", 0.166};
|
||||||
|
typicalcargo[] = {};
|
||||||
|
wheelcircumference = 2.148;
|
||||||
|
woodcrash0[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_01", 0.707946, 1, 200};
|
||||||
|
woodcrash1[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_02", 0.707946, 1, 200};
|
||||||
|
woodcrash2[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_03", 0.707946, 1, 200};
|
||||||
|
woodcrash3[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_04", 0.707946, 1, 200};
|
||||||
|
woodcrash4[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_05", 0.707946, 1, 200};
|
||||||
|
woodcrash5[] = {"Ca\sounds\Vehicles\Crash\crash_mix_wood_06", 0.707946, 1, 200};
|
||||||
|
class SoundEvents {
|
||||||
|
class AccelerationIn {
|
||||||
|
expression = "(engineOn*(1-camPos))*gmeterZ";
|
||||||
|
limit = 0.5;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\sedan\int\int-sedan-acce-1", 0.398107, 1};
|
||||||
|
};
|
||||||
|
class AccelerationOut {
|
||||||
|
expression = "(engineOn*camPos)*gmeterZ";
|
||||||
|
limit = 0.5;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\sedan\ext\ext-sedan-acce-1", 0.398107, 1, 250};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class Sounds {
|
||||||
|
class Engine {
|
||||||
|
frequency = "(randomizer*0.05+0.95)*rpm";
|
||||||
|
sound[] = {"\ca\sounds\Vehicles\Wheeled\sedan\ext\ext-sedan-low-1", 0.398107, 0.9, 300};
|
||||||
|
volume = "engineOn*camPos*(rpm factor[0.6, 0.2])";
|
||||||
|
};
|
||||||
|
class EngineHighOut {
|
||||||
|
frequency = "(randomizer*0.05+0.95)*rpm";
|
||||||
|
sound[] = {"\ca\sounds\Vehicles\Wheeled\sedan\ext\ext-sedan-high-1", 0.398107, 0.8, 380};
|
||||||
|
volume = "engineOn*camPos*(rpm factor[0.45, 0.9])";
|
||||||
|
};
|
||||||
|
class IdleOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\sedan\ext\ext-sedan-idle-1", 0.281838, 1, 200};
|
||||||
|
volume = "engineOn*camPos*(rpm factor[0.3, 0])";
|
||||||
|
};
|
||||||
|
class TiresRockOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-rock2", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*rock*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresSandOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-sand2", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*sand*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresGrassOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-grass3", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*grass*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresMudOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-mud2", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*mud*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresGravelOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-gravel2", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*gravel*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresAsphaltOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\ext\ext-tires-asphalt3", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*asphalt*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class NoiseOut {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Noises\ext\int-noise3", 0.316228, 1, 30};
|
||||||
|
volume = "camPos*(damper0 max 0.04)*(speed factor[0, 8])";
|
||||||
|
};
|
||||||
|
class EngineLowIn {
|
||||||
|
frequency = "(randomizer*0.05+0.95)*rpm";
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\sedan\int\int-sedan-low-1", 0.562341, 0.8};
|
||||||
|
volume = "((engineOn*thrust) factor[0.65, 0.2])*(1-camPos)";
|
||||||
|
};
|
||||||
|
class EngineHighIn {
|
||||||
|
frequency = "(randomizer*0.05+0.95)*rpm";
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\sedan\int\int-sedan-high-1", 0.562341, 0.8};
|
||||||
|
volume = "((engineOn*thrust) factor[0.55, 0.95])*(1-camPos)";
|
||||||
|
};
|
||||||
|
class IdleIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\sounds\Vehicles\Wheeled\sedan\int\int-sedan-idle-1", 0.316228, 1};
|
||||||
|
volume = "engineOn*(rpm factor[0.3, 0])*(1-camPos)";
|
||||||
|
};
|
||||||
|
class TiresRockIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-rock2", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*rock*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresSandIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-sand2", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*sand*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresGrassIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-grass3", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*grass*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresMudIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-mud2", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*mud*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresGravelIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-gravel2", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*gravel*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class TiresAsphaltIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\Tires\int\int-tires-asphalt3", 0.177828, 1};
|
||||||
|
volume = "(1-camPos)*asphalt*(speed factor[2, 20])";
|
||||||
|
};
|
||||||
|
class NoiseIn {
|
||||||
|
frequency = 1;
|
||||||
|
sound[] = {"\ca\SOUNDS\Vehicles\Wheeled\BUS\int\noise3", 0.177828, 1};
|
||||||
|
volume = "(damper0 max 0.04)*(speed factor[0, 8])*(1-camPos)";
|
||||||
|
};
|
||||||
|
class Movement {
|
||||||
|
frequency = 1;
|
||||||
|
sound = "soundEnviron";
|
||||||
|
volume = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class Damage {
|
||||||
|
mat[] = {"ca\wheeled\data\hatchback.rvmat", "ca\wheeled\data\hatchback.rvmat", "ca\wheeled\data\hatchback_destruct.rvmat", "ca\wheeled\data\hatchback.rvmat", "ca\wheeled\data\hatchback.rvmat", "ca\wheeled\data\hatchback_destruct.rvmat", "ca\wheeled\data\detailmapy\auta_skla.rvmat", "ca\wheeled\data\detailmapy\auta_skla_damage.rvmat", "ca\wheeled\data\detailmapy\auta_skla_damage.rvmat", "ca\wheeled\data\detailmapy\auta_skla_in.rvmat", "ca\wheeled\data\detailmapy\auta_skla_in_damage.rvmat", "ca\wheeled\data\detailmapy\auta_skla_in_damage.rvmat"};
|
||||||
|
tex[] = {};
|
||||||
|
};
|
||||||
|
class Library {
|
||||||
|
libtextdesc = "Civilian Car";
|
||||||
|
};
|
||||||
|
};
|
||||||
80
SQF/dayz_code/Configs/CfgVehicles/Car/SUV_DZ.hpp
Normal file
80
SQF/dayz_code/Configs/CfgVehicles/Car/SUV_DZ.hpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
class SUV_DZ: SUV_Base_EP1 {
|
||||||
|
crew = "";
|
||||||
|
faction = "BIS_TK_CIV";
|
||||||
|
rarityurban = 0.8;
|
||||||
|
scope = 2;
|
||||||
|
side = 3;
|
||||||
|
typicalcargo[] = {};
|
||||||
|
class HitPoints : HitPoints {
|
||||||
|
class HitLFWheel:HitLFWheel {
|
||||||
|
armor = 0.15;
|
||||||
|
material = -1;
|
||||||
|
name = "wheel_1_1_steering";
|
||||||
|
passthrough = 0.3;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitLBWheel:HitLBWheel {
|
||||||
|
armor = 0.15;
|
||||||
|
material = -1;
|
||||||
|
name = "wheel_1_2_steering";
|
||||||
|
passthrough = 0.3;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitRFWheel:HitRFWheel {
|
||||||
|
armor = 0.15;
|
||||||
|
material = -1;
|
||||||
|
name = "wheel_2_1_steering";
|
||||||
|
passthrough = 0.3;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitRBWheel:HitRBWheel {
|
||||||
|
armor = 0.15;
|
||||||
|
material = -1;
|
||||||
|
name = "wheel_2_2_steering";
|
||||||
|
passthrough = 0.3;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitFuel:HitFuel {
|
||||||
|
armor = 0.14;
|
||||||
|
material = -1;
|
||||||
|
name = "palivo";
|
||||||
|
passthrough = 1;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitEngine:HitEngine {
|
||||||
|
armor = 0.5;
|
||||||
|
material = -1;
|
||||||
|
name = "motor";
|
||||||
|
passthrough = 1;
|
||||||
|
visual = "";
|
||||||
|
};
|
||||||
|
class HitGlass1:HitGlass1 {
|
||||||
|
armor = 0.1;
|
||||||
|
material = -1;
|
||||||
|
name = "glass1";
|
||||||
|
passthrough = 0;
|
||||||
|
visual = "glass1";
|
||||||
|
};
|
||||||
|
class HitGlass2:HitGlass2 {
|
||||||
|
armor = 0.1;
|
||||||
|
material = -1;
|
||||||
|
name = "glass2";
|
||||||
|
passthrough = 0;
|
||||||
|
visual = "glass2";
|
||||||
|
};
|
||||||
|
class HitGlass3:HitGlass3 {
|
||||||
|
armor = 0.1;
|
||||||
|
material = -1;
|
||||||
|
name = "glass3";
|
||||||
|
passthrough = 0;
|
||||||
|
visual = "glass3";
|
||||||
|
};
|
||||||
|
class HitGlass4:HitGlass4 {
|
||||||
|
armor = 0.1;
|
||||||
|
material = -1;
|
||||||
|
name = "glass4";
|
||||||
|
passthrough = 0;
|
||||||
|
visual = "glass4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
10
SQF/dayz_code/Configs/CfgVehicles/Car/UAZ_CDF.hpp
Normal file
10
SQF/dayz_code/Configs/CfgVehicles/Car/UAZ_CDF.hpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class UAZ_CDF: UAZ_Unarmed_Base {
|
||||||
|
accuracy = 0.3;
|
||||||
|
maxspeed = 190;
|
||||||
|
crew = "";
|
||||||
|
faction = "CDF";
|
||||||
|
hiddenselectionstextures[] = {"\ca\wheeled\data\Uaz_main_002_CO.paa"};
|
||||||
|
scope = 2;
|
||||||
|
side = 1;
|
||||||
|
typicalcargo[] = {};
|
||||||
|
};
|
||||||
46
SQF/dayz_code/Configs/CfgVehicles/Helicopter/AH6X.hpp
Normal file
46
SQF/dayz_code/Configs/CfgVehicles/Helicopter/AH6X.hpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
class AH6X_DZ_Base: AH6_Base_EP1
|
||||||
|
{
|
||||||
|
class Helicopter: Air
|
||||||
|
{
|
||||||
|
class NewTurret;
|
||||||
|
class Turrets {class MainTurret;};
|
||||||
|
class HitPoints
|
||||||
|
{
|
||||||
|
class HitGlass1;
|
||||||
|
class HitGlass2;
|
||||||
|
class HitGlass3;
|
||||||
|
class HitGlass4;
|
||||||
|
class HitGlass5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class AH6X_DZ: AH6_Base_EP1
|
||||||
|
{
|
||||||
|
displayname = $STR_VEH_NAME_AH6X;
|
||||||
|
displaynameshort = $STR_EP1_DN_AH6X;
|
||||||
|
audible = 6;
|
||||||
|
enablemanualfire = 0;
|
||||||
|
scope = 2;
|
||||||
|
side = 2;
|
||||||
|
crew = "";
|
||||||
|
typicalCargo[] = {};
|
||||||
|
hiddenselections[] = {"camo1"};
|
||||||
|
hiddenselectionstextures[] = {"ca\air_e\ah6j\data\ah6_merge1_co.paa"};
|
||||||
|
icon = "\ca\air_e\data\UI\Icon_ah6x_CA.paa";
|
||||||
|
model = "\ca\air_e\ah6j\ah6x";
|
||||||
|
picture = "\ca\air_e\data\UI\Picture_ah6x_CA.paa";
|
||||||
|
isuav = 0;
|
||||||
|
radartype = 0;
|
||||||
|
class TransportMagazines{};
|
||||||
|
class TransportWeapons{};
|
||||||
|
weapons[] = {};
|
||||||
|
magazines[] = {};
|
||||||
|
commanderCanSee = 2+16+32;
|
||||||
|
gunnerCanSee = 2+16+32;
|
||||||
|
driverCanSee = 2+16+32;
|
||||||
|
transportMaxWeapons = 3;
|
||||||
|
transportMaxMagazines = 30;
|
||||||
|
transportmaxbackpacks = 2;
|
||||||
|
class Turrets {};
|
||||||
|
};
|
||||||
64
SQF/dayz_code/achievements/achievements.sqf
Normal file
64
SQF/dayz_code/achievements/achievements.sqf
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
achievementClientMsg = {
|
||||||
|
private ["_achievement","_player","_AchievementText","_text","_display"];
|
||||||
|
|
||||||
|
/* Only call this from the server
|
||||||
|
achievementClientPV = [_achievementID];
|
||||||
|
owner publicVariableClient "achievementClientPV";
|
||||||
|
*/
|
||||||
|
|
||||||
|
_achievement = (_this select 0) select 0; // what should they get
|
||||||
|
_player = (_this select 0) select 1; // who to send the message to
|
||||||
|
|
||||||
|
_AchievementText = switch (_achievement) do
|
||||||
|
{
|
||||||
|
case 0: {"Time Waster"}; // play for over 1 hour straight
|
||||||
|
case 1: {"High Flyer"}; // 500+ AGL
|
||||||
|
case 2: {"Grave Robber"}; // Stand near a "mass_grave"
|
||||||
|
case 3: {"Shopaholic"}; // Visit 5 supermarkets
|
||||||
|
case 4: {"Top Shopper"}; // Visit 10 supermarkets
|
||||||
|
case 5: {"Sick Puppy"}; // Visit 4 hospitals
|
||||||
|
case 6: {"White Collar Worker"}; // Visit 3 offices
|
||||||
|
case 7: {"Fire Warden"}; // Visit 4 firestations
|
||||||
|
case 8: {"Slice Of Fried Gold"}; // Visit 8 pubs
|
||||||
|
case 9: {"Plane Spotter"}; // Visit all 3 ATCs
|
||||||
|
case 10: {"Trinkets of Deceit"}; // Visit 3 churches
|
||||||
|
case 11: {"Litter Bug"}; // drop 5 tinned/canned items
|
||||||
|
case 12: {"Cannibal"}; // eat a piece of raw meat
|
||||||
|
case 13: {"Hunter Gatherer"}; // gut an animal
|
||||||
|
case 14: {"Firestarter"}; // light a fire
|
||||||
|
case 15: {"Steady Aim"}; // make a kill from over 200m
|
||||||
|
case 16: {"Marksman"}; // make a kill from over 500m
|
||||||
|
case 17: {"Sniper"}; // make a kill from over 1000m
|
||||||
|
case 18: {"Bunny Basher"}; // kill a rabbit from over 200m
|
||||||
|
case 19: {"Clean Bill of Health"}; // cure an infection (ABs)
|
||||||
|
case 20: {"Medic of the apocalypse"}; // give 4 blood bags
|
||||||
|
};
|
||||||
|
|
||||||
|
_display = false;
|
||||||
|
_serverEvent = _achievement in [15,16,17];
|
||||||
|
if (_serverEvent) then {
|
||||||
|
if ((_achievement == 15) && (!achievement_SteadyAim)) then {
|
||||||
|
achievement_SteadyAim = true;
|
||||||
|
_display = true;
|
||||||
|
};
|
||||||
|
if ((_achievement == 16) && (!achievement_Marksman)) then {
|
||||||
|
_display = true;
|
||||||
|
achievement_Marksman = true;
|
||||||
|
};
|
||||||
|
if ((_achievement == 17) && (!achievement_Sniper)) then {
|
||||||
|
_display = true;
|
||||||
|
achievement_Sniper = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_display = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_display) then {
|
||||||
|
_text = format["<t size='0.5' color='#ffffff'>Achievement<br/><t size='1.0' color='#F56936'>%1</t>",_AchievementText];
|
||||||
|
null = [_text,0,1,5,2] spawn bis_fnc_dynamictext;
|
||||||
|
// would like to use localize so text can be tweaked using stringtable.xml
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
1
SQF/dayz_code/achievements/achievementsMonitor.sqf
Normal file
1
SQF/dayz_code/achievements/achievementsMonitor.sqf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// moved to dayz_code/system/scheduler/sched_achievement.sqf
|
||||||
21
SQF/dayz_code/achievements/achievementsServer.sqf
Normal file
21
SQF/dayz_code/achievements/achievementsServer.sqf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
achievementServer = {
|
||||||
|
private ["_playerOwnerID","_player","_achievementID","_achievements"];
|
||||||
|
|
||||||
|
_achievementID = (_this select 0) select 0;
|
||||||
|
_player = (_this select 0) select 1;
|
||||||
|
_playerOwnerID = owner _player;
|
||||||
|
|
||||||
|
diag_log (text format ["Achievement: %1 was awarded to %2", _achievementID, _player]);
|
||||||
|
|
||||||
|
_achievements = _player getVariable "Achievements";
|
||||||
|
|
||||||
|
_achievements set [_achievementID,1];
|
||||||
|
|
||||||
|
_player setVariable ["Achievements",_achievements];
|
||||||
|
|
||||||
|
// now send the OSD message to the client that called this
|
||||||
|
achievementClientPV = [_achievementID];
|
||||||
|
_playerOwnerID publicVariableClient "achievementClientPV";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
10
SQF/dayz_code/actions/checkclass.sqf
Normal file
10
SQF/dayz_code/actions/checkclass.sqf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
_object_type = typeOf cursorTarget;
|
||||||
|
_fuellevels = fuel cursorTarget;
|
||||||
|
_dmglevels = damage cursorTarget;
|
||||||
|
|
||||||
|
//remove action menu
|
||||||
|
player removeAction s_player_debugCheck;
|
||||||
|
s_player_debugCheck = -1;
|
||||||
|
|
||||||
|
hintSilent format ["Object: %1, Fuel: %2, Damage: %3", _object_type, _fuellevels, _dmglevels];
|
||||||
|
diag_log format ["Object: %1, Fuel: %2, Damage: %3", _object_type, _fuellevels, _dmglevels];
|
||||||
14
SQF/dayz_code/actions/detonate_bomb.sqf
Normal file
14
SQF/dayz_code/actions/detonate_bomb.sqf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
private["_bombData","_vehicle","_owner","_bombar"];
|
||||||
|
_bombData = _this select 0;
|
||||||
|
|
||||||
|
_vehicle = _bombData select 0;
|
||||||
|
_owner = _bombData select 1;
|
||||||
|
|
||||||
|
_vehicle setVariable ["hasBomb",true,true];
|
||||||
|
|
||||||
|
_vehicle addEventHandler ["GetIn",{
|
||||||
|
//diag_log str(_this);
|
||||||
|
sleep 2;
|
||||||
|
_bombCar = _this select 0;
|
||||||
|
_bomb = createVehicle ["Bo_GBU12_lgb",getPosATL _bombCar, [], 0, "NONE"];
|
||||||
|
}];
|
||||||
96
SQF/dayz_code/actions/object_build.sqf
Normal file
96
SQF/dayz_code/actions/object_build.sqf
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
private ["_status","_array","_object","_items","_classname","_text","_build","_inside","_location","_nearObjects","_dis","_sfx", "_variables"];
|
||||||
|
_array = _this select 3;
|
||||||
|
|
||||||
|
_ghost = _array select 0;
|
||||||
|
_object = nil;
|
||||||
|
_items = _array select 1;
|
||||||
|
_classname = _array select 2;
|
||||||
|
_text = _array select 3;
|
||||||
|
_build = _array select 4;
|
||||||
|
_dis = _array select 5;
|
||||||
|
_sfx = _array select 6;
|
||||||
|
|
||||||
|
_uid = getPlayerUID player;
|
||||||
|
|
||||||
|
_keepOnSlope = 0 == (getNumber (configFile >> "CfgVehicles" >> _classname >> "canbevertical"));
|
||||||
|
|
||||||
|
Dayz_constructionContext set [ 4, false ]; // Stop the construction mode, cf. player_build.sqf
|
||||||
|
|
||||||
|
if (_build) then {
|
||||||
|
_location = getPosATL _ghost;
|
||||||
|
_direction = getDir _ghost;
|
||||||
|
_object = createVehicle [_classname, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||||
|
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||||
|
_object setDir _direction;
|
||||||
|
if ((Dayz_constructionContext select 5) or _keepOnSlope) then {
|
||||||
|
_object setVectorUp surfaceNormal _location;
|
||||||
|
_location set [2,0];
|
||||||
|
} else {
|
||||||
|
_object setVectorUp [0,0,1];
|
||||||
|
if (_location select 2 == 0) then { _location set [2, -0.01]; };
|
||||||
|
};
|
||||||
|
deleteVehicle _ghost;
|
||||||
|
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
["Working",0,[20,40,15,0]] call dayz_NutritionSystem; // Added Nutrition-Factor for work
|
||||||
|
player playActionNow "Medic";
|
||||||
|
sleep 5;
|
||||||
|
|
||||||
|
_object setPosATL _location;
|
||||||
|
player reveal _object;
|
||||||
|
|
||||||
|
_variables = [];
|
||||||
|
|
||||||
|
if (_object iskindof "DZ_buildables") then {
|
||||||
|
_passcode = [floor(random 10),floor(random 10),floor(random 10),floor(random 10)];
|
||||||
|
_object setVariable ["ownerArray",[getPlayerUID player],true];
|
||||||
|
_object setVariable ["dayz_padlockCombination",_passcode,true];
|
||||||
|
|
||||||
|
_variables set [ count _variables, ["ownerArray", [getPlayerUID player]]];
|
||||||
|
_variables set [ count _variables, ["padlockCombination", _passcode]];
|
||||||
|
};
|
||||||
|
_object setVariable ["characterID",dayz_characterID, true];
|
||||||
|
|
||||||
|
if (_object isKindOf "TrapItems") then {
|
||||||
|
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> "initState") > 0) then {
|
||||||
|
_object setVariable ["armed", true, true];
|
||||||
|
} else {
|
||||||
|
_object setVariable ["armed", false, true];
|
||||||
|
};
|
||||||
|
_variables set [ count _variables, ["armed", _object getVariable "armed"]];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* //set fuel, Later use Generator
|
||||||
|
if (_object isKindOf "Generator_DZ") then {
|
||||||
|
diag_log format["Object: %1, Fuel: %2",_object,fuel _object];
|
||||||
|
if (local _object) then {
|
||||||
|
_object setFuel 0;
|
||||||
|
} else {
|
||||||
|
PVDZ_send = [_object,"SetFuel",[_object,0]];
|
||||||
|
publicVariableServer "PVDZ_send";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
_object setVariable ["characterID",dayz_characterID,true];
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_object,[round _direction, _location], _variables];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
|
||||||
|
cutText [format [localize "str_build_01",_text], "PLAIN DOWN"];
|
||||||
|
r_action_count = 0;
|
||||||
|
} else {
|
||||||
|
r_action_count = 0;
|
||||||
|
|
||||||
|
if ((!isNil "_ghost") and {(!isNull _ghost)}) then { deleteVehicle _ghost; };
|
||||||
|
|
||||||
|
{
|
||||||
|
if (isClass (configFile >> "CfgMagazines" >> _x)) then {
|
||||||
|
player addMagazine _x;
|
||||||
|
};
|
||||||
|
} foreach _items;
|
||||||
|
cutText [format [localize "str_build_failed_02",_text], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
173
SQF/dayz_code/actions/object_disassembly.sqf
Normal file
173
SQF/dayz_code/actions/object_disassembly.sqf
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
private ["_cursorTarget","_onLadder","_isWater","_alreadyRemoving","_characterID","_objectID","_objectUID","_ownerArray","_dir",
|
||||||
|
"_realObjectStillThere","_upgrade","_entry","_parent","_requiredParts","_requiredTools","_model","_toolsOK","_displayname",
|
||||||
|
"_whpos","_i","_wh","_object"];
|
||||||
|
|
||||||
|
|
||||||
|
_cursorTarget = _this select 3;
|
||||||
|
|
||||||
|
// ArmaA2 bug workaround: sometimes the object is null
|
||||||
|
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
|
||||||
|
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
|
||||||
|
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
if(isNull _cursorTarget) exitWith {
|
||||||
|
//cutText [localize "str_disassembleNoOption", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_disassembleNoOption";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Remove action Menu
|
||||||
|
player removeAction s_player_disassembly;
|
||||||
|
s_player_disassembly = -1;
|
||||||
|
|
||||||
|
//Normal blocked stuff
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
_msg = localize "str_disassembleInProgress";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_alreadyRemoving = _cursorTarget getVariable["ObjectLocked",0];
|
||||||
|
if (_alreadyRemoving == 1) exitWith {
|
||||||
|
_msg = localize "str_disassembleInProgress";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_cursorTarget setVariable["ObjectLocked",1,true];
|
||||||
|
_characterID = _cursorTarget getVariable ["characterID","0"];
|
||||||
|
_objectID = _cursorTarget getVariable ["ObjectID","0"];
|
||||||
|
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
|
||||||
|
_ownerArray = _cursorTarget getVariable ["ownerArray",[]];
|
||||||
|
_dir = round getDir _cursorTarget;
|
||||||
|
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
|
||||||
|
_pos = getposATL _cursorTarget;
|
||||||
|
if (((_vector select 1) select 2) - 1 > 0.001) then { _pos set [2,0]; };
|
||||||
|
|
||||||
|
_realObjectStillThere = true;
|
||||||
|
_upgrade = typeOf _cursorTarget;
|
||||||
|
_entry = configFile >> "CfgVehicles" >> _upgrade;
|
||||||
|
r_interrupt = false;
|
||||||
|
|
||||||
|
for "_i" from 1 to 20 do {
|
||||||
|
_parent = inheritsFrom _entry;
|
||||||
|
_requiredParts = [] + (getArray (_parent >> "Upgrade" >> "requiredParts"));
|
||||||
|
_requiredTools = [] + (getArray (_parent >> "Upgrade" >> "requiredTools"));
|
||||||
|
_model = getText (_parent >> "model"); // model of parent
|
||||||
|
_displayname = getText (_entry >> "displayName"); // name of current
|
||||||
|
diag_log format["%1 - %2 - %3 - %4 - %5",_parent,_requiredParts,_requiredTools,_model,_displayname];
|
||||||
|
|
||||||
|
// check the tools needed
|
||||||
|
_toolsOK = true;
|
||||||
|
{
|
||||||
|
if (!(_x IN items player)) exitWith { _toolsOK = false; };
|
||||||
|
} count _requiredTools;
|
||||||
|
|
||||||
|
if (!_toolsOK) exitWith {
|
||||||
|
//cutText [format [localize "str_disassembleMissingTool",getText (configFile >> "CfgWeapons" >> _x >> "displayName"),_displayname], "PLAIN DOWN"];//["Missing %1 to disassemble %2."
|
||||||
|
_msg = format [localize "str_disassembleMissingTool",getText (configFile >> "CfgWeapons" >> _x >> "displayName"),_displayname];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0) then {
|
||||||
|
player playActionNow "Medic";
|
||||||
|
_dis=20;
|
||||||
|
[player,"tentpack",0,false,20] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
//wait animation starts and block
|
||||||
|
waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 1};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// remove object
|
||||||
|
deleteVehicle _cursorTarget;
|
||||||
|
_cursorTarget = objNull;
|
||||||
|
if (_realObjectStillThere) then { // send to server the destroy request
|
||||||
|
_realObjectStillThere = false;
|
||||||
|
PVDZ_obj_Destroy = [_objectID,_objectUID];
|
||||||
|
publicVariableServer "PVDZ_obj_Destroy";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "Networked object, request to destroy", PVDZ_obj_Destroy];
|
||||||
|
};
|
||||||
|
|
||||||
|
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
// check whether we reached the base class, for which no P3D is defined
|
||||||
|
if (count _requiredParts == 0) exitwith {
|
||||||
|
diag_log [diag_ticktime, __FILE__, "Dismantle terminated, last building deleted is:", _upgrade];
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a weaponholder with dismissed parts
|
||||||
|
_whpos=player modelToWorld [2 * sin(30*_i), 2 * cos(30*_i), 0];
|
||||||
|
_whpos set [2,0];
|
||||||
|
_wh = createVehicle ["WeaponHolder", _whpos, [], 0, "CAN_COLLIDE"];
|
||||||
|
_wh setDir (30*_i);
|
||||||
|
_wh setPosATL _whpos;
|
||||||
|
{
|
||||||
|
if (isClass (configFile >> "CfgMagazines" >> _x))
|
||||||
|
then { _wh addMagazineCargoGlobal [_x, 1]; }
|
||||||
|
else { _wh addWeaponCargoGlobal [_x, 1]; };
|
||||||
|
} forEach _requiredParts;
|
||||||
|
diag_log [diag_ticktime, __FILE__, "Pile created with:", _requiredParts];
|
||||||
|
|
||||||
|
// create the parent object locally
|
||||||
|
_upgrade = configName _parent;
|
||||||
|
if (getNumber(_parent >> "scope")==2) then {
|
||||||
|
_cursorTarget = _upgrade createVehicleLocal getMarkerpos "respawn_west";
|
||||||
|
_cursorTarget setVectorDirAndUp _vector;
|
||||||
|
_cursorTarget setPosATL _pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep 1.5;
|
||||||
|
|
||||||
|
if (r_interrupt) exitwith {
|
||||||
|
diag_log [diag_ticktime, __FILE__, "Operation interrupted, last building deleted is:", _upgrade];
|
||||||
|
};
|
||||||
|
|
||||||
|
_entry = _parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
// wait animation ends
|
||||||
|
waitUntil {r_interrupt or (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0)};
|
||||||
|
if (r_interrupt and vehicle player == player) then {
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
r_interrupt = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_realObjectStillThere) then {
|
||||||
|
// current object is a local one, replace it by a networked one, with all attributes
|
||||||
|
// and request a HIVE save
|
||||||
|
if (!isNull _cursorTarget) then {
|
||||||
|
_upgrade = typeOf _cursorTarget;
|
||||||
|
deleteVehicle _cursorTarget;
|
||||||
|
if (getNumber(_parent >> "scope")==2) then {
|
||||||
|
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||||
|
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||||
|
_object setVectorDirAndUp _vector;
|
||||||
|
_object setPosATL _pos;
|
||||||
|
_puid = getPlayerUID player;
|
||||||
|
if (!(_puid in _ownerArray)) then {
|
||||||
|
_ownerArray set [ count _ownerArray, _puid ];
|
||||||
|
};
|
||||||
|
_object setVariable ["ownerArray",_ownerArray,true];
|
||||||
|
_variables = [[ "ownerArray", _ownerArray]];
|
||||||
|
_object setVariable ["characterID",_characterID,true];
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],_variables];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
/*
|
||||||
|
//Send maintenance info
|
||||||
|
PVDZ_veh_Save = [_object,"maintenance"];
|
||||||
|
publicVariableServer "PVDZ_veh_Save";*/
|
||||||
|
player reveal _object;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_msg = localize "str_disassembleDone";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
//cutText [localize "str_disassembleDone", "PLAIN DOWN"];
|
||||||
|
|
||||||
|
_cursorTarget setVariable["ObjectLocked",0,true];
|
||||||
|
|
||||||
173
SQF/dayz_code/actions/object_dismantle.sqf
Normal file
173
SQF/dayz_code/actions/object_dismantle.sqf
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
private ["_object","_proceed","_pos","_rndattemps","_limit","_dismantleToo","_pos","_ownerID","_objectID","_objectUID","_playerID","_claimedBy","_tools"];
|
||||||
|
|
||||||
|
_object = _this;
|
||||||
|
_proceed = false;
|
||||||
|
_exit = false;
|
||||||
|
|
||||||
|
//Random times to run
|
||||||
|
_rndattemps = getNumber (configFile >> "CfgVehicles" >> (typeOf _object) >> "dismantle" >> "attempts");
|
||||||
|
_limit = 1 + round(random _rndattemps);
|
||||||
|
|
||||||
|
//Dismantle magazine type
|
||||||
|
_dismantleToo = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "dismantle" >> "dismantleToo");
|
||||||
|
|
||||||
|
//Object location
|
||||||
|
_pos = getposATL _object;
|
||||||
|
|
||||||
|
//Object info
|
||||||
|
_ownerID = _object getVariable["CharacterID","0"];
|
||||||
|
_objectID = _object getVariable["ObjectID","0"];
|
||||||
|
_objectUID = _object getVariable["ObjectUID","0"];
|
||||||
|
//Playerinfo
|
||||||
|
_playerID = getPlayerUID player;
|
||||||
|
|
||||||
|
//Block
|
||||||
|
_claimedBy = _object getVariable "claimed";
|
||||||
|
|
||||||
|
if (isnil "claimed") then {
|
||||||
|
_object setVariable["claimed",_playerID,true];
|
||||||
|
};
|
||||||
|
|
||||||
|
//Tools
|
||||||
|
_tools = getArray (configFile >> "CfgVehicles" >> (typeOf _object) >> "dismantle" >> "requiredtools");
|
||||||
|
|
||||||
|
{
|
||||||
|
private ["_end"];
|
||||||
|
if ((_x select 0) in items player) then {_end = false;} else { cutText [format ["Missing tool %1 to dismantle",(_x select 0)] , "PLAIN DOWN"]; _end = true; _proceed = false; };
|
||||||
|
|
||||||
|
if (_end) exitwith { _exit = true; };
|
||||||
|
} foreach _tools;
|
||||||
|
|
||||||
|
//End missing tools
|
||||||
|
if (_exit) exitwith {};
|
||||||
|
|
||||||
|
|
||||||
|
//Normal blocked stuff
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
//cutText ["unable to upgrade at this time", "PLAIN DOWN"];
|
||||||
|
titleText [localize "str_CannotUpgrade"];
|
||||||
|
};
|
||||||
|
|
||||||
|
//Start loop
|
||||||
|
_isOk = true;
|
||||||
|
//Counter
|
||||||
|
_counter = 0;
|
||||||
|
|
||||||
|
while {_isOk} do {
|
||||||
|
//Check if we have the tools to start
|
||||||
|
{
|
||||||
|
private ["_end"];
|
||||||
|
if ((_x select 0) in items player) then {_end = false;} else { cutText [format ["Missing tool %1 to dismantle",_x] , "PLAIN DOWN"]; _end = true; _proceed = false; };
|
||||||
|
|
||||||
|
if (_end) exitwith { _exit = true; };
|
||||||
|
}foreach _tools;
|
||||||
|
if (_exit) exitwith {};
|
||||||
|
|
||||||
|
_claimedBy = _object getVariable["claimed","0"];
|
||||||
|
|
||||||
|
if (_claimedBy != _playerID) exitWith { cutText [format [localize "str_player_beinglooted",_text] , "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
//Run animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//Run SFX
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "repair";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
|
||||||
|
// Working-Factor for chopping wood.
|
||||||
|
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
//Setup Vars
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
|
||||||
|
//run animation loop
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt or (player getVariable["combattimeout", 0] >= time)) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = false;
|
||||||
|
};
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
//Interrupt and end
|
||||||
|
if(!_finished) exitWith {
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Everything happened as it should
|
||||||
|
if(_finished) then {
|
||||||
|
//Add to Counter
|
||||||
|
_counter = _counter + 1;
|
||||||
|
//Try to dismantle
|
||||||
|
if ([0.01] call fn_chance) then {
|
||||||
|
//stop loop
|
||||||
|
_isOk = false;
|
||||||
|
//Set Done var
|
||||||
|
_proceed = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//Chances to damage tools
|
||||||
|
{
|
||||||
|
if ([(_x select 1)] call fn_chance) then {
|
||||||
|
player removeWeapon (_x select 0);
|
||||||
|
player addWeapon (_x select 2);
|
||||||
|
titleText ["Your tool has been damaged." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
}foreach _tools;
|
||||||
|
|
||||||
|
if(_counter == _limit) exitWith {
|
||||||
|
//stop loop
|
||||||
|
_isOk = false;
|
||||||
|
//Set Done var
|
||||||
|
_proceed = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
titleText [format["Dismantle attempt (%1 of %2).", _counter,_limit], "PLAIN DOWN"];
|
||||||
|
sleep 0.10;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Completed and successful
|
||||||
|
if (_proceed) then {
|
||||||
|
_claimedBy = _object getVariable["claimed","0"];
|
||||||
|
|
||||||
|
if (_claimedBy != _playerID) exitWith { cutText [format [localize "str_player_beinglooted",_text] , "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
titleText [format["Dismantled, (%1).", (typeOf _object)], "PLAIN DOWN"];
|
||||||
|
|
||||||
|
PVDZ_obj_Destroy = [_objectID,_objectUID];
|
||||||
|
publicVariableServer "PVDZ_obj_Destroy";
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
PVDZ_obj_Destroy call server_deleteObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Need to update for sanity no client should ever create or delete anything
|
||||||
|
deleteVehicle _object;
|
||||||
|
|
||||||
|
//PVDZ_obj_Create = ["WeaponHolder",_pos,["ItemTankTrap"]];
|
||||||
|
//publicVariableServer "PVDZ_obj_Create";
|
||||||
|
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
|
||||||
|
_holder addmagazinecargoGlobal [_dismantleToo,1];
|
||||||
|
|
||||||
|
};
|
||||||
112
SQF/dayz_code/actions/object_maintenance.sqf
Normal file
112
SQF/dayz_code/actions/object_maintenance.sqf
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
Upkeep on built items.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAINTENANCE_NUTRITION_VALUES [20,40,15,0]
|
||||||
|
|
||||||
|
|
||||||
|
private ["_isMedic","_cursorTarget"];
|
||||||
|
|
||||||
|
_cursorTarget = _this select 3;
|
||||||
|
|
||||||
|
// ArmaA2 bug workaround: sometimes the object is null
|
||||||
|
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
|
||||||
|
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
|
||||||
|
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
if(isNull _cursorTarget) exitWith {
|
||||||
|
cutText ["No maintenance options", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
//Remove action Menu
|
||||||
|
player removeAction s_player_maintenance;
|
||||||
|
s_player_maintenance = -1;
|
||||||
|
|
||||||
|
//Item
|
||||||
|
_item = typeof _cursorTarget;
|
||||||
|
//diag_log (str(_item));
|
||||||
|
|
||||||
|
_classname = configFile >> "CfgVehicles" >> _item;
|
||||||
|
_displayname = getText (_classname >> "displayname");
|
||||||
|
|
||||||
|
//Get tools needed
|
||||||
|
_requiredTools = getArray (_classname >> "Maintenance" >> "requiredTools");
|
||||||
|
//diag_log (str(_requiredTools));
|
||||||
|
|
||||||
|
//get parts needed
|
||||||
|
_requiredParts = getArray (_classname >> "Maintenance" >> "requiredParts");
|
||||||
|
//diag_log (str(_requiredParts));
|
||||||
|
|
||||||
|
//Normal blocked stuff
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
|
||||||
|
_upgradeParts = [];
|
||||||
|
_startMaintenance = true;
|
||||||
|
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
cutText ["Unable to proceed", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
// lets check player has requiredTools for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN items player)) exitWith {
|
||||||
|
cutText[ format[ localize "str_maintenanceMissingTool",_x], "PLAIN DOWN"]; //"Missing %1 to do maintenance %2."
|
||||||
|
_startMaintenance = false;
|
||||||
|
};
|
||||||
|
} count _requiredTools;
|
||||||
|
|
||||||
|
// lets check player has requiredParts for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN magazines player)) exitWith {
|
||||||
|
cutText[ format[ localize "str_maintenanceMissingPart",_x,_displayname], "PLAIN DOWN"]; //"Missing %1 to maintenance %2."
|
||||||
|
_startMaintenance = false;
|
||||||
|
};
|
||||||
|
} count _requiredParts;
|
||||||
|
|
||||||
|
|
||||||
|
if (_startMaintenance) then {
|
||||||
|
//play animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "tentpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
["Working",0,MAINTENANCE_NUTRITION_VALUES] call dayz_NutritionSystem; // Added Nutrition-Factor for work
|
||||||
|
|
||||||
|
{ player removeMagazine _x; } count _requiredParts;
|
||||||
|
|
||||||
|
//Animation Loop
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isRefuel = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isRefuel) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isRefuel) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
if (_finished) then {
|
||||||
|
if (isServer) then {
|
||||||
|
PVDZ_veh_Save call server_updateObject;
|
||||||
|
} else {
|
||||||
|
PVDZ_veh_Save = [_cursorTarget,"maintenance"];
|
||||||
|
publicVariableServer "PVDZ_veh_Save";
|
||||||
|
};
|
||||||
|
|
||||||
|
PVDZ_object_replace = [_cursorTarget];
|
||||||
|
publicVariableServer "PVDZ_object_replace";
|
||||||
|
};
|
||||||
|
cutText [localize "str_maintenanceDone", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
223
SQF/dayz_code/actions/object_upgradeFireplace.sqf
Normal file
223
SQF/dayz_code/actions/object_upgradeFireplace.sqf
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
/*
|
||||||
|
This script is not part of dayz permission must be given to use. r4z0r49@gmail.com or skype me R4Z0R49.
|
||||||
|
|
||||||
|
Simple class system to use this script.
|
||||||
|
class Upgrade {
|
||||||
|
requiredTools[] = {"ItemToolbox"};
|
||||||
|
requiredParts[] = {"equip_crate","PartWoodPile"};
|
||||||
|
create = "TentStorage1";
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_objclass",
|
||||||
|
"_cursorTarget",
|
||||||
|
"_item",
|
||||||
|
"_classname",
|
||||||
|
"_requiredTools",
|
||||||
|
"_requiredParts",
|
||||||
|
"_upgrade",
|
||||||
|
"_upgradeConfig",
|
||||||
|
"_upgradeDisplayname",
|
||||||
|
"_onLadder",
|
||||||
|
"_isWater",
|
||||||
|
"_upgradeParts",
|
||||||
|
"_startUpgrade",
|
||||||
|
"_missingPartsConfig",
|
||||||
|
"_textMissingParts",
|
||||||
|
"_dis",
|
||||||
|
"_sfx",
|
||||||
|
"_ownerID",
|
||||||
|
"_objectID",
|
||||||
|
"_objectUID",
|
||||||
|
"_alreadyupgrading",
|
||||||
|
"_pos",
|
||||||
|
"_dir",
|
||||||
|
"_weapons",
|
||||||
|
"_magazines",
|
||||||
|
"_backpacks",
|
||||||
|
"_object",
|
||||||
|
"_objWpnTypes",
|
||||||
|
"_objWpnQty",
|
||||||
|
"_countr"
|
||||||
|
];
|
||||||
|
|
||||||
|
_cursorTarget = _this select 0;
|
||||||
|
|
||||||
|
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
|
||||||
|
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["Land_Fire_DZ"], 1.5];
|
||||||
|
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
|
||||||
|
};
|
||||||
|
if (isNull _cursorTarget) exitWith {};
|
||||||
|
|
||||||
|
_item = typeof _cursorTarget;
|
||||||
|
|
||||||
|
//remove action menu
|
||||||
|
player removeAction s_player_upgradestroage;
|
||||||
|
s_player_upgradestroage = -1;
|
||||||
|
|
||||||
|
//Not needed
|
||||||
|
//_itemName = getText (configFile >> "CfgVehicles" >> _item >> "displayName");
|
||||||
|
////diag_log (str(_itemName));
|
||||||
|
|
||||||
|
//Get tools needed
|
||||||
|
_classname = configFile >> "CfgVehicles" >> _item;
|
||||||
|
_requiredTools = getArray (_classname >> "Upgrade" >> "requiredTools");
|
||||||
|
//diag_log (str(_requiredTools));
|
||||||
|
|
||||||
|
//get parts needed
|
||||||
|
_requiredParts = getArray (_classname >> "Upgrade" >> "requiredParts");
|
||||||
|
//diag_log (str(_requiredParts));
|
||||||
|
|
||||||
|
//get item to create
|
||||||
|
_upgrade = getText (_classname >> "Upgrade" >> "create");
|
||||||
|
//diag_log (str(_upgrade));
|
||||||
|
|
||||||
|
//Display name of upgrade part
|
||||||
|
_upgradeConfig = configFile >> "CfgVehicles" >> _upgrade;
|
||||||
|
|
||||||
|
//diag_log (str(_upgradeConfig));
|
||||||
|
_upgradeDisplayname = getText (_upgradeConfig >> "displayName");
|
||||||
|
|
||||||
|
//diag_log (str(_upgradeDisplayname));
|
||||||
|
//Normal blocked stuff
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
|
||||||
|
_upgradeParts = [];
|
||||||
|
_startUpgrade = true;
|
||||||
|
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
//cutText [localize "str_CannotUpgrade", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_CannotUpgrade";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
//systemchat[localize "str_CannotUpgrade"];
|
||||||
|
};
|
||||||
|
|
||||||
|
// lets check player has requiredTools for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN items player)) exitWith {
|
||||||
|
_missingPartsConfig = configFile >> "CfgVehicles" >> _x;
|
||||||
|
_textMissingParts = getText (_missingPartsConfig >> "displayName");
|
||||||
|
//systemChat format["Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg = format [localize "Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
_startUpgrade = false;
|
||||||
|
};
|
||||||
|
} count _requiredTools;
|
||||||
|
|
||||||
|
// lets check player has requiredParts for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN magazines player)) exitWith {
|
||||||
|
_missingPartsConfig = configFile >> "CfgMagazines" >> _x;
|
||||||
|
_textMissingParts = getText (_missingPartsConfig >> "displayName");
|
||||||
|
//systemChat format["Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg = format [localize "Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
_startUpgrade = false;
|
||||||
|
};
|
||||||
|
if (_x IN magazines player) then {
|
||||||
|
_upgradeParts set [count _upgradeParts, _x];
|
||||||
|
};
|
||||||
|
} count _requiredParts;
|
||||||
|
|
||||||
|
|
||||||
|
//Does object have a upgrade option.
|
||||||
|
if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
|
||||||
|
//play animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
_dis = 20;
|
||||||
|
_sfx = "tentpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Added Nutrition-Factor for work
|
||||||
|
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
//get ownerID from old tent.
|
||||||
|
_ownerID = _cursorTarget getVariable ["characterID","0"];
|
||||||
|
_objectID = _cursorTarget getVariable ["ObjectID","0"];
|
||||||
|
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
|
||||||
|
|
||||||
|
//Upgrade
|
||||||
|
_alreadyupgrading = _cursorTarget getVariable["alreadyupgrading",0];
|
||||||
|
|
||||||
|
if (_alreadyupgrading == 1) exitWith {
|
||||||
|
//cutText [localize "str_upgradeInProgress", "PLAIN DOWN"]
|
||||||
|
_msg = localize "str_upgradeInProgress";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_cursorTarget setVariable["alreadyupgrading",1];
|
||||||
|
|
||||||
|
sleep 0.03;
|
||||||
|
|
||||||
|
//Get location and direction of old item
|
||||||
|
_dir = round getDir _cursorTarget;
|
||||||
|
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
|
||||||
|
|
||||||
|
//reset orientation before measuring position, otherwise the new object will be placed incorrectly. -foxy
|
||||||
|
_cursorTarget setDir 0;
|
||||||
|
_pos = getPosATL _cursorTarget;
|
||||||
|
|
||||||
|
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
|
||||||
|
|
||||||
|
//get contents
|
||||||
|
_magazines = getMagazineCargo _cursorTarget;
|
||||||
|
|
||||||
|
//replay animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
deleteVehicle _cursorTarget;
|
||||||
|
|
||||||
|
// remove parts from players inventory before creation of new tent.
|
||||||
|
{
|
||||||
|
player removeMagazine _x;
|
||||||
|
_upgradeParts = _upgradeParts - [_x];
|
||||||
|
} count _upgradeParts;
|
||||||
|
|
||||||
|
//create new tent
|
||||||
|
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
|
//reseting orientation to make sure the object goes where it's supposed to -foxy
|
||||||
|
_object setDir 0;
|
||||||
|
_object setPosATL _pos;
|
||||||
|
_object setVectorDirAndUp _vector;
|
||||||
|
|
||||||
|
//set ownerID from old tent.
|
||||||
|
_object setVariable ["characterID",_ownerID];
|
||||||
|
|
||||||
|
//Make sure player knows about the new object
|
||||||
|
player reveal _object;
|
||||||
|
|
||||||
|
//Add contents back
|
||||||
|
//Add Magazines
|
||||||
|
_objWpnTypes = _magazines select 0;
|
||||||
|
_objWpnQty = _magazines select 1;
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
_object addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
|
||||||
|
_countr = _countr + 1;
|
||||||
|
} count _objWpnTypes;
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
|
||||||
|
//Light fire
|
||||||
|
[_object,true] call dayz_inflame;
|
||||||
|
_object spawn player_fireMonitor;
|
||||||
|
|
||||||
|
//publish new tent
|
||||||
|
//[[[],[]],[[],[]],[[],[]]]
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],[[[],[]],_magazines,[[],[]]]];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
|
||||||
|
//cutText [localize "str_upgradeDone", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_upgradeDone";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
/*
|
||||||
|
} else {
|
||||||
|
cutText ["Object has no upgrade option.", "PLAIN DOWN"];
|
||||||
|
*/
|
||||||
|
};
|
||||||
241
SQF/dayz_code/actions/object_upgradeStorage.sqf
Normal file
241
SQF/dayz_code/actions/object_upgradeStorage.sqf
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
This script is not part of dayz permission must be given to use. r4z0r49@gmail.com or skype me R4Z0R49.
|
||||||
|
|
||||||
|
Simple class system to use this script.
|
||||||
|
class Upgrade {
|
||||||
|
requiredTools[] = {"ItemToolbox"};
|
||||||
|
requiredParts[] = {"equip_crate","PartWoodPile"};
|
||||||
|
create = "TentStorage1";
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_objclass",
|
||||||
|
"_cursorTarget",
|
||||||
|
"_item",
|
||||||
|
"_classname",
|
||||||
|
"_requiredTools",
|
||||||
|
"_requiredParts",
|
||||||
|
"_upgrade",
|
||||||
|
"_upgradeConfig",
|
||||||
|
"_upgradeDisplayname",
|
||||||
|
"_onLadder",
|
||||||
|
"_isWater",
|
||||||
|
"_upgradeParts",
|
||||||
|
"_startUpgrade",
|
||||||
|
"_missingPartsConfig",
|
||||||
|
"_textMissingParts",
|
||||||
|
"_dis",
|
||||||
|
"_sfx",
|
||||||
|
"_ownerID",
|
||||||
|
"_objectID",
|
||||||
|
"_objectUID",
|
||||||
|
"_alreadyupgrading",
|
||||||
|
"_pos",
|
||||||
|
"_dir",
|
||||||
|
"_weapons",
|
||||||
|
"_magazines",
|
||||||
|
"_backpacks",
|
||||||
|
"_object",
|
||||||
|
"_objWpnTypes",
|
||||||
|
"_objWpnQty",
|
||||||
|
"_countr"
|
||||||
|
];
|
||||||
|
|
||||||
|
_objclass = _this;
|
||||||
|
_cursorTarget = _this select 3;
|
||||||
|
|
||||||
|
_item = typeof _cursorTarget;
|
||||||
|
//diag_log (str(_item));
|
||||||
|
|
||||||
|
//remove action menu
|
||||||
|
player removeAction s_player_upgradestroage;
|
||||||
|
s_player_upgradestroage = -1;
|
||||||
|
|
||||||
|
//Not needed
|
||||||
|
//_itemName = getText (configFile >> "CfgVehicles" >> _item >> "displayName");
|
||||||
|
////diag_log (str(_itemName));
|
||||||
|
|
||||||
|
//Get tools needed
|
||||||
|
_classname = configFile >> "CfgVehicles" >> _item;
|
||||||
|
_requiredTools = getArray (_classname >> "Upgrade" >> "requiredTools");
|
||||||
|
//diag_log (str(_requiredTools));
|
||||||
|
|
||||||
|
//get parts needed
|
||||||
|
_requiredParts = getArray (_classname >> "Upgrade" >> "requiredParts");
|
||||||
|
//diag_log (str(_requiredParts));
|
||||||
|
|
||||||
|
//get item to create
|
||||||
|
_upgrade = getText (_classname >> "Upgrade" >> "create");
|
||||||
|
//diag_log (str(_upgrade));
|
||||||
|
|
||||||
|
//Display name of upgrade part
|
||||||
|
_upgradeConfig = configFile >> "CfgVehicles" >> _upgrade;
|
||||||
|
//diag_log (str(_upgradeConfig));
|
||||||
|
_upgradeDisplayname = getText (_upgradeConfig >> "displayName");
|
||||||
|
//diag_log (str(_upgradeDisplayname));
|
||||||
|
//Normal blocked stuff
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
|
||||||
|
_upgradeParts = [];
|
||||||
|
_startUpgrade = true;
|
||||||
|
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
//cutText ["unable to upgrade at this time", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_CannotUpgrade";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
// lets check player has requiredTools for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN items player)) exitWith {
|
||||||
|
_missingPartsConfig = configFile >> "CfgWeapons" >> _x;
|
||||||
|
_textMissingParts = getText (_missingPartsConfig >> "displayName");
|
||||||
|
|
||||||
|
_msg = format ["Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
|
||||||
|
_startUpgrade = false;
|
||||||
|
};
|
||||||
|
} count _requiredTools;
|
||||||
|
|
||||||
|
// lets check player has requiredParts for upgrade
|
||||||
|
{
|
||||||
|
if (!(_x IN magazines player)) exitWith {
|
||||||
|
_missingPartsConfig = configFile >> "CfgMagazines" >> _x;
|
||||||
|
_textMissingParts = getText (_missingPartsConfig >> "displayName");
|
||||||
|
|
||||||
|
_msg = format ["Missing %1 to upgrade storage.", _textMissingParts];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
_startUpgrade = false;
|
||||||
|
};
|
||||||
|
if (_x IN magazines player) then {
|
||||||
|
_upgradeParts set [count _upgradeParts, _x];
|
||||||
|
};
|
||||||
|
} count _requiredParts;
|
||||||
|
|
||||||
|
|
||||||
|
//Does object have a upgrade option.
|
||||||
|
if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
|
||||||
|
//play animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
_dis = 20;
|
||||||
|
_sfx = "tentpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Added Nutrition-Factor for work
|
||||||
|
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
//get ownerID from old tent.
|
||||||
|
_ownerID = _cursorTarget getVariable ["characterID","0"];
|
||||||
|
_objectID = _cursorTarget getVariable ["ObjectID","0"];
|
||||||
|
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
|
||||||
|
|
||||||
|
//Upgrade
|
||||||
|
_alreadyupgrading = _cursorTarget getVariable["alreadyupgrading",0];
|
||||||
|
|
||||||
|
if (_alreadyupgrading == 1) exitWith {
|
||||||
|
//cutText [localize "str_upgradeInProgress", "PLAIN DOWN"]
|
||||||
|
_msg = localize "str_upgradeInProgress";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_cursorTarget setVariable["alreadyupgrading",1];
|
||||||
|
|
||||||
|
sleep 0.03;
|
||||||
|
|
||||||
|
//Get location and direction of old item
|
||||||
|
_dir = round getDir _cursorTarget;
|
||||||
|
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
|
||||||
|
|
||||||
|
//reset orientation before measuring position, otherwise the new object will be placed incorrectly. -foxy
|
||||||
|
_cursorTarget setDir 0;
|
||||||
|
_pos = getPosATL _cursorTarget;
|
||||||
|
|
||||||
|
diag_log [ "dir/angle/pos", _dir, _vector, _pos];
|
||||||
|
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
|
||||||
|
diag_log [ "dir/angle/pos - reset elevation if angle is straight", _dir, _vector, _pos];
|
||||||
|
|
||||||
|
//get contents
|
||||||
|
_weapons = getWeaponCargo _cursorTarget;
|
||||||
|
_magazines = getMagazineCargo _cursorTarget;
|
||||||
|
_backpacks = getBackpackCargo _cursorTarget;
|
||||||
|
|
||||||
|
//replay animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//remove old tent
|
||||||
|
PVDZ_obj_Destroy = [_objectID,_objectUID];
|
||||||
|
publicVariableServer "PVDZ_obj_Destroy";
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
PVDZ_obj_Destroy call server_deleteObj;
|
||||||
|
};
|
||||||
|
deleteVehicle _cursorTarget;
|
||||||
|
|
||||||
|
// remove parts from players inventory before creation of new tent.
|
||||||
|
{
|
||||||
|
player removeMagazine _x;
|
||||||
|
_upgradeParts = _upgradeParts - [_x];
|
||||||
|
} count _upgradeParts;
|
||||||
|
|
||||||
|
//create new tent
|
||||||
|
_object = createVehicle [_upgrade, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
|
//reseting orientation to make sure the object goes where it's supposed to -foxy
|
||||||
|
_object setDir 0;
|
||||||
|
_object setPosATL _pos;
|
||||||
|
_object setVectorDirAndUp _vector;
|
||||||
|
|
||||||
|
//set ownerID from old tent.
|
||||||
|
_object setVariable ["characterID",_ownerID];
|
||||||
|
|
||||||
|
//Make sure player knows about the new object
|
||||||
|
player reveal _object;
|
||||||
|
|
||||||
|
//Add contents back
|
||||||
|
//Add Weapons
|
||||||
|
_objWpnTypes = _weapons select 0;
|
||||||
|
_objWpnQty = _weapons select 1;
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
_object addweaponcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||||
|
_countr = _countr + 1;
|
||||||
|
} count _objWpnTypes;
|
||||||
|
|
||||||
|
//Add Magazines
|
||||||
|
_objWpnTypes = _magazines select 0;
|
||||||
|
_objWpnQty = _magazines select 1;
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
_object addmagazinecargoGlobal [_x,(_objWpnQty select _countr)];
|
||||||
|
_countr = _countr + 1;
|
||||||
|
} count _objWpnTypes;
|
||||||
|
|
||||||
|
//Add Backpacks
|
||||||
|
_objWpnTypes = _backpacks select 0;
|
||||||
|
_objWpnQty = _backpacks select 1;
|
||||||
|
_countr = 0;
|
||||||
|
{
|
||||||
|
_object addbackpackcargoGlobal [_x,(_objWpnQty select _countr)];
|
||||||
|
_countr = _countr + 1;
|
||||||
|
} count _objWpnTypes;
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
|
||||||
|
//publish new tent
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],[_weapons,_magazines,_backpacks]];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
|
||||||
|
//cutText [localize "str_upgradeDone", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_upgradeDone";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
/*
|
||||||
|
} else {
|
||||||
|
cutText ["Object has no upgrade option.", "PLAIN DOWN"];
|
||||||
|
*/
|
||||||
|
};
|
||||||
179
SQF/dayz_code/actions/object_upgradebuilding.sqf
Normal file
179
SQF/dayz_code/actions/object_upgradebuilding.sqf
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
/*
|
||||||
|
This script is not part of dayz permission must be given to use. r4z0r49@gmail.com or skype me R4Z0R49.
|
||||||
|
|
||||||
|
Simple class system to use this script.
|
||||||
|
class Upgrade {
|
||||||
|
requiredTools[] = {"ItemToolbox"};
|
||||||
|
requiredParts[] = {"equip_crate","PartWoodPile"};
|
||||||
|
create = "TentStorage1";
|
||||||
|
};
|
||||||
|
|
||||||
|
debugged by facoptere@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
//systemchat str _this;
|
||||||
|
if (!isnil "faco_object_upgradeBuilding") exitWith { _this call faco_object_upgradeBuilding };
|
||||||
|
|
||||||
|
_cursorTarget = _this select 3;
|
||||||
|
// ArmaA2 bug workaround: sometimes the object is null
|
||||||
|
if ((isNil "_cursorTarget") or {(isNull _cursorTarget)}) then {
|
||||||
|
_cursorTarget = nearestObjects [ player modelToWorld [0,1.5,0] , ["DZ_buildables","BuiltItems"], 1.5];
|
||||||
|
_cursorTarget = if (count _cursorTarget == 0) then { objNull } else { _cursorTarget select 0 };
|
||||||
|
};
|
||||||
|
if (isNull _cursorTarget) exitWith {};
|
||||||
|
|
||||||
|
player removeAction s_player_building;
|
||||||
|
s_player_building = -1;
|
||||||
|
|
||||||
|
_type = typeof _cursorTarget;
|
||||||
|
_class = configFile >> "CfgVehicles" >> _type;
|
||||||
|
_requiredTools = getArray (_class >> "Upgrade" >> "requiredTools");
|
||||||
|
_requiredParts = getArray (_class >> "Upgrade" >> "requiredParts");
|
||||||
|
_upgradeType = getText (_class >> "Upgrade" >> "create");
|
||||||
|
_producedParts = getArray (_class >> "Upgrade" >> "produce");
|
||||||
|
|
||||||
|
//Allow random choice of items if specified.
|
||||||
|
if (isArray(configFile >> "CfgVehicles" >> _type >> "Upgrade" >> "randomcreate")) then {
|
||||||
|
_randomCreate = getArray (_class >> "Upgrade" >> "randomcreate");
|
||||||
|
_upgradeType = _randomCreate call BIS_fnc_selectRandom;
|
||||||
|
};
|
||||||
|
|
||||||
|
_upgradeClass = configFile >> "CfgVehicles" >> _upgradeType;
|
||||||
|
if (!isClass _upgradeClass) exitWith {
|
||||||
|
//cutText [localize "str_upgradeNoOption", "PLAIN DOWN"];
|
||||||
|
_msg = localize "str_upgradeNoOption";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
_isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
|
||||||
|
if(_isWater or _onLadder) exitWith {
|
||||||
|
//systemchat[localize "str_CannotUpgrade"];
|
||||||
|
_msg = localize "str_CannotUpgrade";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
// lets check player has requiredTools for upgrade
|
||||||
|
_ok = true;
|
||||||
|
_missing = "";
|
||||||
|
{
|
||||||
|
if (!(_x IN items player)) exitWith {
|
||||||
|
//systemchat("Missing tools for upgrade." +str());
|
||||||
|
_missing = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||||
|
_ok = false;
|
||||||
|
};
|
||||||
|
} count _requiredTools;
|
||||||
|
if (!_ok) exitWith {
|
||||||
|
//systemChat format[localize "str_upgradeMissingTool", _missing]; //"Missing %1 to upgrade building."
|
||||||
|
_msg = format [localize "str_upgradeMissingTool", _missing];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
// lets check player has requiredParts for upgrade
|
||||||
|
_ok = true;
|
||||||
|
_upgradeParts = [];
|
||||||
|
{
|
||||||
|
if (!(_x IN magazines player)) exitWith {
|
||||||
|
_missing = getText (configFile >> "CfgMagazines" >> _x >> "displayName");
|
||||||
|
_ok = false;
|
||||||
|
};
|
||||||
|
if (_x IN magazines player) then {
|
||||||
|
_upgradeParts set [count _upgradeParts, _x];
|
||||||
|
player removeMagazine _x;
|
||||||
|
};
|
||||||
|
} count _requiredParts;
|
||||||
|
if (!_ok) exitWith {
|
||||||
|
{ player addMagazine _x; } foreach _upgradeParts;
|
||||||
|
//systemChat format[localize "str_upgradeMissingPart", _missing]; //"Missing %1 to upgrade building."
|
||||||
|
_msg = format [localize "str_upgradeMissingPart", _missing];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Upgrade Started
|
||||||
|
if ((player getVariable["alreadyBuilding",0]) == 1) exitWith {
|
||||||
|
{ player addMagazine _x; } foreach _upgradeParts;
|
||||||
|
//cutText [localize "str_upgradeInProgress" , "PLAIN DOWN"]
|
||||||
|
_msg = localize "str_upgradeInProgress";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
player setVariable["alreadyBuilding",1];
|
||||||
|
|
||||||
|
//play animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
_dis=20;
|
||||||
|
[player,"tentpack",0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Added Nutrition-Factor for work
|
||||||
|
["Working",0,[100,15,5,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
//wait animation end
|
||||||
|
waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 1};
|
||||||
|
waitUntil {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "disableWeapons") == 0};
|
||||||
|
|
||||||
|
//get data from old building.
|
||||||
|
_characterID = _cursorTarget getVariable ["characterID","0"];
|
||||||
|
_objectID = _cursorTarget getVariable ["ObjectID","0"];
|
||||||
|
_objectUID = _cursorTarget getVariable ["ObjectUID","0"];
|
||||||
|
//Person who owns the fence can be disa,abled by this person.
|
||||||
|
_ownerArray = _cursorTarget getVariable ["ownerArray",[]];
|
||||||
|
//Get passcode of fence.
|
||||||
|
_ownerPasscode = _cursorTarget getVariable ["padlockCombination",[]];
|
||||||
|
_dir = round getDir _cursorTarget;
|
||||||
|
_vector = [vectorDir _cursorTarget,vectorUp _cursorTarget];
|
||||||
|
_pos = getposATL _cursorTarget;
|
||||||
|
//diag_log [ "dir/angle/pos", _dir, _vector, _pos];
|
||||||
|
if (abs(((_vector select 1) select 2) - 1) > 0.001) then { _pos set [2,0]; };
|
||||||
|
//diag_log [ "dir/angle/pos - reset elevation if angle is straight", _dir, _vector, _pos];
|
||||||
|
|
||||||
|
_object = createVehicle [_upgradeType, getMarkerpos "respawn_west", [], 0, "CAN_COLLIDE"];
|
||||||
|
if (_object isKindOf "DZ_buildables") then { _object allowDamage false; };
|
||||||
|
_object setVectorDirAndUp _vector;
|
||||||
|
_object setPosATL _pos;
|
||||||
|
_puid = getPlayerUID player;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (!(_puid in _clanArray)) then {
|
||||||
|
_clanArray set [ count _clanArray, _puid ];
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
_object setVariable ["ownerArray",_ownerArray,true];
|
||||||
|
_object setVariable ["padlockCombination",_ownerPasscode,true];
|
||||||
|
_object setVariable ["characterID",_characterID,true];
|
||||||
|
|
||||||
|
//remove old object
|
||||||
|
deleteVehicle _cursorTarget;
|
||||||
|
PVDZ_obj_Destroy = [_objectID,_objectUID];
|
||||||
|
publicVariableServer "PVDZ_obj_Destroy";
|
||||||
|
|
||||||
|
// create a weaponholder with dismissed parts
|
||||||
|
_wh = "WeaponHolder" createVehicle (getPosATL player);
|
||||||
|
{
|
||||||
|
if (isClass (configFile >> "CfgMagazines" >> _x))
|
||||||
|
then { _wh addMagazineCargoGlobal [_x, 1]; }
|
||||||
|
else { _wh addWeaponCargoGlobal [_x, 1]; };
|
||||||
|
} forEach _producedParts;
|
||||||
|
|
||||||
|
//publish new object
|
||||||
|
_variables = [["ownerArray", _ownerArray],["padlockCombination", _ownerPasscode]];
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_object,[_dir, _pos],_variables];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
/*
|
||||||
|
//Send maintenance info
|
||||||
|
PVDZ_veh_Save = [_object,"maintenance"];
|
||||||
|
publicVariableServer "PVDZ_veh_Save";
|
||||||
|
if (isServer) then {
|
||||||
|
PVDZ_veh_Save call server_updateObject;
|
||||||
|
};*/
|
||||||
|
|
||||||
|
//Make sure player knows about the new object
|
||||||
|
player reveal _object;
|
||||||
|
|
||||||
|
//Make sure its unlocked
|
||||||
|
player setVariable["alreadyBuilding",0];
|
||||||
|
//cutText [localize "str_upgradeDone", "PLAIN DOWN"];
|
||||||
|
|
||||||
|
_msg = localize "str_upgradeDone";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
11
SQF/dayz_code/actions/openGear.sqf
Normal file
11
SQF/dayz_code/actions/openGear.sqf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
private ["_unit","_unconcious","_inVeh","_alive"];
|
||||||
|
call fnc_usec_medic_removeActions;
|
||||||
|
_unit = _this select 3;
|
||||||
|
_unconcious = _unit getVariable ["NORRN_unconscious", false];
|
||||||
|
_inVeh = vehicle player != player;
|
||||||
|
_alive = alive _unit;
|
||||||
|
|
||||||
|
|
||||||
|
if (_unconcious && !_inVeh && _alive) then {
|
||||||
|
player action ["Gear", _unit];
|
||||||
|
};
|
||||||
79
SQF/dayz_code/actions/player_Constructionitem.sqf
Normal file
79
SQF/dayz_code/actions/player_Constructionitem.sqf
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
Created by Alby exclusively for DayZMod.
|
||||||
|
Please request permission to use/alter from Alby.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private["_config","_input","_output","_required","_failChance","_hasInput","_availabeSpace"];
|
||||||
|
disableSerialization;
|
||||||
|
["close"] call fn_updateCraftUI;
|
||||||
|
|
||||||
|
_config = _this select 0;
|
||||||
|
_overwrite = _this select 1;
|
||||||
|
_input = getArray (_config >> "input");
|
||||||
|
_required = getArray (_config >> "toolsRequired");
|
||||||
|
_orignalClass = getText (_config >> "orignalclass");
|
||||||
|
|
||||||
|
|
||||||
|
//diag_log (str(_this));
|
||||||
|
|
||||||
|
if (count _overwrite > 0) then {
|
||||||
|
{
|
||||||
|
_index = _x select 0;
|
||||||
|
_entry = _x select 1;
|
||||||
|
_input set [_index, _entry];
|
||||||
|
}forEach _overwrite;
|
||||||
|
};
|
||||||
|
|
||||||
|
//done from player inventory
|
||||||
|
_hasInput = true;
|
||||||
|
{
|
||||||
|
private ["_avail"];
|
||||||
|
_selection = _x select 1;
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
|
||||||
|
switch (_selection) do {
|
||||||
|
case "CfgWeapons":
|
||||||
|
{
|
||||||
|
_avail = {_x == _item} count weapons player;
|
||||||
|
};
|
||||||
|
case "CfgMagazines":
|
||||||
|
{
|
||||||
|
_avail = {_x == _item} count magazines player;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_avail < _amount) exitWith {
|
||||||
|
_hasInput = false;
|
||||||
|
_itemName = getText(configFile >> _selection >> _item >> "displayName");
|
||||||
|
cutText [format [localize "str_crafting_missing",(_amount - _avail),_itemName], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
} forEach (_input + _required);
|
||||||
|
|
||||||
|
if (_hasInput) then {
|
||||||
|
_freeSlots = [player] call BIS_fnc_invSlotsEmpty;
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
_slotType = [_item] call BIS_fnc_invSlotType;
|
||||||
|
for "_i" from 1 to _amount do {
|
||||||
|
for "_j" from 1 to (count _slotType) do {
|
||||||
|
if ((_slotType select _j) > 0) then {
|
||||||
|
_freeSlots set[_j, ((_freeSlots select _j) + (_slotType select _j))];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _input;
|
||||||
|
|
||||||
|
_availabeSpace = true;
|
||||||
|
//sleep 1;
|
||||||
|
|
||||||
|
if (_availabeSpace) then {
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
|
||||||
|
//Hack to get craft menu to use build needs a good tidy up
|
||||||
|
[_orignalClass,"Build","ItemActions"] spawn player_build;
|
||||||
|
r_action_count = r_action_count + 1;
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
28
SQF/dayz_code/actions/player_addtoBack.sqf
Normal file
28
SQF/dayz_code/actions/player_addtoBack.sqf
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
private ["_item","_config","_onLadder","_hastoolweapon","_text"];
|
||||||
|
|
||||||
|
_item = _this;
|
||||||
|
_config = configFile >> "cfgWeapons" >> _item;
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
if (_onLadder) exitWith {cutText [localize "str_player_21", "PLAIN DOWN"]};
|
||||||
|
|
||||||
|
_hastoolweapon = _item in weapons player;
|
||||||
|
_text = getText (_config >> "displayName");
|
||||||
|
if (!_hastoolweapon) exitWith {cutText [format [localize "str_player_30",_text] , "PLAIN DOWN"]};
|
||||||
|
if (dayZ_OnBack != "") exitWith {closeDialog 0; cutText [format [localize "str_player_toback_fail",_text] , "PLAIN DOWN"]};
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
if (_item in ["ItemHatchet","ItemCrowbar","ItemMachete","ItemFishingPole"]) then {
|
||||||
|
//free primary slot for new melee (remember item to add after)
|
||||||
|
switch (_item) do {
|
||||||
|
case "ItemHatchet": {player removeWeapon "ItemHatchet"; dayz_onBack = "MeleeHatchet";};
|
||||||
|
case "ItemCrowbar": {player removeWeapon "ItemCrowbar"; dayz_onBack = "MeleeCrowbar";};
|
||||||
|
case "ItemMachete": {player removeWeapon "ItemMachete"; dayz_onBack = "MeleeMachete";};
|
||||||
|
case "ItemFishingPole": {player removeWeapon "ItemFishingPole"; dayz_onBack = "MeleeFishingPole";};
|
||||||
|
};
|
||||||
|
disableSerialization;
|
||||||
|
[[(findDisplay 106)],"onLBSelChanged"] execVM "\z\addons\dayz_code\system\handleGear.sqf"; //update back
|
||||||
|
|
||||||
|
};
|
||||||
101
SQF/dayz_code/actions/player_attachAttachment.sqf
Normal file
101
SQF/dayz_code/actions/player_attachAttachment.sqf
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
Attempts to attach attachment to the player's primary weapon or sidearm.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
string attachment item classname
|
||||||
|
integer type of weapon: 1 if primary, 0 if secondary
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\util\Player.hpp"
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_attachment",
|
||||||
|
"_weapon",
|
||||||
|
"_config",
|
||||||
|
"_newWeapon",
|
||||||
|
"_weaponInUse",
|
||||||
|
"_muzzle"
|
||||||
|
];
|
||||||
|
|
||||||
|
//check if player is on a ladder and if so, exit
|
||||||
|
if (Player_IsOnLadder()) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
(localize "str_player_21") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//name of attachment item
|
||||||
|
_attachment = _this select 0;
|
||||||
|
|
||||||
|
if (!(_attachment in magazines player)) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
"You seem to have misplaced the attachment." call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Get player's primary weapon or sidearm
|
||||||
|
_weapon = if ((_this select 1) == 1)
|
||||||
|
then { primaryWeapon player }
|
||||||
|
else { _weapon = Player_GetSidearm(); if (isNil "_weapon") then { "" } else { _weapon } };
|
||||||
|
|
||||||
|
//check if player has the weapon
|
||||||
|
if (_weapon == "") exitWith
|
||||||
|
{
|
||||||
|
closedialog 0;
|
||||||
|
|
||||||
|
localize
|
||||||
|
(
|
||||||
|
if ((_this select 1) == 1)
|
||||||
|
then {"str_AttachmentmissingWeapon"}
|
||||||
|
else {"str_AttachmentmissingWeapon2"}
|
||||||
|
) call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//retrieve Attachments class config
|
||||||
|
_config = configFile >> "CfgWeapons" >> _weapon >> "Attachments";
|
||||||
|
|
||||||
|
//check that weapon has Attachments class and attachments class has <_attachment> field.
|
||||||
|
if (!isClass(_config) || {!isText(_config >> _attachment)}) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
|
||||||
|
localize
|
||||||
|
(
|
||||||
|
if ((_this select 1) == 1)
|
||||||
|
then {"str_AttachmentWeaponConfig"}
|
||||||
|
else {"str_AttachmentWeaponConfig2"}
|
||||||
|
) call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_newWeapon = getText (_config >> _attachment);
|
||||||
|
_weaponInUse = (currentWeapon player == _weapon);
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//remove attachment from inventory and replace weapon
|
||||||
|
player removeMagazine _attachment;
|
||||||
|
player removeWeapon _weapon;
|
||||||
|
player addWeapon _newWeapon;
|
||||||
|
|
||||||
|
//close gear
|
||||||
|
(findDisplay 106) closeDisplay 0;
|
||||||
|
|
||||||
|
//Select new weapon if the old was in use
|
||||||
|
if (_weaponInUse) then
|
||||||
|
{
|
||||||
|
_muzzle = (getArray (configFile >> "CfgWeapons" >> _newWeapon >> "muzzles")) select 0;
|
||||||
|
|
||||||
|
if (_muzzle == "this") then
|
||||||
|
{
|
||||||
|
player selectWeapon _newWeapon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player selectWeapon _muzzle;
|
||||||
|
};
|
||||||
|
};
|
||||||
37
SQF/dayz_code/actions/player_attach_bomb.sqf
Normal file
37
SQF/dayz_code/actions/player_attach_bomb.sqf
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
private["_theBomb","_vehicle","_curFuel","_newFuel","_timeLeft","_hasToolbox","_hasCarBomb","_dis","_sfx","_alreadyBombed","_hasCrowbar"];
|
||||||
|
_vehicle = _this select 3;
|
||||||
|
_hasToolbox = "ItemToolbox" in items player;
|
||||||
|
_hasCrowbar = "ItemCrowbar" in items player;
|
||||||
|
_hasCarBomb = "ItemCarBomb" in magazines player;
|
||||||
|
_alreadyBombed = _vehicle getVariable["hasBomb",false];
|
||||||
|
if(!_hasToolbox or !_hasCrowbar) exitWith {
|
||||||
|
cutText [localize "str_bombToolMissing", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
if(!_hasCarBomb) exitWith {
|
||||||
|
cutText [localize "str_bombMissing", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(_vehicle getVariable["hasBomb",false]) exitWith {
|
||||||
|
cutText [localize "str_bombAlready", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
player removeMagazine "ItemCarBomb";
|
||||||
|
|
||||||
|
//wait a bit
|
||||||
|
player playActionNow "Medic";
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
|
//DO Animation
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "tentunpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
|
||||||
|
//Send the Eventhandler to Server
|
||||||
|
if(!_alreadyBombed) then {
|
||||||
|
PVDZ_dayzCarBomb = [_vehicle,getPlayerUID player];
|
||||||
|
publicVariableServer "PVDZ_dayzCarBomb";
|
||||||
|
};
|
||||||
|
cutText [localize "str_bombAttached", "PLAIN DOWN"];
|
||||||
153
SQF/dayz_code/actions/player_breakin.sqf
Normal file
153
SQF/dayz_code/actions/player_breakin.sqf
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
private ["_target", "_pos", "_gps", "_vars", "_hasToolbox", "_hasCrowbar", "_limit", "_proceed", "_counter", "_dis", "_sfx", "_roll", "_animState", "_started", "_finished", "_animState", "_isMedic","_isGate"];
|
||||||
|
|
||||||
|
_target = _this select 3;
|
||||||
|
_pos = getPos _target;
|
||||||
|
_isGate = (typeOf cursorTarget) in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"];
|
||||||
|
_limit = 2 + round(random 3);
|
||||||
|
|
||||||
|
_hasSledgeHammer = "ItemSledgeHammer" in items player;
|
||||||
|
_hasCrowbar = "ItemCrowbar" in items player;
|
||||||
|
|
||||||
|
if (!_hasSledgeHammer) exitWith {
|
||||||
|
titleText ["You need a SledgeHammer to break into this compound" , "PLAIN DOWN"];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_hasCrowbar) exitWith {
|
||||||
|
titleText ["You need a crowbar to break into this compound." , "PLAIN DOWN"];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_isOk = true;
|
||||||
|
_proceed = false;
|
||||||
|
_counter = 0;
|
||||||
|
_brokein = false;
|
||||||
|
|
||||||
|
while {_isOk} do {
|
||||||
|
//Check if we have the tools to start
|
||||||
|
_hasSledgeHammer = "ItemSledgeHammer" in items player;
|
||||||
|
_hasCrowbar = "ItemCrowbar" in items player;
|
||||||
|
|
||||||
|
if (!_hasSledgeHammer) exitWith {
|
||||||
|
_proceed = nil;
|
||||||
|
titleText ["You need a sledge hammer to break into a gate." , "PLAIN DOWN"];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_hasCrowbar) exitWith {
|
||||||
|
_proceed = nil;
|
||||||
|
titleText ["You need a crowbar to break into a gate." , "PLAIN DOWN"];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Run animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//Run SFX
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "repair";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
|
||||||
|
//Setup Vars
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
|
||||||
|
//run animation loop
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = false;
|
||||||
|
};
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
//Interrupt and end
|
||||||
|
if(!_finished) exitWith {
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Everything happened as it should
|
||||||
|
if(_finished) then {
|
||||||
|
//Add to Counter
|
||||||
|
_counter = _counter + 1;
|
||||||
|
|
||||||
|
|
||||||
|
//start chance to gain access.
|
||||||
|
if ([0.01] call fn_chance) then {
|
||||||
|
//stop loop
|
||||||
|
_isOk = false;
|
||||||
|
//Set Done var
|
||||||
|
_proceed = true;
|
||||||
|
if (_isGate) then {
|
||||||
|
_brokein = true;
|
||||||
|
_target setVariable ["isOpen", "1", true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//Chances to damage tools
|
||||||
|
if ([0.02] call fn_chance) then {
|
||||||
|
player removeWeapon "ItemSledgeHammer";
|
||||||
|
player addWeapon "ItemSledgeHammerBroken";
|
||||||
|
titleText ["Your SledgeHammer handle has snapped." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
if ([0.04] call fn_chance) then {
|
||||||
|
player removeWeapon "ItemCrowbar";
|
||||||
|
player addWeapon "ItemCrowbarBent";
|
||||||
|
titleText ["Your crowbar has bent." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_counter == _limit) exitWith {
|
||||||
|
//stop loop
|
||||||
|
_isOk = false;
|
||||||
|
//Set Done var
|
||||||
|
_proceed = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
titleText [format["Breaking into compound, attempt (%1 of %2).", _counter,_limit], "PLAIN DOWN"];
|
||||||
|
sleep 0.03;
|
||||||
|
};
|
||||||
|
//Tool issues
|
||||||
|
if (isnil "_proceed") exitwith {};
|
||||||
|
|
||||||
|
//Interrupted for some reason
|
||||||
|
if (!_proceed) then {
|
||||||
|
r_interrupt = false;
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
};
|
||||||
|
titleText ["Break in cancelled." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Working-Factor for chopping wood.
|
||||||
|
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
//Completed but no success.
|
||||||
|
if (_proceed and !_brokein) then {
|
||||||
|
titleText [format["Break in attempt completed with little success", _counter,_limit], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
//Completed and successful
|
||||||
|
if (_proceed and _brokein) then {
|
||||||
|
titleText ["Break in attempt successful.", "PLAIN DOWN", 0.3];
|
||||||
|
|
||||||
|
//Open Gate.
|
||||||
|
_target animate ["DoorR", 0];
|
||||||
|
_target animate ["DoorL", 0];
|
||||||
|
};
|
||||||
71
SQF/dayz_code/actions/player_checkConstructionRecipe.sqf
Normal file
71
SQF/dayz_code/actions/player_checkConstructionRecipe.sqf
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
Created by Alby exclusively for DayZMod.
|
||||||
|
Please request permission to use/alter from Alby.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_items","_counts","_config","_isRecipe","_item","_index","_amount","_count","_entry","_input","_array"];
|
||||||
|
disableSerialization;
|
||||||
|
|
||||||
|
_array = _this select 0;
|
||||||
|
_items = _array select 0;
|
||||||
|
_counts = _array select 1;
|
||||||
|
_overwrite = [];
|
||||||
|
_config = configFile >> "CfgConstruction";
|
||||||
|
//diag_log (str(_this));
|
||||||
|
//diag_log format["Items: %1 Counts: %2 Config: %3", _items, _counts, _config];
|
||||||
|
|
||||||
|
for "_i" from 0 to ((count _config) - 1) do {
|
||||||
|
_entry = _config select _i;
|
||||||
|
_input = getArray (_entry >> "input");
|
||||||
|
//diag_log format["Recipe: %1 Input: %2", _entry, _input];
|
||||||
|
if (count _input > 0) then {
|
||||||
|
_isRecipe = true;
|
||||||
|
_inputIndex = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
//Check to see if _x is array of arrays
|
||||||
|
_inputItems = _x;
|
||||||
|
if (typeName (_x select 0) != "ARRAY") then {
|
||||||
|
_inputItems = [_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
//Handles OR type of input
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_index = _items find _item;
|
||||||
|
//diag_log format["Item: %1 Index: %2", _item, _index];
|
||||||
|
|
||||||
|
if (_index > -1) then {
|
||||||
|
_amount = _x select 2;
|
||||||
|
_count = _counts select _index;
|
||||||
|
//diag_log format["Amount: %1 Count: %2", _amount, _count];
|
||||||
|
|
||||||
|
if (_count >= _amount) then {
|
||||||
|
if (count _inputItems > 1) then {
|
||||||
|
_overwrite set [count _overwrite,[_inputIndex, [_item, _x select 1, _amount]]];
|
||||||
|
};
|
||||||
|
_isRecipe = true;
|
||||||
|
} else {
|
||||||
|
_isRecipe = false;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_isRecipe = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_isRecipe) exitWith {};
|
||||||
|
|
||||||
|
}forEach _inputItems;
|
||||||
|
|
||||||
|
if (!_isRecipe) exitWith {};
|
||||||
|
|
||||||
|
_inputIndex = _inputIndex + 1;
|
||||||
|
}forEach _input;
|
||||||
|
|
||||||
|
if (_isRecipe) exitWith {
|
||||||
|
//diag_log format["Items: %1 Recipe: %2", _this, _entry];
|
||||||
|
[_entry, _overwrite] call player_craftItemGUI;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["Exited with Items: %1", _array];
|
||||||
71
SQF/dayz_code/actions/player_checkRecipe.sqf
Normal file
71
SQF/dayz_code/actions/player_checkRecipe.sqf
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
Created by Alby exclusively for DayZMod.
|
||||||
|
Please request permission to use/alter from Alby.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_items","_counts","_config","_isRecipe","_item","_index","_amount","_count","_entry","_input","_array"];
|
||||||
|
disableSerialization;
|
||||||
|
|
||||||
|
_array = _this select 0;
|
||||||
|
_items = _array select 0;
|
||||||
|
_counts = _array select 1;
|
||||||
|
_overwrite = [];
|
||||||
|
_config = configFile >> "CfgCrafting";
|
||||||
|
//diag_log (str(_this));
|
||||||
|
//diag_log format["Items: %1 Counts: %2 Config: %3", _items, _counts, _config];
|
||||||
|
|
||||||
|
for "_i" from 0 to ((count _config) - 1) do {
|
||||||
|
_entry = _config select _i;
|
||||||
|
_input = getArray (_entry >> "input");
|
||||||
|
//diag_log format["Recipe: %1 Input: %2", _entry, _input];
|
||||||
|
if (count _input > 0) then {
|
||||||
|
_isRecipe = true;
|
||||||
|
_inputIndex = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
//Check to see if _x is array of arrays
|
||||||
|
_inputItems = _x;
|
||||||
|
if (typeName (_x select 0) != "ARRAY") then {
|
||||||
|
_inputItems = [_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
//Handles OR type of input
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_index = _items find _item;
|
||||||
|
//diag_log format["Item: %1 Index: %2", _item, _index];
|
||||||
|
|
||||||
|
if (_index > -1) then {
|
||||||
|
_amount = _x select 2;
|
||||||
|
_count = _counts select _index;
|
||||||
|
//diag_log format["Amount: %1 Count: %2", _amount, _count];
|
||||||
|
|
||||||
|
if (_count >= _amount) then {
|
||||||
|
if (count _inputItems > 1) then {
|
||||||
|
_overwrite set [count _overwrite,[_inputIndex, [_item, _x select 1, _amount]]];
|
||||||
|
};
|
||||||
|
_isRecipe = true;
|
||||||
|
} else {
|
||||||
|
_isRecipe = false;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_isRecipe = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_isRecipe) exitWith {};
|
||||||
|
|
||||||
|
}forEach _inputItems;
|
||||||
|
|
||||||
|
if (!_isRecipe) exitWith {};
|
||||||
|
|
||||||
|
_inputIndex = _inputIndex + 1;
|
||||||
|
}forEach _input;
|
||||||
|
|
||||||
|
if (_isRecipe) exitWith {
|
||||||
|
//diag_log format["Items: %1 Recipe: %2", _this, _entry];
|
||||||
|
[_entry, _overwrite] call player_craftItemGUI;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["Exited with Items: %1", _array];
|
||||||
167
SQF/dayz_code/actions/player_chopWood.sqf
Normal file
167
SQF/dayz_code/actions/player_chopWood.sqf
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
|
||||||
|
private["_item","_result","_dis","_sfx","_num", "_breaking"];
|
||||||
|
|
||||||
|
//if (!isnil "faco_player_chopWood") exitWith { _this call faco_player_chopWood };
|
||||||
|
|
||||||
|
_item = _this;
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 1;
|
||||||
|
_countOut = 3;
|
||||||
|
_woodCutting = false;
|
||||||
|
|
||||||
|
|
||||||
|
if (["forest",dayz_surfaceType] call fnc_inString) then {
|
||||||
|
_countOut = floor(random 3) + 2;
|
||||||
|
_woodCutting = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// allowed trees list move this later
|
||||||
|
_trees = ["ind_timbers.p3d","t_larix3s.p3d","t_pyrus2s.p3d","str_briza_kriva.p3d","dd_borovice.p3d","les_singlestrom_b.p3d","les_singlestrom.p3d","smrk_velky.p3d","smrk_siroky.p3d","smrk_maly.p3d","les_buk.p3d","str krovisko vysoke.p3d","str_fikovnik_ker.p3d","str_fikovnik.p3d","str vrba.p3d","hrusen2.p3d","str dub jiny.p3d","str lipa.p3d","str briza.p3d","p_akat02s.p3d","jablon.p3d","p_buk.p3d","str_topol.p3d","str_topol2.p3d","p_osika.p3d","t_picea3f.p3d","t_picea2s.p3d","t_picea1s.p3d","t_fagus2w.p3d","t_fagus2s.p3d","t_fagus2f.p3d","t_betula1f.p3d","t_betula2f.p3d","t_betula2s.p3d","t_betula2w.p3d","t_alnus2s.p3d","t_acer2s.p3d","t_populus3s.p3d","t_quercus2f.p3d","t_sorbus2s.p3d","t_malus1s.p3d","t_salix2s.p3d","t_picea1s_w.p3d","t_picea2s_w.p3d","t_ficusb2s_ep1.p3d","t_populusb2s_ep1.p3d","t_populusf2s_ep1.p3d","t_amygdalusc2s_ep1.p3d","t_ficusb2s_ep1.p3d","t_pistacial2s_ep1.p3d","t_pinuse2s_ep1.p3d","t_pinuss3s_ep1.p3d","t_prunuss2s_ep1.p3d","t_pinusn2s.p3d","t_pinusn1s.p3d","t_pinuss2f.p3d","t_poplar2f_dead_pmc.p3d","misc_torzotree_pmc.p3d","misc_burnspruce_pmc.p3d","brg_cocunutpalm8.p3d","brg_umbrella_acacia01b.p3d","brg_jungle_tree_canopy_1.p3d","brg_jungle_tree_canopy_2.p3d","brg_cocunutpalm4.p3d","brg_cocunutpalm3.p3d","palm_01.p3d","palm_02.p3d","palm_03.p3d","palm_04.p3d","palm_09.p3d","palm_10.p3d","brg_cocunutpalm2.p3d","brg_jungle_tree_antiaris.p3d","brg_cocunutpalm1.p3d"];
|
||||||
|
_findNearestTree = objNull;
|
||||||
|
|
||||||
|
{
|
||||||
|
_objInfo = toArray(str(_x));
|
||||||
|
_lenInfo = count _objInfo - 1;
|
||||||
|
_objName = [];
|
||||||
|
_i = 0;
|
||||||
|
// determine where the object name starts
|
||||||
|
{
|
||||||
|
if (58 == _objInfo select _i) exitWith {};
|
||||||
|
_i = _i + 1;
|
||||||
|
} forEach _objInfo;
|
||||||
|
_i = _i + 2; // skip the ": " part
|
||||||
|
|
||||||
|
for "_k" from _i to _lenInfo do {
|
||||||
|
_objName = _objName + [_objInfo select _k];
|
||||||
|
};
|
||||||
|
_objName = toLower(toString(_objName));
|
||||||
|
|
||||||
|
// Exit since we found a tree
|
||||||
|
if (_objName in _trees) exitWith { _findNearestTree = _x; };
|
||||||
|
} foreach nearestObjects [getPosATL player, [], 8];
|
||||||
|
|
||||||
|
_countOut = floor(random 3) + 2;
|
||||||
|
|
||||||
|
if (!isNull _findNearestTree) then {
|
||||||
|
_woodCutting = true;
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_23", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (_woodCutting) then {
|
||||||
|
//Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed)
|
||||||
|
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"];
|
||||||
|
|
||||||
|
// Start chop tree loop
|
||||||
|
_counter = 0;
|
||||||
|
_isOk = true;
|
||||||
|
_proceed = false;
|
||||||
|
|
||||||
|
while {_isOk} do {
|
||||||
|
//play action
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//setup alert and speak
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "chopwood";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Working-Factor for chopping wood.
|
||||||
|
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!_finished) exitWith {
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_finished) then {
|
||||||
|
_breaking = false;
|
||||||
|
if ([0.04] call fn_chance) then {
|
||||||
|
_breaking = true;
|
||||||
|
if ("MeleeHatchet" in weapons player) then {
|
||||||
|
player removeWeapon "MeleeHatchet";
|
||||||
|
} else {
|
||||||
|
if ("ItemHatchet" in weapons player) then {
|
||||||
|
player removeWeapon "ItemHatchet";
|
||||||
|
} else {
|
||||||
|
if (dayz_onBack == "MeleeHatchet") then {
|
||||||
|
dayz_onBack = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (!("ItemHatchetBroken" in weapons player)) then {
|
||||||
|
player addWeapon "ItemHatchetBroken";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_counter = _counter + 1;
|
||||||
|
_itemOut = "ItemLog";
|
||||||
|
//Drop Item to ground
|
||||||
|
_itemOut call fn_dropItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_counter == _countOut) || _breaking) exitWith {
|
||||||
|
if (_breaking) then {
|
||||||
|
cutText [localize "str_HatchetHandleBreaks", "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_24_Stoped", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = true;
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
cutText [format [localize "str_player_24_progress", _counter,_countOut], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_proceed) then {
|
||||||
|
if ("" == typeOf _findNearestTree) then {
|
||||||
|
//remove vehicle, Need to ask server to remove.
|
||||||
|
PVDZ_objgather_Knockdown = [_findNearestTree,player];
|
||||||
|
publicVariableServer "PVDZ_objgather_Knockdown";
|
||||||
|
};
|
||||||
|
//cutText [format["\n\nChopping down tree.], "PLAIN DOWN"];
|
||||||
|
//cutText [localize "str_player_25", "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_24_Stoped", "PLAIN DOWN"];
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//adding melee mags back if needed
|
||||||
|
switch (primaryWeapon player) do {
|
||||||
|
case "MeleeHatchet": {player addMagazine 'Hatchet_Swing';};
|
||||||
|
case "MeleeCrowbar": {player addMagazine 'Crowbar_Swing';};
|
||||||
|
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
|
||||||
|
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
|
||||||
|
};
|
||||||
|
};
|
||||||
86
SQF/dayz_code/actions/player_combineMags.sqf
Normal file
86
SQF/dayz_code/actions/player_combineMags.sqf
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
private ["_create","_config","_create_magsize","_type","_name","_magCount","_slotstart","_slotend","_dialog","_qty_total_ammo","_control","_mag","_qtynew_create_mags_full","_qtynew_create_ammo_rest","_magFull","_magFullSingular","_magAmmunition"];
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
|
||||||
|
if (r_action_count != 1) exitWith { cutText [localize "str_player_actionslimit", "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
_create = _this;
|
||||||
|
|
||||||
|
if (!(_create in magazines player)) exitWith {r_action_count = 0;};
|
||||||
|
|
||||||
|
_config = configFile >> "CfgMagazines" >> _create;
|
||||||
|
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
|
||||||
|
_create_magsize = getNumber(configFile >> "CfgMagazines" >> _create >> "count");
|
||||||
|
_type = getNumber(configFile >> "CfgMagazines" >> _create >> "type");
|
||||||
|
_name = getText(configFile >> "CfgMagazines" >> _create >> "displayName");
|
||||||
|
_magCount = {_x == _create} count magazines player;
|
||||||
|
|
||||||
|
if (_magCount == 1) exitWith {
|
||||||
|
cutText [format [localize "str_cannotCombine", _name], "PLAIN DOWN"];
|
||||||
|
r_action_count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//primary/secondary mags?
|
||||||
|
_slotstart = 0;
|
||||||
|
_slotend = 0;
|
||||||
|
if ((_type == 256) or (_type == 256*2)) then {
|
||||||
|
_slotstart = 109;
|
||||||
|
_slotend = 120;
|
||||||
|
};
|
||||||
|
if (_type == 16) then {
|
||||||
|
_slotstart = 122;
|
||||||
|
_slotend = 129;
|
||||||
|
};
|
||||||
|
|
||||||
|
_dialog = findDisplay 106;
|
||||||
|
|
||||||
|
_qty_total_ammo = 0;
|
||||||
|
for "_i" from _slotstart to _slotend do {
|
||||||
|
_control = _dialog displayCtrl _i;
|
||||||
|
_mag = gearSlotData _control;
|
||||||
|
if (_mag == _create) then {
|
||||||
|
_qty_total_ammo = _qty_total_ammo + gearSlotAmmoCount _control;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_qtynew_create_mags_full = 0;
|
||||||
|
_qtynew_create_ammo_rest = 0;
|
||||||
|
_qtynew_create_mags_full = floor(_qty_total_ammo/_create_magsize);
|
||||||
|
_qtynew_create_ammo_rest = _qty_total_ammo - (_qtynew_create_mags_full*_create_magsize);
|
||||||
|
|
||||||
|
player removeMagazines _create;
|
||||||
|
for "_i" from 1 to _qtynew_create_mags_full do {
|
||||||
|
player addMagazine _create;
|
||||||
|
};
|
||||||
|
if (_qtynew_create_ammo_rest != 0) then {
|
||||||
|
player addMagazine [_create,_qtynew_create_ammo_rest];
|
||||||
|
};
|
||||||
|
// Check if quiver
|
||||||
|
if(_create == "Quiver") then {
|
||||||
|
_magFull = "quivers";
|
||||||
|
_magFullSingular = "quiver";
|
||||||
|
_magAmmunition = "arrows";
|
||||||
|
} else {
|
||||||
|
_magFull = "magazines";
|
||||||
|
_magFullSingular = "magazine";
|
||||||
|
_magAmmunition = "bullets";
|
||||||
|
};
|
||||||
|
|
||||||
|
switch true do {
|
||||||
|
case (_qtynew_create_ammo_rest == 0) : {
|
||||||
|
cutText [format [localize "str_combineDoneFull",_magCount, _name, _qtynew_create_mags_full,_magFull], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
case (_qtynew_create_mags_full == 0) : {
|
||||||
|
cutText [format [localize "str_combineDonePartialOne",_magCount, _name, _qtynew_create_ammo_rest,_magAmmunition], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
cutText [format [localize "str_combineDonePartial",_magCount, _name, _qtynew_create_mags_full, _qtynew_create_ammo_rest,_magAmmunition,_magFullSingular,_magFull], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep 1;
|
||||||
|
r_action_count = 0;
|
||||||
139
SQF/dayz_code/actions/player_consume.sqf
Normal file
139
SQF/dayz_code/actions/player_consume.sqf
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
Player action for consuming items
|
||||||
|
|
||||||
|
Single parameter:
|
||||||
|
string item classname
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PILE_SEARCH_RADIUS 2
|
||||||
|
#define PILE_PLAYER_OFFSET [0,1,0]
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_cfg",
|
||||||
|
"_nutrition",
|
||||||
|
"_bloodRegen",
|
||||||
|
"_infectionChance",
|
||||||
|
"_sound",
|
||||||
|
"_output"
|
||||||
|
];
|
||||||
|
|
||||||
|
_cfg = (ConfigFile >> "CfgMagazines" >> _this);
|
||||||
|
|
||||||
|
//class doesn't exist
|
||||||
|
if (!isClass(_cfg)) exitWith
|
||||||
|
{
|
||||||
|
diag_log format ["DAYZ ERROR: Invalid magazine classname given to player_consume: %1", _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
//class isn't a consumable
|
||||||
|
if (!isArray(_cfg >> "Nutrition")) exitWith
|
||||||
|
{
|
||||||
|
diag_log format ["DAYZ ERROR: Non-consumable item classname given to player_consume: %1", _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
//player is on a ladder
|
||||||
|
if ((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1) exitWith
|
||||||
|
{
|
||||||
|
(localize "str_player_21") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//player doesn't have the consumable item
|
||||||
|
if (!(_this in magazines player)) exitWith
|
||||||
|
{
|
||||||
|
//TODO move to stringtable
|
||||||
|
"You seem to have misplaced the foodstuff." call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//close gear
|
||||||
|
(findDisplay 106) closeDisplay 0;
|
||||||
|
|
||||||
|
//if player is not in a vehicle play animation
|
||||||
|
if (vehicle player == player) then
|
||||||
|
{
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
};
|
||||||
|
|
||||||
|
//Remove consumed item
|
||||||
|
player removeMagazine _this;
|
||||||
|
|
||||||
|
//Get values from config
|
||||||
|
_nutrition = getArray (_cfg >> "Nutrition");
|
||||||
|
_bloodRegen = getNumber (_cfg >> "bloodRegen");
|
||||||
|
_infectionChance = getNumber (_cfg >> "infectionChance");
|
||||||
|
_sound = getText (_cfg >> "consumeSound");
|
||||||
|
_output = getText (_cfg >> "consumeOutput");
|
||||||
|
|
||||||
|
//Apply nutrition and blood regen
|
||||||
|
if (dayz_nutritionValuesSystem) then {
|
||||||
|
_hungerCount = _nutrition select 1;
|
||||||
|
_thirstCount = _nutrition select 2;
|
||||||
|
|
||||||
|
if (_hungerCount > 0) then { dayz_lastMeal = time; };
|
||||||
|
if (_thirstCount > 0) then { dayz_lastDrink = time; };
|
||||||
|
|
||||||
|
["FoodDrink",_bloodRegen,_nutrition] call dayz_NutritionSystem;
|
||||||
|
r_player_foodstack = r_player_foodstack + 1;
|
||||||
|
} else {
|
||||||
|
_hungerCount = _nutrition select 1;
|
||||||
|
_thirstCount = _nutrition select 2;
|
||||||
|
|
||||||
|
if (_hungerCount > 0) then { dayz_hunger = 0; dayz_lastMeal = time; };
|
||||||
|
if (_thirstCount > 0) then { dayz_thirst = 0; dayz_lastDrink = time; };
|
||||||
|
};
|
||||||
|
|
||||||
|
//Apply or cure infection base on infectionChance
|
||||||
|
if (_infectionChance != 0 && {abs(_infectionChance) > random 1}) then
|
||||||
|
{
|
||||||
|
if (_infectionChance > 0) then
|
||||||
|
{
|
||||||
|
r_player_infected = true;
|
||||||
|
player setVariable["USEC_infected",true,true];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r_player_infected = false;
|
||||||
|
player setVariable["USEC_infected",false,true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//Publish messing
|
||||||
|
player setVariable ["messing",[dayz_hunger,dayz_thirst,dayz_nutrition],false]; //No need to be sent to everyplayer
|
||||||
|
PVDZ_serverStoreVar = [player,"messing",[dayz_hunger,dayz_thirst,dayz_nutrition]]; //update server side only
|
||||||
|
publicVariableServer "PVDZ_serverStoreVar";
|
||||||
|
|
||||||
|
//Play sound and alert zombies
|
||||||
|
if (_sound != "") then
|
||||||
|
{
|
||||||
|
private ["_soundDistance"];
|
||||||
|
_soundDistance = getNumber (_cfg >> "consumeSoundDistance");
|
||||||
|
|
||||||
|
[player,_sound,0,false,_soundDistance] call dayz_zombieSpeak;
|
||||||
|
[player,_soundDistance,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
};
|
||||||
|
|
||||||
|
//If item has a consumeOutput item defined add that to player
|
||||||
|
//inventory or ground/vehicle inventory based on consumedDrop
|
||||||
|
if (_output != "") then
|
||||||
|
{
|
||||||
|
//if consumeDrop is false add output item to player inventory
|
||||||
|
if (getNumber (_cfg >> "consumeDrop") == 0) then
|
||||||
|
{
|
||||||
|
player addMagazine _output;
|
||||||
|
}
|
||||||
|
//consumeDrop is true so drop the output item on the ground
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//if player is not in a vehicle drop output item on the ground
|
||||||
|
if (vehicle player == player) then
|
||||||
|
{
|
||||||
|
//wait a while before dropping the output item
|
||||||
|
sleep 3;
|
||||||
|
//Drop Item to ground
|
||||||
|
_output call fn_dropItem;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
164
SQF/dayz_code/actions/player_craftitemGUI.sqf
Normal file
164
SQF/dayz_code/actions/player_craftitemGUI.sqf
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
/*
|
||||||
|
Created by Alby exclusively for DayZMod.
|
||||||
|
Please request permission to use/alter from Alby.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private["_config","_input","_output","_required","_failChance","_hasInput","_availabeSpace"];
|
||||||
|
disableSerialization;
|
||||||
|
["close"] call fn_updateCraftUI;
|
||||||
|
|
||||||
|
_config = _this select 0;
|
||||||
|
_overwrite = _this select 1;
|
||||||
|
_input = getArray (_config >> "input");
|
||||||
|
_output = getArray (_config >> "output");
|
||||||
|
_required = getArray (_config >> "required");
|
||||||
|
_failChance = getNumber (_config >> "failChance");
|
||||||
|
_nearByPile = nearestObjects [getPosATL player, ["SmallCraftTable_dz"], 3];
|
||||||
|
|
||||||
|
//diag_log (str(_this));
|
||||||
|
|
||||||
|
if (count _overwrite > 0) then {
|
||||||
|
{
|
||||||
|
_index = _x select 0;
|
||||||
|
_entry = _x select 1;
|
||||||
|
_input set [_index, _entry];
|
||||||
|
}forEach _overwrite;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (count _nearByPile > 0) then {
|
||||||
|
//done from craftingtable (ground)
|
||||||
|
//diag_log ("Table");
|
||||||
|
_nearByTable = nearestObjects [getPosATL player, ["SmallCraftTable_dz"], 3];
|
||||||
|
if (count _nearByTable > 0) then {
|
||||||
|
_weaps = getWeaponCargo (_nearByTable select 0);
|
||||||
|
_mags = getMagazineCargo (_nearByTable select 0);
|
||||||
|
|
||||||
|
//Add Magazines
|
||||||
|
_objMagTypes = _mags select 0;
|
||||||
|
_objMagQty = _mags select 1;
|
||||||
|
|
||||||
|
//diag_log format["%1, %2",_objMagTypes,_objMagQty];
|
||||||
|
|
||||||
|
for "_i" from 0 to (count _objMagTypes - 1) do {
|
||||||
|
_obj = _objMagTypes select _i;
|
||||||
|
_index = [_return, _obj] call _inArray;
|
||||||
|
|
||||||
|
//diag_log format["MagName: %1, %2",_obj,_index];
|
||||||
|
};
|
||||||
|
|
||||||
|
_hasInput = true;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
//done from player inventory
|
||||||
|
_hasInput = true;
|
||||||
|
{
|
||||||
|
private ["_avail"];
|
||||||
|
_selection = _x select 1;
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
|
||||||
|
switch (_selection) do {
|
||||||
|
case "CfgWeapons":
|
||||||
|
{
|
||||||
|
_avail = {_x == _item} count weapons player;
|
||||||
|
};
|
||||||
|
case "CfgMagazines":
|
||||||
|
{
|
||||||
|
_avail = {_x == _item} count magazines player;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_avail < _amount) exitWith {
|
||||||
|
_hasInput = false;
|
||||||
|
_itemName = getText(configFile >> _selection >> _item >> "displayName");
|
||||||
|
cutText [format [localize "str_crafting_missing",(_amount - _avail),_itemName], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
} forEach (_input + _required);
|
||||||
|
|
||||||
|
if (_hasInput) then {
|
||||||
|
_freeSlots = [player] call BIS_fnc_invSlotsEmpty;
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
_slotType = [_item] call BIS_fnc_invSlotType;
|
||||||
|
for "_i" from 1 to _amount do {
|
||||||
|
for "_j" from 1 to (count _slotType) do {
|
||||||
|
if ((_slotType select _j) > 0) then {
|
||||||
|
_freeSlots set[_j, ((_freeSlots select _j) + (_slotType select _j))];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _input;
|
||||||
|
|
||||||
|
_availabeSpace = true;
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
_slotType = [_item] call BIS_fnc_invSlotType;
|
||||||
|
for "_i" from 1 to _amount do {
|
||||||
|
for "_j" from 1 to (count _slotType) do {
|
||||||
|
if ((_slotType select _j) > 0) then {
|
||||||
|
_freeSlots set[_j, ((_freeSlots select _j) - (_slotType select _j))];
|
||||||
|
if (_freeSlots select _j < 0) exitWith {
|
||||||
|
_availabeSpace = false;
|
||||||
|
cutText [localize "str_crafting_space", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _output;
|
||||||
|
//sleep 1;
|
||||||
|
|
||||||
|
if (_availabeSpace) then {
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_amount = _x select 2;
|
||||||
|
for "_i" from 1 to _amount do {
|
||||||
|
_selection = _x select 1;
|
||||||
|
switch (_selection) do {
|
||||||
|
case "CfgWeapons":
|
||||||
|
{
|
||||||
|
player removeWeapon _item;
|
||||||
|
};
|
||||||
|
case "CfgMagazines":
|
||||||
|
{
|
||||||
|
player removeMagazine _item;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//sleep 0.1;
|
||||||
|
};
|
||||||
|
} forEach _input;
|
||||||
|
|
||||||
|
{
|
||||||
|
_item = _x select 0;
|
||||||
|
_selection = _x select 1;
|
||||||
|
_amount = _x select 2;
|
||||||
|
_itemName = getText(configFile >> _selection >> _item >> "displayName");
|
||||||
|
for "_i" from 1 to _amount do {
|
||||||
|
if (random 1 > _failChance) then {
|
||||||
|
switch (_selection) do {
|
||||||
|
case "CfgWeapons":
|
||||||
|
{
|
||||||
|
player addWeapon _item;
|
||||||
|
};
|
||||||
|
case "CfgMagazines":
|
||||||
|
{
|
||||||
|
player addMagazine _item;
|
||||||
|
};
|
||||||
|
case "CfgVehicles":
|
||||||
|
{
|
||||||
|
player addBackpack _item;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
cutText [format [localize "str_crafting_success",_itemName], "PLAIN DOWN"];
|
||||||
|
//sleep 2;
|
||||||
|
} else {
|
||||||
|
cutText [format [localize "str_crafting_failed",_itemName], "PLAIN DOWN"];
|
||||||
|
//sleep 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _output;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
16
SQF/dayz_code/actions/player_createQuiver.sqf
Normal file
16
SQF/dayz_code/actions/player_createQuiver.sqf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
private["_qty_arrows","_qty_quivers","_qty_quiverarrows"];
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
_qty_arrows = {_x == "WoodenArrow"} count magazines player;
|
||||||
|
_qty_quivers = {_x == "Quiver"} count magazines player;
|
||||||
|
|
||||||
|
//if (_qty_quivers > 0) exitWith { cutText [localize "str_quiver_reachlimit","PLAIN DOWN"];};
|
||||||
|
if (_qty_arrows < 2) exitWith { cutText [localize "str_quiver_notenougharrows","PLAIN DOWN"];}; //Not enough arrows to create quiver
|
||||||
|
|
||||||
|
_qty_quiverarrows = _qty_arrows min 6;
|
||||||
|
|
||||||
|
for "_x" from 1 to _qty_quiverarrows do {
|
||||||
|
player removeMagazine "WoodenArrow";
|
||||||
|
};
|
||||||
|
player addMagazine ["Quiver",_qty_quiverarrows];
|
||||||
|
cutText [format [localize "str_quiver_createsuccess",_qty_quiverarrows], "PLAIN DOWN"];
|
||||||
74
SQF/dayz_code/actions/player_createstash.sqf
Normal file
74
SQF/dayz_code/actions/player_createstash.sqf
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
private ["_playerPos","_item","_location","_config","_text","_dir","_dis","_sfx","_consumetext","_stashname","_stashtype","_stash","_consume","_hasitemcount","_worldspace"];
|
||||||
|
|
||||||
|
//check if can pitch here
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 1;
|
||||||
|
|
||||||
|
if (r_action_count != 1) exitWith { cutText [localize "str_player_actionslimit", "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
//Player Pos
|
||||||
|
_playerPos = getPosATL player;
|
||||||
|
|
||||||
|
//Classname
|
||||||
|
_item = _this;
|
||||||
|
|
||||||
|
//Config
|
||||||
|
_config = configFile >> "CFGWeapons" >> _item;
|
||||||
|
_text = getText (_config >> "displayName");
|
||||||
|
_stashtype = "0";
|
||||||
|
_consume = getText (_config >> "consume");
|
||||||
|
_consumetext = getText (configFile >> "CfgMagazines" >> _consume >> "displayName");
|
||||||
|
|
||||||
|
_hasitemcount = {_x == _consume} count magazines player;
|
||||||
|
|
||||||
|
if (_hasitemcount > 0) then { _stashtype = getText (_config >> "stashsmall"); };
|
||||||
|
_stashname = getText (configFile >> "CfgVehicles" >> _stashtype >> "displayName");
|
||||||
|
|
||||||
|
// Items are missing
|
||||||
|
if ((!(_consume IN magazines player))) exitWith {
|
||||||
|
r_action_count = 0;
|
||||||
|
cutText [format [localize "str_player_31_stash",_consumetext] , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
_location = player modeltoworld [0,2.5,0];
|
||||||
|
_location set [2,0];
|
||||||
|
|
||||||
|
//blocked
|
||||||
|
if (["concrete",dayz_surfaceType] call fnc_inString) exitwith {
|
||||||
|
r_action_count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
_worldspace = [_stashtype, player] call fn_niceSpot;
|
||||||
|
|
||||||
|
if ((count _worldspace) == 2) then {
|
||||||
|
player removeMagazine _consume;
|
||||||
|
_dir = round(direction player);
|
||||||
|
|
||||||
|
//wait a bit
|
||||||
|
player playActionNow "Medic";
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "tentunpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
sleep 5;
|
||||||
|
//place tent (local)
|
||||||
|
_stash = createVehicle [_stashtype, _location, [], 0, "CAN_COLLIDE"];
|
||||||
|
_stash setdir _dir;
|
||||||
|
_stash setposATL _location;
|
||||||
|
player reveal _stash;
|
||||||
|
|
||||||
|
_stash setVariable ["characterID",dayz_characterID,true];
|
||||||
|
|
||||||
|
PVDZ_obj_Publish = [dayz_characterID,_stash,[_dir,_location],[]];
|
||||||
|
publicVariableServer "PVDZ_obj_Publish";
|
||||||
|
diag_log [diag_ticktime, __FILE__, "New Networked object, request to save to hive. PVDZ_obj_Publish:", PVDZ_obj_Publish];
|
||||||
|
|
||||||
|
r_action_count = 0;
|
||||||
|
cutText [format [localize "str_success_stash_pitch",_stashname], "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
r_action_count = 0;
|
||||||
|
cutText [format [localize "str_fail_stash_pitch",_stashname], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
107
SQF/dayz_code/actions/player_destroyTent.sqf
Normal file
107
SQF/dayz_code/actions/player_destroyTent.sqf
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
private ["_cantype","_emptycan","_intensity","_objectID", "_objectUID"];
|
||||||
|
|
||||||
|
//Tent Object
|
||||||
|
_obj = _this select 3;
|
||||||
|
_objectID = _obj getVariable["ObjectID","0"];
|
||||||
|
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||||
|
|
||||||
|
//Active Arrays.
|
||||||
|
_fuelArray = [];
|
||||||
|
_matchArray = [];
|
||||||
|
|
||||||
|
//Count how many matchbox's the player has incase they have more then one.
|
||||||
|
{
|
||||||
|
if (_x IN items player) then {
|
||||||
|
_matchArray set [count _matchArray, _x];
|
||||||
|
};
|
||||||
|
} count Dayz_Ignators;
|
||||||
|
|
||||||
|
//Count how many fuelcans the player has incase they have more then one.
|
||||||
|
{
|
||||||
|
if (_x IN magazines player) then {
|
||||||
|
_fuelArray set [count _fuelArray, _x];
|
||||||
|
};
|
||||||
|
} count DayZ_fuelCans;
|
||||||
|
|
||||||
|
//Make sure we have both components to create the fire.
|
||||||
|
if ((count _fuelArray == 0)) exitwith { systemChat (localize ("str_setFireFuel")); };
|
||||||
|
if ((count _matchArray == 0)) exitwith { systemChat (localize ("str_setFireMatches")); };
|
||||||
|
|
||||||
|
//Play normal action animation
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//Actionmenu tools
|
||||||
|
player removeAction s_player_destorytent;
|
||||||
|
s_player_destorytent = -1;
|
||||||
|
|
||||||
|
//Make sure you can only destory once
|
||||||
|
_alreadyDestorying = _obj getVariable["alreadyDestorying",0];
|
||||||
|
|
||||||
|
if (_alreadyDestorying == 1) exitWith {cutText [localize "str_TentAlreadyLit" , "PLAIN DOWN"]};
|
||||||
|
|
||||||
|
_obj setVariable["alreadyDestorying",1];
|
||||||
|
|
||||||
|
//Jerry can system ** Needs redoing
|
||||||
|
//Select random can from array
|
||||||
|
_randomJerryCan = _fuelArray call BIS_fnc_selectRandom;
|
||||||
|
|
||||||
|
_name = getText (configFile >> "CfgMagazines" >> _randomJerryCan >> "displayName");
|
||||||
|
_emptycan = getText (configFile >> "CfgMagazines" >> _randomJerryCan >> "emptycan");
|
||||||
|
_fireIntensity = getNumber (configFile >> "CfgMagazines" >> _randomJerryCan >> "fireIntensity");
|
||||||
|
|
||||||
|
player removeMagazine _randomJerryCan;
|
||||||
|
player addMagazine _emptycan;
|
||||||
|
|
||||||
|
//Match system ** Needs redoing
|
||||||
|
//Select random matchbox
|
||||||
|
_randomBoxMatches = _matchArray call BIS_fnc_selectRandom;
|
||||||
|
_qtyRemaining = getText (configFile >> "cfgWeapons" >> _randomBoxMatches >> "Ignators" >> "qtyRemaining");
|
||||||
|
|
||||||
|
switch _randomBoxMatches do {
|
||||||
|
case "ItemMatchbox" : {
|
||||||
|
if ([0.3] call fn_chance) then {
|
||||||
|
player removeWeapon _randomBoxMatches;
|
||||||
|
player addWeapon _qtyRemaining;
|
||||||
|
|
||||||
|
//info box.
|
||||||
|
systemChat (localize "str_info_limitedbox");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
player removeWeapon _randomBoxMatches;
|
||||||
|
player addWeapon _qtyRemaining;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//Normal alerts
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "tentpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Added Nutrition-Factor for work
|
||||||
|
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
|
||||||
|
PVDZ_obj_Destroy = [_objectID,_objectUID];
|
||||||
|
publicVariableServer "PVDZ_obj_Destroy";
|
||||||
|
|
||||||
|
//Send killed for object
|
||||||
|
if (isServer) then {
|
||||||
|
PVDZ_obj_Destroy call server_deleteObj;
|
||||||
|
} else {
|
||||||
|
PVDZ_veh_Save = [_obj, "killed"];
|
||||||
|
publicVariableServer "PVDZ_veh_Save";
|
||||||
|
};
|
||||||
|
|
||||||
|
//Set fire to item
|
||||||
|
onFire = [_obj,_fireIntensity,time,false,true] spawn BIS_Effects_Burn;
|
||||||
|
|
||||||
|
PVDZ_obj_Fire = [_obj,_fireIntensity,time,false,true];
|
||||||
|
publicVariable "PVDZ_obj_Fire";
|
||||||
|
|
||||||
|
_obj inflame true;
|
||||||
|
//_obj spawn player_fireMonitor;
|
||||||
|
|
||||||
|
cutText [localize "str_success_tent_destoryed", "PLAIN DOWN"];
|
||||||
83
SQF/dayz_code/actions/player_drinkWater.sqf
Normal file
83
SQF/dayz_code/actions/player_drinkWater.sqf
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
private["_playerPos","_canFill","_isPond","_isWell","_pondPos","_objectsWell","_onLadder","_hasbottleitem","_config","_item","_text","_objectsPond","_qty","_dis","_sfx","_isInfected","_bodiesNear","_chance"];
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
_item = _this;
|
||||||
|
_playerPos = getPosATL player;
|
||||||
|
_canFill = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
|
||||||
|
_isPond = false;
|
||||||
|
_isWell = false;
|
||||||
|
_isInfected = false;
|
||||||
|
_pondPos = [];
|
||||||
|
_objectsWell = [];
|
||||||
|
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
if (_onLadder) exitWith {cutText [localize "str_player_21", "PLAIN DOWN"]};
|
||||||
|
|
||||||
|
_itemorignal = _this;
|
||||||
|
//diag_log(str(_itemorignal));
|
||||||
|
|
||||||
|
if (!dayz_isSwimming) then {
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_canFill) then {
|
||||||
|
_objectsWell = nearestObjects [_playerPos, [], 4];
|
||||||
|
{
|
||||||
|
//Check for Well
|
||||||
|
_isWell = ["_well",str(_x),false] call fnc_inString;
|
||||||
|
if (_isWell) then {_canFill = true};
|
||||||
|
} forEach _objectsWell;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_canFill) then {
|
||||||
|
_objectsPond = nearestObjects [_playerPos, [], 100];
|
||||||
|
{
|
||||||
|
//Check for pond
|
||||||
|
_isPond = ["pond",str(_x),false] call fnc_inString;
|
||||||
|
//Check for Dead Bodies
|
||||||
|
_bodiesNear = ["dead",str(_x),false] call fnc_inString;
|
||||||
|
if (!_bodiesNear) then {
|
||||||
|
_bodiesNear = ["massgrave",str(_x),false] call fnc_inString;
|
||||||
|
};
|
||||||
|
if (_bodiesNear) then {
|
||||||
|
_isInfected = true;
|
||||||
|
};
|
||||||
|
if (_isPond) then {
|
||||||
|
_pondPos = (_x worldToModel _playerPos) select 2;
|
||||||
|
if (_pondPos < 0) then {
|
||||||
|
_canFill = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _objectsPond;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_canFill) then {
|
||||||
|
_chance = 0.1;
|
||||||
|
|
||||||
|
if (_itemorignal in boil_tin_cans) then {
|
||||||
|
_chance = 0.06;
|
||||||
|
["FoodDrink",0,[0,0,300,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
|
||||||
|
} else {
|
||||||
|
_chance = 0.03;
|
||||||
|
["FoodDrink",0,[0,0,150,0]] call dayz_NutritionSystem; //[Energy,food,water,temp]
|
||||||
|
};
|
||||||
|
|
||||||
|
[player,"drink",0,false,5] call dayz_zombieSpeak;
|
||||||
|
[player,10,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
if(!_isWell) then {
|
||||||
|
if (_isInfected) then {
|
||||||
|
r_player_infected = true;
|
||||||
|
player setVariable["USEC_infected",true,true];
|
||||||
|
} else {
|
||||||
|
if ([_chance] call fn_chance) then {
|
||||||
|
r_player_infected = true;
|
||||||
|
player setVariable["USEC_infected",true,true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
cutText [localize "str_drinkwithhands", "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_32", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
33
SQF/dayz_code/actions/player_dropWeapon.sqf
Normal file
33
SQF/dayz_code/actions/player_dropWeapon.sqf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
private ["_item","_config","_onLadder","_consume","_bag","_droppedtype"];
|
||||||
|
disableSerialization;
|
||||||
|
_item = _this;
|
||||||
|
_config = configFile >> "CfgWeapons" >> _item;
|
||||||
|
_droppedtype = (gettext (_config >> "droppeditem"));
|
||||||
|
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
if (_onLadder) exitWith { cutText [localize "str_player_21", "PLAIN DOWN"]; r_action_count = 0; };
|
||||||
|
if (r_action_count != 1) exitWith { cutText [localize "str_player_actionslimit", "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
_consume = ([] + getArray (_config >> "magazines")) select 0;
|
||||||
|
|
||||||
|
if ((dayz_onBack != "") && (dayz_onBack in MeleeWeapons) && carryClick) then {
|
||||||
|
switch DayZ_onBack do {
|
||||||
|
case "MeleeHatchet": {_item = "ItemHatchet"; dayz_onBack = "";};
|
||||||
|
case "MeleeCrowbar": {_item = "ItemCrowbar"; dayz_onBack = "";};
|
||||||
|
case "MeleeMachete": {_item = "ItemMachete"; dayz_onBack = "";};
|
||||||
|
};
|
||||||
|
carryClick = false;
|
||||||
|
((findDisplay 106) displayCtrl 1209) ctrlSetText "";
|
||||||
|
} else {
|
||||||
|
player removeMagazines _consume;
|
||||||
|
player removeWeapon _item;
|
||||||
|
if (_droppedtype == "") then { _item = _this; } else { _item = _droppedtype; };
|
||||||
|
};
|
||||||
|
|
||||||
|
_bag = createVehicle [format["WeaponHolder_%1",_item],getPosATL player,[], 1, "CAN_COLLIDE"];
|
||||||
|
_bag modelToWorld getPosATL player;
|
||||||
|
_bag setdir (getDir player);
|
||||||
|
player reveal _bag;
|
||||||
|
r_action_count = 0;
|
||||||
60
SQF/dayz_code/actions/player_emptyContainer.sqf
Normal file
60
SQF/dayz_code/actions/player_emptyContainer.sqf
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
Player action for emptying containers e.g. water bottle
|
||||||
|
|
||||||
|
Single parameter:
|
||||||
|
string item classname
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_cfg",
|
||||||
|
"_nutrition",
|
||||||
|
"_bloodRegen",
|
||||||
|
"_infectionChance",
|
||||||
|
"_sound",
|
||||||
|
"_output"
|
||||||
|
];
|
||||||
|
|
||||||
|
_cfg = (ConfigFile >> "CfgMagazines" >> _this);
|
||||||
|
|
||||||
|
//class doesn't exist
|
||||||
|
if (!isClass(_cfg)) exitWith
|
||||||
|
{
|
||||||
|
diag_log format ["DAYZ ERROR: Invalid magazine classname given to player_emptyContainer: %1", _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
//class isn't a consumable
|
||||||
|
if (!isText(_cfg >> "containerEmpty")) exitWith
|
||||||
|
{
|
||||||
|
diag_log format ["DAYZ ERROR: Non-emptiable item classname given to player_emptyContainer: %1", _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
//player is on a ladder
|
||||||
|
if ((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1) exitWith
|
||||||
|
{
|
||||||
|
(localize "str_player_21") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//player doesn't have the consumable item
|
||||||
|
if (!(_this in magazines player)) exitWith
|
||||||
|
{
|
||||||
|
//TODO move to stringtable
|
||||||
|
"You seem to have misplaced the container." call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Remove container
|
||||||
|
player removeMagazine _this;
|
||||||
|
player addMagazine getText (_cfg >> "containerEmpty");
|
||||||
|
|
||||||
|
//update gear ui or close if the player is in a vehicle
|
||||||
|
if (vehicle player == player) then
|
||||||
|
{
|
||||||
|
call gear_ui_init;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(findDisplay 106) closeDisplay 0;
|
||||||
|
};
|
||||||
24
SQF/dayz_code/actions/player_fillQuiver.sqf
Normal file
24
SQF/dayz_code/actions/player_fillQuiver.sqf
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
private["_qty_arrows","_qty_quivers","_control","_qty_quiverarrows","_qty_quiverfreeslots","_qty_arrows2add"];
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
_qty_arrows = {_x == "WoodenArrow"} count magazines player;
|
||||||
|
_qty_quivers = {_x == "Quiver"} count magazines player;
|
||||||
|
|
||||||
|
_control = uiNamespace getVariable 'uiControl';
|
||||||
|
_qty_quiverarrows = gearSlotAmmoCount _control;
|
||||||
|
_qty_quiverfreeslots = 12-_qty_quiverarrows;
|
||||||
|
|
||||||
|
//if (_qty_quivers > 1) exitWith { cutText [localize "str_quiver_reachlimit", "PLAIN DOWN"];};
|
||||||
|
if (_qty_quiverfreeslots > 0) then {
|
||||||
|
_qty_arrows2add = _qty_quiverfreeslots min _qty_arrows;
|
||||||
|
player removeMagazine "Quiver";
|
||||||
|
for "_x" from 1 to _qty_arrows2add do {
|
||||||
|
player removeMagazine "WoodenArrow";
|
||||||
|
};
|
||||||
|
player addMagazine ["Quiver",_qty_quiverarrows+_qty_arrows2add];
|
||||||
|
cutText [format [localize "str_quiver_addarrows",_qty_arrows2add], "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_quiver_full", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
21
SQF/dayz_code/actions/player_fixBottle.sqf
Normal file
21
SQF/dayz_code/actions/player_fixBottle.sqf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
private ["_bottle","_tape","_fixedBottle"];
|
||||||
|
|
||||||
|
_bottle = _this;
|
||||||
|
_tape = "equip_duct_tape";
|
||||||
|
_fixedBottle = "ItemWaterBottleUnfilled";
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
|
||||||
|
// Check if the player has the tape
|
||||||
|
if (_tape in magazines player) then {
|
||||||
|
//Fix the bottle
|
||||||
|
player playActionNow "Medic";
|
||||||
|
[player,"bandage",0,false] call dayz_zombieSpeak;
|
||||||
|
sleep 6;
|
||||||
|
player removeMagazine _bottle;
|
||||||
|
player removeMagazine _tape;
|
||||||
|
player addMagazine _fixedBottle;
|
||||||
|
cutText [localize "str_fix_water_bottle", "PLAIN DOWN"];
|
||||||
|
} else { //If the player doesn't have the tape
|
||||||
|
cutText [localize "str_fix_water_bottle_fail", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
40
SQF/dayz_code/actions/player_fixTools.sqf
Normal file
40
SQF/dayz_code/actions/player_fixTools.sqf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//fixHatchet old file
|
||||||
|
private ["_tool","_tape","_fixedItem"];
|
||||||
|
|
||||||
|
_tool = _this;
|
||||||
|
_config = configFile >> "CfgWeapons" >> _tool;
|
||||||
|
_fixedItem = getText(_config >> "fixedTool");
|
||||||
|
|
||||||
|
_dName = getText(configFile >> "CfgWeapons" >> _fixedItem >> "displayName");
|
||||||
|
|
||||||
|
//Used for Grip
|
||||||
|
_tape = "equip_duct_tape";
|
||||||
|
//Handle
|
||||||
|
_handle = "equip_lever";
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
|
||||||
|
// Check if the player has the tape
|
||||||
|
if ((_tape in magazines player) && (_handle in magazines player)) then {
|
||||||
|
//Fix the tool
|
||||||
|
player playActionNow "Medic";
|
||||||
|
[player,"bandage",0,false] call dayz_zombieSpeak;
|
||||||
|
sleep 6;
|
||||||
|
player removeWeapon _tool;
|
||||||
|
player removeMagazine _tape;
|
||||||
|
player removeMagazine _handle;
|
||||||
|
player addWeapon _fixedItem;
|
||||||
|
cutText [format [localize "str_fixToolSuccess", _dName], "PLAIN DOWN"];
|
||||||
|
|
||||||
|
} else { //If the player doesn't have the mats.
|
||||||
|
if (!(_tape in magazines player)) then {
|
||||||
|
if (!(_handle in magazines player)) then {
|
||||||
|
cutText [localize "str_fixToolFail", "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_fixtoolMissingTape", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_fixtoolMissingHandle", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
38
SQF/dayz_code/actions/player_gather.sqf
Normal file
38
SQF/dayz_code/actions/player_gather.sqf
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
private ["_plant", "_originalCount"];
|
||||||
|
_plant = _this;
|
||||||
|
|
||||||
|
if (_plant getVariable["Gathering",false]) exitWith {};
|
||||||
|
_originalCount = getNumber (configFile >> "CfgVehicles" >> (typeOf _plant) >> "TransportMagazines" >> "_xx_leaf" >> "count");
|
||||||
|
if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _plant, getWeaponCargo _plant] ] call BIS_fnc_areEqual) then {
|
||||||
|
//diag_log [ [getMagazineCargo _plant, getWeaponCargo _plant], "!=", [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] ];
|
||||||
|
_plant setVariable["Gathering",true]; // avoid multiple call because the fn_selfActions is called in an infinite loop
|
||||||
|
[_this] spawn { // in background to be called after fn_selfActions
|
||||||
|
_plant = _this select 0;
|
||||||
|
_mags = (getMagazineCargo _plant) select 0;
|
||||||
|
_weps = (getWeaponCargo _plant) select 0;
|
||||||
|
if (count _mags != 0 OR count _weps != 0) then { // if not empty
|
||||||
|
// replace plant to a regular weaponholder
|
||||||
|
_item = createVehicle ["WeaponHolder", (getPosATL _plant), [], 0, "CAN_COLLIDE"];
|
||||||
|
_magcounts = (getMagazineCargo _plant) select 1;
|
||||||
|
{
|
||||||
|
_item addMagazineCargoGlobal [_x, _magcounts select _forEachIndex];
|
||||||
|
} forEach _mags;
|
||||||
|
_wepcounts = (getWeaponCargo _plant) select 1;
|
||||||
|
{
|
||||||
|
_item addWeaponCargoGlobal [_x, _wepcounts select _forEachIndex];
|
||||||
|
} forEach _weps;
|
||||||
|
};
|
||||||
|
|
||||||
|
//remove vehicle, Need to ask server to remove.
|
||||||
|
PVDZ_obj_Delete = [_plant,player];
|
||||||
|
publicVariableServer "PVDZ_obj_Delete";
|
||||||
|
|
||||||
|
deleteVehicle _plant;
|
||||||
|
|
||||||
|
//Make some noise
|
||||||
|
_dis=2;
|
||||||
|
_sfx = "tentpack";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
};
|
||||||
|
};
|
||||||
151
SQF/dayz_code/actions/player_mineStone.sqf
Normal file
151
SQF/dayz_code/actions/player_mineStone.sqf
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
private ["_item","_result","_dis","_sfx","_num","_breaking","_counter","_rocks","_findNearestRock","_objInfo","_lenInfo","_objName","_i","_k","_countOut","_isOk","_proceed","_animState","_started","_finished","_isMedic","_itemOut","_wpPos","_nearByPile"];
|
||||||
|
|
||||||
|
|
||||||
|
_item = _this;
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 1;
|
||||||
|
|
||||||
|
if(dayz_workingInprogress) exitWith { cutText ["Mining already in progress!", "PLAIN DOWN"];};
|
||||||
|
dayz_workingInprogress = true;
|
||||||
|
|
||||||
|
// allowed rocks list move this later
|
||||||
|
_rocks = ["r2_boulder1.p3d","r2_boulder2.p3d","r2_rock1.p3d","r2_rock2.p3d","r2_rocktower.p3d","r2_rockwall.p3d","r2_stone.p3d"];
|
||||||
|
_findNearestRock = objNull;
|
||||||
|
|
||||||
|
{
|
||||||
|
_objInfo = toArray(str(_x));
|
||||||
|
_lenInfo = count _objInfo - 1;
|
||||||
|
_objName = [];
|
||||||
|
_i = 0;
|
||||||
|
// determine where the object name starts
|
||||||
|
{
|
||||||
|
if (58 == _objInfo select _i) exitWith {};
|
||||||
|
_i = _i + 1;
|
||||||
|
} forEach _objInfo;
|
||||||
|
_i = _i + 2; // skip the ": " part
|
||||||
|
|
||||||
|
for "_k" from _i to _lenInfo do {
|
||||||
|
_objName = _objName + [_objInfo select _k];
|
||||||
|
};
|
||||||
|
_objName = toLower(toString(_objName));
|
||||||
|
|
||||||
|
// Exit since we found a rock
|
||||||
|
if (_objName in _rocks) exitWith { _findNearestRock = _x; };
|
||||||
|
} foreach nearestObjects [getPosATL player, [], 8];
|
||||||
|
|
||||||
|
|
||||||
|
if (!isNull _findNearestRock) then {
|
||||||
|
_countOut = 2 + floor(random 3);
|
||||||
|
|
||||||
|
//Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed)
|
||||||
|
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"];
|
||||||
|
|
||||||
|
// Start stone mining loop
|
||||||
|
_counter = 0;
|
||||||
|
_isOk = true;
|
||||||
|
_proceed = false;
|
||||||
|
|
||||||
|
while {_isOk} do {
|
||||||
|
//play action
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//setup alert and speak
|
||||||
|
_dis=20;
|
||||||
|
_sfx = "minestone";
|
||||||
|
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||||
|
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||||
|
|
||||||
|
// Working-Factor for mining stone.
|
||||||
|
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!_finished) exitWith {
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_finished) then {
|
||||||
|
_breaking = false;
|
||||||
|
if ([0.04] call fn_chance) then {
|
||||||
|
_breaking = true;
|
||||||
|
if ("MeleePickaxe" in weapons player) then {
|
||||||
|
player removeWeapon "MeleePickaxe";
|
||||||
|
} else {
|
||||||
|
if ("ItemPickaxe" in weapons player) then {
|
||||||
|
player removeWeapon "ItemPickaxe";
|
||||||
|
} else {
|
||||||
|
if (dayz_onBack == "MeleePickaxe") then {
|
||||||
|
dayz_onBack = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (!("ItemPickaxeBroken" in weapons player)) then {
|
||||||
|
player addWeapon "ItemPickaxeBroken";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_counter = _counter + 1;
|
||||||
|
_itemOut = "ItemStone";
|
||||||
|
|
||||||
|
//Drop Item to ground
|
||||||
|
_itemOut call fn_dropItem;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_counter >= _countOut) || _breaking) exitWith {
|
||||||
|
if (_breaking) then {
|
||||||
|
cutText [localize "str_PickAxeHandleBreaks", "PLAIN DOWN"];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_mining_finished", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
_isOk = false;
|
||||||
|
_proceed = true;
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
cutText [format[localize "str_mining_progress", _counter,(_countOut - _counter)], "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_proceed) then {
|
||||||
|
cutText [localize "str_mining_canceled", "PLAIN DOWN"];
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//adding melee mags back if needed
|
||||||
|
switch (primaryWeapon player) do {
|
||||||
|
case "MeleeHatchet": {player addMagazine 'Hatchet_Swing';};
|
||||||
|
case "MeleeCrowbar": {player addMagazine 'Crowbar_Swing';};
|
||||||
|
case "MeleeMachete": {player addMagazine 'Machete_Swing';};
|
||||||
|
case "MeleeFishingPole": {player addMagazine 'Fishing_Swing';};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_mining_no_rocks", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
dayz_workingInprogress = false;
|
||||||
83
SQF/dayz_code/actions/player_operate.sqf
Normal file
83
SQF/dayz_code/actions/player_operate.sqf
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
private ["_target","_type","_fn_Lock","_fn_UnLock","_fn_Open","_fn_Closed"];
|
||||||
|
|
||||||
|
_target = ((_this select 3) select 0);
|
||||||
|
_type = ((_this select 3) select 1);
|
||||||
|
|
||||||
|
_fn_Set = {
|
||||||
|
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target animate ["DoorR", 0];
|
||||||
|
_target animate ["DoorL", 0];
|
||||||
|
//_target setVariable ["isOpen", "0", true];
|
||||||
|
[_target,true] spawn padlock_open;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_Lock = {
|
||||||
|
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target animate ["DoorR", 0];
|
||||||
|
_target animate ["DoorL", 0];
|
||||||
|
_target setVariable ["isOpen", "0", true];
|
||||||
|
_target setVariable ["dayz_padlockLockStatus",true,true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_UnLock = {
|
||||||
|
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
[_target,false] spawn padlock_open;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_Lockold = {
|
||||||
|
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target animate ["DoorR", 0];
|
||||||
|
_target animate ["DoorL", 0];
|
||||||
|
_target setVariable ["isOpen", "0", true];
|
||||||
|
cutText ["Gates locked.", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_UnLockold = {
|
||||||
|
if (typeOf _target in ["WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target setVariable ["isOpen", "1", true];
|
||||||
|
cutText ["Gates Unlocked.", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_Open = {
|
||||||
|
if (typeOf _target in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target animate ["DoorR", 1];
|
||||||
|
_target animate ["DoorL", 1];
|
||||||
|
cutText ["Gates Opened.", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_Closed = {
|
||||||
|
if (typeOf _target in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4"]) then {
|
||||||
|
_target animate ["DoorR", 0];
|
||||||
|
_target animate ["DoorL", 0];
|
||||||
|
cutText ["Gates Closed.", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_fn_BuildLock = {
|
||||||
|
_target setVariable ["BuildLock",true,true];
|
||||||
|
|
||||||
|
PVDZ_Server_buildLock = [_target];
|
||||||
|
publicVariableServer "PVDZ_Server_buildLock";
|
||||||
|
};
|
||||||
|
_fn_BuildUnLock = {
|
||||||
|
_target setVariable ["BuildLock",false,true];
|
||||||
|
|
||||||
|
PVDZ_Server_buildLock = [_target];
|
||||||
|
publicVariableServer "PVDZ_Server_buildLock";
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (_type) do {
|
||||||
|
case "Lock": { call _fn_Lock; };
|
||||||
|
case "Unlock": { call _fn_UnLock; };
|
||||||
|
case "Open": { call _fn_Open; };
|
||||||
|
case "Close": { call _fn_Closed; };
|
||||||
|
case "Set": { call _fn_Set; };
|
||||||
|
case "BuildLock": { call _fn_BuildLock; };
|
||||||
|
case "BuildUnLock": { call _fn_BuildUnLock; };
|
||||||
|
};
|
||||||
120
SQF/dayz_code/actions/player_recombineMagazine.sqf
Normal file
120
SQF/dayz_code/actions/player_recombineMagazine.sqf
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
private ["_item","_config","_consume","_create","_item_ammo","_consume_magsize","_create_magsize","_consume_type","_slotstart","_slotend","_dialog","_qty_total_ammo","_qty_consume_ammo","_qty_create_ammo","_qty_consume_mags","_qty_create_mags","_qty_free_slots","_control","_mag","_qtynew_create_ammo","_qtynew_consume_ammo","_qtynew_create_mags","_qtynew_consume_mags","_qtynew_consume_mags_full","_qtynew_create_mags_full","_qtynew_consume_ammo_rest","_qtynew_create_ammo_rest"];
|
||||||
|
disableSerialization;
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
//note - one slot ammo can be used!
|
||||||
|
r_action_count = r_action_count + 1;
|
||||||
|
if (r_action_count != 1) exitWith { cutText [localize "str_player_actionslimit", "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
_item = _this;
|
||||||
|
|
||||||
|
if (!(_item in magazines player)) exitWith {r_action_count = 0;};
|
||||||
|
|
||||||
|
_config = configFile >> "CfgMagazines" >> _item;
|
||||||
|
|
||||||
|
_consume = getArray (_config >> "ItemActions" >> "ReloadMag" >> "use") select 0;
|
||||||
|
_create = getArray (_config >> "ItemActions" >> "ReloadMag" >> "output") select 0;
|
||||||
|
|
||||||
|
_item_ammo = gearSlotAmmoCount (uiNamespace getVariable 'uiControl');
|
||||||
|
|
||||||
|
//add check if weapon can use _create (if not - show message)
|
||||||
|
/*
|
||||||
|
if (currentWeapon player != "") then {
|
||||||
|
_mags = [] + getArray (configFile >> "cfgWeapons" >> (currentWeapon player) >> "magazines");
|
||||||
|
};
|
||||||
|
if !(_create in _mags) exitWith {cutText [localize "str_must_have_weapon", "PLAIN DOWN"];};
|
||||||
|
|
||||||
|
*/
|
||||||
|
player playActionNow "PutDown";
|
||||||
|
|
||||||
|
_consume_magsize = getNumber(configFile >> "CfgMagazines" >> _consume >> "count");
|
||||||
|
_create_magsize = getNumber(configFile >> "CfgMagazines" >> _create >> "count");
|
||||||
|
|
||||||
|
_consume_type = getNumber(configFile >> "CfgMagazines" >> _consume >> "type");
|
||||||
|
|
||||||
|
//primary/secondary mags?
|
||||||
|
_slotstart = 0;
|
||||||
|
_slotend = 0;
|
||||||
|
if (_consume_type == 256) then {
|
||||||
|
_slotstart = 109;
|
||||||
|
_slotend = 120;
|
||||||
|
};
|
||||||
|
if (_consume_type == 16) then {
|
||||||
|
_slotstart = 122;
|
||||||
|
_slotend = 129;
|
||||||
|
};
|
||||||
|
|
||||||
|
_dialog = findDisplay 106;
|
||||||
|
|
||||||
|
_qty_total_ammo = 0;
|
||||||
|
_qty_consume_ammo = 0;
|
||||||
|
_qty_create_ammo = 0;
|
||||||
|
_qty_consume_mags = 0;
|
||||||
|
_qty_create_mags = 0;
|
||||||
|
_qty_free_slots = 0;
|
||||||
|
for "_i" from _slotstart to _slotend do {
|
||||||
|
_control =_dialog displayCtrl _i;
|
||||||
|
_mag = gearSlotData _control;
|
||||||
|
if (_mag == _consume) then {
|
||||||
|
_qty_total_ammo = _qty_total_ammo + gearSlotAmmoCount _control;
|
||||||
|
_qty_consume_ammo = _qty_consume_ammo + gearSlotAmmoCount _control;
|
||||||
|
_qty_consume_mags = _qty_consume_mags+1;
|
||||||
|
};
|
||||||
|
if (_mag == _create) then {
|
||||||
|
_qty_total_ammo = _qty_total_ammo + gearSlotAmmoCount _control;
|
||||||
|
_qty_create_ammo = _qty_create_ammo + gearSlotAmmoCount _control;
|
||||||
|
_qty_create_mags = _qty_create_mags+1;
|
||||||
|
};
|
||||||
|
if (_mag == "") then {
|
||||||
|
_qty_free_slots = _qty_free_slots + 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_qtynew_create_ammo = 0;
|
||||||
|
_qtynew_consume_ammo = 0;
|
||||||
|
_qtynew_create_mags = 0;
|
||||||
|
_qtynew_consume_mags = 0;
|
||||||
|
|
||||||
|
_qtynew_consume_mags_full = 0;
|
||||||
|
_qtynew_create_mags_full = 0;
|
||||||
|
_qtynew_consume_ammo_rest = 0;
|
||||||
|
_qtynew_create_ammo_rest = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (_consume_magsize > _create_magsize) then {
|
||||||
|
_qtynew_create_ammo = _qty_create_ammo + _item_ammo;
|
||||||
|
_qtynew_consume_ammo = _qty_consume_ammo - _item_ammo;
|
||||||
|
_qtynew_create_mags = ceil(_qtynew_create_ammo/_create_magsize);
|
||||||
|
_qtynew_consume_mags = ceil(_qtynew_consume_ammo/_consume_magsize);
|
||||||
|
} else {
|
||||||
|
_qtynew_create_ammo = _qty_total_ammo;
|
||||||
|
_qtynew_consume_ammo = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_qtynew_create_mags + _qtynew_consume_mags) > (_qty_create_mags + _qty_consume_mags + _qty_free_slots)) exitWith {
|
||||||
|
r_action_count = 0;
|
||||||
|
cutText [localize "str_player_24", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
_qtynew_consume_mags_full = floor(_qtynew_consume_ammo/_consume_magsize);
|
||||||
|
_qtynew_create_mags_full = floor(_qtynew_create_ammo/_create_magsize);
|
||||||
|
_qtynew_consume_ammo_rest = _qtynew_consume_ammo - (_qtynew_consume_mags_full*_consume_magsize);
|
||||||
|
_qtynew_create_ammo_rest = _qtynew_create_ammo - (_qtynew_create_mags_full*_create_magsize);
|
||||||
|
|
||||||
|
//remove all _consume and _create mags (we already have total ammo count)
|
||||||
|
player removeMagazines _consume;
|
||||||
|
player removeMagazines _create;
|
||||||
|
|
||||||
|
for "_i" from 1 to _qtynew_consume_mags_full do {
|
||||||
|
player addMagazine _consume;
|
||||||
|
};
|
||||||
|
if (_qtynew_consume_ammo_rest != 0) then {
|
||||||
|
player addMagazine [_consume,_qtynew_consume_ammo_rest];
|
||||||
|
};
|
||||||
|
for "_i" from 1 to _qtynew_create_mags_full do {
|
||||||
|
player addMagazine _create;
|
||||||
|
};
|
||||||
|
if (_qtynew_create_ammo_rest != 0) then {
|
||||||
|
player addMagazine [_create,_qtynew_create_ammo_rest];
|
||||||
|
};
|
||||||
|
sleep 1;
|
||||||
|
r_action_count = 0;
|
||||||
84
SQF/dayz_code/actions/player_removeAttachment.sqf
Normal file
84
SQF/dayz_code/actions/player_removeAttachment.sqf
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Attempts to remove an attachment from the player's current primary weapon or sidearm.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
string attachment item classname
|
||||||
|
string current weapon classname
|
||||||
|
string resulting weapon classname
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\util\Player.hpp"
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_attachment",
|
||||||
|
"_weapon",
|
||||||
|
"_newWeapon",
|
||||||
|
"_weaponInUse",
|
||||||
|
"_newWeaponConfig",
|
||||||
|
"_muzzle"
|
||||||
|
];
|
||||||
|
|
||||||
|
//check if player is on a ladder and if so, exit
|
||||||
|
if (Player_IsOnLadder()) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
(localize "str_player_21") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_attachment = _this select 0;
|
||||||
|
_weapon = _this select 1;
|
||||||
|
_newWeapon = _this select 2;
|
||||||
|
|
||||||
|
//check that player has enough room in inventory
|
||||||
|
if ((([player] call BIS_fnc_invSlotsEmpty) select 4) < 1) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
(localize "str_player_24") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//check that player has the weapon
|
||||||
|
if (!(player hasWeapon _weapon)) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
(localize "str_AttachmentMissingWeapon3") call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Check that newWeapon + attachment actually results in current weapon
|
||||||
|
_newWeaponConfig = configFile >> "CfgWeapons" >> _newWeapon >> "Attachments";
|
||||||
|
if (!isClass(_newWeaponConfig) || {getText(_newWeaponConfig >> _attachment) != _weapon}) exitWith
|
||||||
|
{
|
||||||
|
closeDialog 0;
|
||||||
|
"Cannot remove attachment." call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
_weaponInUse = (currentWeapon player == _weapon);
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
//replace weapon and add attachment to inventory
|
||||||
|
player removeWeapon _weapon;
|
||||||
|
player addWeapon _newWeapon;
|
||||||
|
player addMagazine _attachment;
|
||||||
|
|
||||||
|
//close gear
|
||||||
|
(findDisplay 106) closeDisplay 0;
|
||||||
|
|
||||||
|
//Select new weapon if the old was in use
|
||||||
|
if (_weaponInUse) then
|
||||||
|
{
|
||||||
|
_muzzle = (getArray (configFile >> "CfgWeapons" >> _newWeapon >> "muzzles")) select 0;
|
||||||
|
|
||||||
|
if (_muzzle == "this") then
|
||||||
|
{
|
||||||
|
player selectWeapon _newWeapon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player selectWeapon _muzzle;
|
||||||
|
};
|
||||||
|
};
|
||||||
54
SQF/dayz_code/actions/player_sharpen.sqf
Normal file
54
SQF/dayz_code/actions/player_sharpen.sqf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
private ["_item","_use","_repair","_waterUsed"];
|
||||||
|
|
||||||
|
//['ItemKnifeBlunt','ItemKnife']
|
||||||
|
_item = _this select 0; //Item to be sharpened
|
||||||
|
_repair = _this select 1; //Item to be given back.
|
||||||
|
|
||||||
|
_use = ["ItemWaterBottle","ItemWaterBottleInfected","ItemWaterBottleSafe","ItemWaterBottleBoiled","ItemWaterBottleHerbal","ItemCanteen","ItemCanteenInfected","ItemCanteenSafe","ItemCanteenBoiled","ItemCanteenHerbal"];
|
||||||
|
_waterUsed = nil;
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_x IN magazines player) exitwith { _waterUsed = _x; };
|
||||||
|
} foreach _use;
|
||||||
|
|
||||||
|
// item is missing or tools are missing
|
||||||
|
if (isNil "_waterUsed") exitWith {
|
||||||
|
//_displayName = getText (configFile >> "CfgMagazines" >> _use >> "displayName");
|
||||||
|
_msg = "Missing Water";
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
// item is missing or tools are missing
|
||||||
|
if (!(_item IN items player)) exitWith {
|
||||||
|
_displayName = getText (configFile >> "CfgWeapons" >> _item >> "displayName");
|
||||||
|
//cutText [format["Missing Item",_displayName], "PLAIN DOWN"];
|
||||||
|
_msg = format["Missing %1",_displayName];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (player hasWeapon _item) then {
|
||||||
|
_displayName = getText (configFile >> "CfgWeapons" >> _item >> "displayName");
|
||||||
|
|
||||||
|
player removeMagazine _waterUsed;
|
||||||
|
Player removeWeapon _item;
|
||||||
|
|
||||||
|
Player addWeapon _repair;
|
||||||
|
|
||||||
|
if (_waterUsed in ["ItemWaterBottle","ItemWaterBottleInfected","ItemWaterBottleSafe","ItemWaterBottleBoiled","ItemWaterBottleHerbal"]) then {
|
||||||
|
player addMagazine "ItemWaterBottleUnfilled";
|
||||||
|
};
|
||||||
|
if (_waterUsed in ["ItemCanteen","ItemCanteenInfected","ItemCanteenSafe","ItemCanteenBoiled","ItemCanteenHerbal"]) then {
|
||||||
|
player addMagazine "ItemCanteenEmpty";
|
||||||
|
};
|
||||||
|
|
||||||
|
//Remove Later
|
||||||
|
player removeMagazine "equip_brick";
|
||||||
|
|
||||||
|
|
||||||
|
//cutText [format ["%1 has been Sharpened",_displayName], "PLAIN DOWN"];
|
||||||
|
_msg = format ["%1 has been Sharpened",_displayName];
|
||||||
|
_msg call dayz_rollingMessages;
|
||||||
|
};
|
||||||
1
SQF/dayz_code/actions/player_switchWeapon_action.sqf
Normal file
1
SQF/dayz_code/actions/player_switchWeapon_action.sqf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1 call dz_fn_switchWeapon;
|
||||||
33
SQF/dayz_code/actions/player_takeArrow.sqf
Normal file
33
SQF/dayz_code/actions/player_takeArrow.sqf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
private["_qty_quivers","_control","_qty_quiverarrows","_empty","_emptymagslotcount"];
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
call gear_ui_init;
|
||||||
|
|
||||||
|
_qty_quivers = {_x == "Quiver"} count magazines player;
|
||||||
|
_control = uiNamespace getVariable 'uiControl';
|
||||||
|
_qty_quiverarrows = gearSlotAmmoCount _control;
|
||||||
|
|
||||||
|
//Remove melee magazines (BIS_fnc_invAdd fix) (add new melee ammo to array if needed)
|
||||||
|
{player removeMagazines _x} forEach ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Fishing_Swing"];
|
||||||
|
|
||||||
|
_empty = [player] call BIS_fnc_invSlotsEmpty;
|
||||||
|
_emptymagslotcount = _empty select 4; //empty magazines slots
|
||||||
|
|
||||||
|
if (_qty_quivers > 1) exitWith { cutText [localize "str_quiver_reachlimit", "PLAIN DOWN"];};
|
||||||
|
if (_qty_quiverarrows == 2) then { //remove quiver - add 2 arrows
|
||||||
|
if (_emptymagslotcount > 0) then {
|
||||||
|
player removeMagazine "Quiver";
|
||||||
|
player addMagazine "WoodenArrow";
|
||||||
|
player addMagazine "WoodenArrow";
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_24", "PLAIN DOWN"]; //Error
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (_emptymagslotcount > 0) then {
|
||||||
|
player removeMagazine "Quiver";
|
||||||
|
player addMagazine "WoodenArrow";
|
||||||
|
player addMagazine ["Quiver",_qty_quiverarrows-1];
|
||||||
|
} else {
|
||||||
|
cutText [localize "str_player_24", "PLAIN DOWN"]; //Error
|
||||||
|
};
|
||||||
|
};
|
||||||
58
SQF/dayz_code/actions/player_tearClothes.sqf
Normal file
58
SQF/dayz_code/actions/player_tearClothes.sqf
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
private ["_skin","_rnd","_rounded","_itemtocreate","_i"];
|
||||||
|
|
||||||
|
_skin = _this;
|
||||||
|
_config = configFile >> "CfgMagazines" >> _skin;
|
||||||
|
_itemtocreate = getText (_config >> "Craftoutput");
|
||||||
|
|
||||||
|
_rnd = random 3;
|
||||||
|
_rounded = round _rnd;
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
_infoText = "";
|
||||||
|
|
||||||
|
//Tear the clothes
|
||||||
|
player playActionNow "Medic";
|
||||||
|
[player,"bandage",0,false] call dayz_zombieSpeak;
|
||||||
|
sleep 6;
|
||||||
|
player removeMagazine _skin;
|
||||||
|
|
||||||
|
switch (_rounded) do {
|
||||||
|
case 0: {
|
||||||
|
cutText [localize "str_tear_clothes_0", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
case 1: {
|
||||||
|
cutText [localize "str_tear_clothes_1", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
case 2: {
|
||||||
|
cutText [localize "str_tear_clothes_2", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
case 3: {
|
||||||
|
cutText [localize "str_tear_clothes_3", "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_i = 0;
|
||||||
|
while {_i < _rounded} do {
|
||||||
|
_i = _i + 1;
|
||||||
|
_result = [player,_itemtocreate] call BIS_fnc_invAdd;
|
||||||
|
|
||||||
|
if (_rnd < 0.5) then {
|
||||||
|
[player,"equip_string"] call BIS_fnc_invAdd;
|
||||||
|
};
|
||||||
|
sleep 0.03;
|
||||||
|
|
||||||
|
if (!_result) then {
|
||||||
|
systemchat (localize ("str_tear_clothes_noroom"));
|
||||||
|
|
||||||
|
_nearByPile = nearestObjects [getPosATL player, ["WeaponHolder","WeaponHolderBase"], 2];
|
||||||
|
_pile = if (count _nearByPile > 0) then {_nearByPile select 0};
|
||||||
|
if (count _nearByPile == 0) then {
|
||||||
|
_pos = player modeltoWorld [0,1,0];
|
||||||
|
_pos set [2, 0];
|
||||||
|
//diag_log format [ "%1 itempos:%2 _nearByPile:%3", __FILE__, _pos, _nearByPile];
|
||||||
|
_pile = createVehicle ["WeaponHolder", _pos, [], 0.0, "CAN_COLLIDE"];
|
||||||
|
_pile setPosATL _pos;
|
||||||
|
};
|
||||||
|
_pile addMagazineCargoGlobal [_itemtocreate,1];
|
||||||
|
};
|
||||||
|
};
|
||||||
37
SQF/dayz_code/actions/player_useAttchment.sqf
Normal file
37
SQF/dayz_code/actions/player_useAttchment.sqf
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
private["_item","_onLadder","_hasmeditem","_config","_text","_id"];
|
||||||
|
|
||||||
|
//Old System
|
||||||
|
|
||||||
|
_item = _this;
|
||||||
|
|
||||||
|
//Other initail info
|
||||||
|
call gear_ui_init;
|
||||||
|
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||||
|
|
||||||
|
//Get config info
|
||||||
|
_config = configFile >> "CfgMagazines" >> _item;
|
||||||
|
_removeWeapon = getText (_config >> "oringal");
|
||||||
|
_addWeapon = getText (_config >> "weapon");
|
||||||
|
_text = getText (_config >> "displayName");
|
||||||
|
|
||||||
|
//item checks
|
||||||
|
_hasitem = _item in magazines player;
|
||||||
|
|
||||||
|
//fail saves
|
||||||
|
if (!_hasitem) exitWith { cutText [localize "str_missingAttachment", "PLAIN DOWN"]};
|
||||||
|
if (_onLadder) exitWith { cutText [localize "str_player_21", "PLAIN DOWN"] };
|
||||||
|
|
||||||
|
if (_removeWeapon in (weapons player)) then {
|
||||||
|
player removeMagazine _item;
|
||||||
|
player removeWeapon _removeWeapon;
|
||||||
|
player addWeapon _addWeapon;
|
||||||
|
|
||||||
|
if (vehicle player != player) then {
|
||||||
|
_display = findDisplay 106;
|
||||||
|
_display closeDisplay 0;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
closedialog 0;
|
||||||
|
sleep 0.2;
|
||||||
|
cutText [format[ localize "str_missingweapon", _text, _removeWeapon] , "PLAIN DOWN"]
|
||||||
|
};
|
||||||
387
SQF/dayz_code/actions/playerstats/determine_humanity_fnc.sqf
Normal file
387
SQF/dayz_code/actions/playerstats/determine_humanity_fnc.sqf
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
/********************************************************************************************************************/
|
||||||
|
// Function file for [DayZ]
|
||||||
|
// Created by: [Horde]
|
||||||
|
//********************************************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
private ["_h_human_disp","_top_value","_bot_value","_card_details","_h","_blank","_bandit_pic","_bandit_pic","_b_human_disp","_b_spades_top_suit","_b_spades_bot_suit","_b_clubs_top_suit","_b_clubs_bot_suit","_survivor_pic","_survivor_pic","_s_human_disp","_s_top_joker_b","_s_bot_joker_b","_s_top_joker_r","_s_bot_joker_r","_hero_pic","_hero_pic","_h_hearts_top_suit","_h_hearts_bot_suit","_h_diamonds_top_suit","_h_diamonds_bot_suit"];
|
||||||
|
_h = (_this select 0) / 37037.037037;
|
||||||
|
|
||||||
|
// we need to return these
|
||||||
|
/*
|
||||||
|
_pl_pic
|
||||||
|
_humanity_readout
|
||||||
|
_top_joker
|
||||||
|
_bot_joker
|
||||||
|
_top_value
|
||||||
|
_bot_value
|
||||||
|
_top_suit
|
||||||
|
_bot_suit
|
||||||
|
*/
|
||||||
|
_blank = "<img size = '4' color = '#000000' align = 'left' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\0.paa'/>";
|
||||||
|
|
||||||
|
_b_human_disp = "<t size = '2' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>"+(localize "str_playerstats_bandit")+"</t";
|
||||||
|
_b_spades_top_suit = "<img size = '3' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\spade.paa'/>";
|
||||||
|
_b_spades_bot_suit = "<img size = '3' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\spade_u.paa'/>";
|
||||||
|
_b_clubs_top_suit = "<img size = '3' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\club.paa'/>";
|
||||||
|
_b_clubs_bot_suit = "<img size = '3' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\club_u.paa'/>";
|
||||||
|
|
||||||
|
_s_human_disp = "<t size = '2' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>"+(localize "str_playerstats_survivor")+"</t";
|
||||||
|
_s_top_joker_b = "<img size = '11' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\joker\joker_black.paa'/>";
|
||||||
|
_s_bot_joker_b = "<img size = '11' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\joker\joker_black_u.paa'/>";
|
||||||
|
_s_top_joker_r = "<img size = '11' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\joker\joker_red.paa'/>";
|
||||||
|
_s_bot_joker_r = "<img size = '11' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\joker\joker_red_u.paa'/>";
|
||||||
|
|
||||||
|
_h_hearts_top_suit = "<img size = '3' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\heart.paa'/>";
|
||||||
|
_h_hearts_bot_suit = "<img size = '3' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\heart_u.paa'/>";
|
||||||
|
_h_diamonds_top_suit = "<img size = '3' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\diamond.paa'/>";
|
||||||
|
_h_diamonds_bot_suit = "<img size = '3' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\diamond_u.paa'/>";
|
||||||
|
|
||||||
|
if (getText(configFile >> "cfgVehicles" >> (typeOf player) >> "TextPlural") != "Women") then
|
||||||
|
{
|
||||||
|
_h_human_disp = "<t size = '2' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>"+(localize "str_playerstats_hero")+"</t";
|
||||||
|
_bandit_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\bandit_m.paa'/>";
|
||||||
|
_survivor_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\survivor_m.paa'/>";
|
||||||
|
_hero_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\hero_m.paa'/>";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_h_human_disp = "<t size = '2' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>"+(localize "str_playerstats_heroine")+"</t";
|
||||||
|
_bandit_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\bandit_f.paa'/>";
|
||||||
|
_survivor_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\survivor_f.paa'/>";
|
||||||
|
_hero_pic = "<img size = '14' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\face\hero_f.paa'/>";
|
||||||
|
};
|
||||||
|
|
||||||
|
_card_details = [];
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (_h < -27):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\ace.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\ace_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -26):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\king.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\king_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -25):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\queen.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\queen_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -24):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\jack.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\jack_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -23):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\10.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\10_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -22):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\9.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\9_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -21):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\8.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\8_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -20):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\7.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\7_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -19):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\6.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\6_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -18):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\5.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\5_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -17):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\4.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\4_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -16):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\3.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\3_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -15):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\2.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\2_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_spades_top_suit, _b_spades_bot_suit];
|
||||||
|
};
|
||||||
|
|
||||||
|
case (_h < -14):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\ace.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\ace_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -13):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\king.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\king_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -12):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\queen.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\queen_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -11):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\jack.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\jack_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -10):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\10.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\10_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -9):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\9.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\9_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -8):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\8.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\8_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -7):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\7.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\7_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -6):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\6.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\6_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -5):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\5.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\5_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -4):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\4.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\4_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -3):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\3.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\3_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < -0.135):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\2.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' color = '#000000' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_black\2_u.paa'/>";
|
||||||
|
_card_details = [_bandit_pic, _b_human_disp, _blank, _blank, _top_value, _bot_value, _b_clubs_top_suit, _b_clubs_bot_suit];
|
||||||
|
};
|
||||||
|
|
||||||
|
case (_h < 0):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '4' color = '#000000' align = 'left' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\0.paa'/>";
|
||||||
|
_card_details = [_survivor_pic, _s_human_disp, _s_top_joker_b, _s_bot_joker_b, _blank, _blank, _blank, _blank];
|
||||||
|
};
|
||||||
|
|
||||||
|
case (_h < 0.135):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '4' color = '#000000' align = 'left' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\0.paa'/>";
|
||||||
|
_card_details = [_survivor_pic, _s_human_disp, _s_top_joker_r, _s_bot_joker_r, _blank, _blank, _blank, _blank];
|
||||||
|
};
|
||||||
|
|
||||||
|
case (_h < 3):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\2.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\2_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 4):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\3.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\3_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 5):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\4.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\4_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 6):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\5.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\5_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 7):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\6.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\6_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 8):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\7.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\7_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 9):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\8.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\8_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 10):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\9.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\9_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 11):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\10.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\10_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 12):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\jack.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\jack_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 13):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\queen.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\queen_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 14):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\king.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\king_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 15):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\ace.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\ace_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_hearts_top_suit, _h_hearts_bot_suit];
|
||||||
|
};
|
||||||
|
|
||||||
|
case (_h < 16):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\2.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\2_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 17):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\3.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\3_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 18):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\4.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\4_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 19):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\5.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\5_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 20):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\6.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\6_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 21):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\7.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\7_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 22):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\8.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\8_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 23):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\9.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\9_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 24):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\10.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\10_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 25):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\jack.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\jack_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 26):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\queen.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\queen_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h < 27):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\king.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\king_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
case (_h >= 27):
|
||||||
|
{
|
||||||
|
_top_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\ace.paa'/>";
|
||||||
|
_bot_value = "<img size = '5' align = 'center' image = '\z\addons\dayz_communityassets\pictures\playerstats\cards\typeface_red\ace_u.paa'/>";
|
||||||
|
_card_details = [_hero_pic, _h_human_disp, _blank, _blank, _top_value, _bot_value, _h_diamonds_top_suit, _h_diamonds_bot_suit];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_card_details
|
||||||
70
SQF/dayz_code/actions/playerstats/epeen_setText_humanity.sqf
Normal file
70
SQF/dayz_code/actions/playerstats/epeen_setText_humanity.sqf
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
|
||||||
|
|
||||||
|
private ["_hum","_h","_humanity","_pl_pic","_humanity_readout","_top_joker","_bot_joker","_top_value","_bot_value","_top_suit","_bot_suit","_pl_name"];
|
||||||
|
|
||||||
|
//check humanity
|
||||||
|
|
||||||
|
_h = player getVariable["humanity", 0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
IDC's
|
||||||
|
1201 // middle
|
||||||
|
1202 // bottom
|
||||||
|
1203 // top
|
||||||
|
1204 // pic on right hand page
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (_h < -666666):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_bottom_1.paa"];
|
||||||
|
ctrlSetText [1203, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_top_1.paa"];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_3.paa"];
|
||||||
|
};
|
||||||
|
case (_h < -333333):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, ""];
|
||||||
|
ctrlSetText [1203, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_top_1.paa"];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_2.paa"];
|
||||||
|
};
|
||||||
|
case (_h < -1999):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, ""];
|
||||||
|
ctrlSetText [1203, ""];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_bandit_1.paa"];
|
||||||
|
};
|
||||||
|
case (_h < 5000):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, ""];
|
||||||
|
ctrlSetText [1202, ""];
|
||||||
|
ctrlSetText [1203, ""];
|
||||||
|
ctrlSetText [1204, ""];
|
||||||
|
};
|
||||||
|
case (_h < 333333):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, ""];
|
||||||
|
ctrlSetText [1203, ""];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_hero_1.paa"];
|
||||||
|
};
|
||||||
|
case (_h < 666666):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, ""];
|
||||||
|
ctrlSetText [1203, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_top_1.paa"];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_hero_2.paa"];
|
||||||
|
};
|
||||||
|
case (_h >= 666666):
|
||||||
|
{
|
||||||
|
ctrlSetText [1201, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_middle_1.paa"];
|
||||||
|
ctrlSetText [1202, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_bottom_1.paa"];
|
||||||
|
ctrlSetText [1203, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_heropic_top_1.paa"];
|
||||||
|
ctrlSetText [1204, "\z\addons\dayz_communityassets\pictures\playerstats\humanity\humanity_hero_3.paa"];
|
||||||
|
};
|
||||||
|
};
|
||||||
305
SQF/dayz_code/actions/playerstats/epeen_setText_journal.sqf
Normal file
305
SQF/dayz_code/actions/playerstats/epeen_setText_journal.sqf
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
private ["_ys","_ms","_ds","_b","_2","_6","_7","_8","_9","_10","_str_left_text","_1","_3","_4","_5","_blood_in_pack","_blood_in_inv","_mag_arr","_backpack","_11","_mags_for_weap","_mssv_cnt","_weapon","_config"];
|
||||||
|
|
||||||
|
_survivors = playersNumber west;
|
||||||
|
|
||||||
|
_str_left_text = "
|
||||||
|
<t size = '1.4' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'left'>
|
||||||
|
"+(localize "str_playerstats_journal_1")+"
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
"+(localize "str_playerstats_journal_2")+"
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
%7%8%9 %10
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
%11
|
||||||
|
</t>
|
||||||
|
";
|
||||||
|
|
||||||
|
_1 = name player;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (player hasWeapon "ItemWatch") then
|
||||||
|
{
|
||||||
|
if (dayz_Survived == Dayz_logonDate) then // only interested if the same - assume server will only run over one day before restart
|
||||||
|
{
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (Dayz_logonTime > 20): {_2 = (localize "str_playerstats_journal_1_a")};
|
||||||
|
case (Dayz_logonTime > 17): {_2 = (localize "str_playerstats_journal_1_b")};
|
||||||
|
case (Dayz_logonTime > 12): {_2 = (localize "str_playerstats_journal_1_c")};
|
||||||
|
default {_2 = (localize "str_playerstats_journal_1_d")};
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (Dayz_logonTime > 20): {_2 = (localize "str_playerstats_journal_1_e")};
|
||||||
|
case (Dayz_logonTime > 17): {_2 = (localize "str_playerstats_journal_1_f")};
|
||||||
|
case (Dayz_logonTime > 12): {_2 = (localize "str_playerstats_journal_1_g")};
|
||||||
|
default {_2 = (localize "str_playerstats_journal_1_h")};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_2 = (localize "str_playerstats_journal_1_i");
|
||||||
|
};
|
||||||
|
|
||||||
|
_3 = Dayz_logonTown;
|
||||||
|
|
||||||
|
_4 = worldName;
|
||||||
|
|
||||||
|
_ys = str (date select 0);
|
||||||
|
_ms = "";
|
||||||
|
_ds = str (date select 2);
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (date select 1 == 1):{_ms = (localize "str_playerstats_journal_month_1")};
|
||||||
|
case (date select 1 == 2):{_ms = (localize "str_playerstats_journal_month_2")};
|
||||||
|
case (date select 1 == 3):{_ms = (localize "str_playerstats_journal_month_3")};
|
||||||
|
case (date select 1 == 4):{_ms = (localize "str_playerstats_journal_month_4")};
|
||||||
|
case (date select 1 == 5):{_ms = (localize "str_playerstats_journal_month_5")};
|
||||||
|
case (date select 1 == 6):{_ms = (localize "str_playerstats_journal_month_6")};
|
||||||
|
case (date select 1 == 7):{_ms = (localize "str_playerstats_journal_month_7")};
|
||||||
|
case (date select 1 == 8):{_ms = (localize "str_playerstats_journal_month_8")};
|
||||||
|
case (date select 1 == 9):{_ms = (localize "str_playerstats_journal_month_9")};
|
||||||
|
case (date select 1 == 10):{_ms =(localize "str_playerstats_journal_month_10")};
|
||||||
|
case (date select 1 == 11):{_ms =(localize "str_playerstats_journal_month_11")};
|
||||||
|
case (date select 1 == 12):{_ms =(localize "str_playerstats_journal_month_12")};
|
||||||
|
};
|
||||||
|
|
||||||
|
_5 = format[localize "str_playerstats_journal_2_date", _ds, _ms, _ys];
|
||||||
|
|
||||||
|
// can't test dayz_Survived at home
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (dayz_Survived == 0): {_6 = (localize "str_playerstats_journal_2_info_1")};
|
||||||
|
case (dayz_Survived == 1): {_6 = (localize "str_playerstats_journal_2_info_2")};
|
||||||
|
case (dayz_Survived > 1): {_6 = format [localize "str_playerstats_journal_2_info_3", dayz_Survived]};
|
||||||
|
default {};
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (!r_fracture_legs and !r_fracture_arms): {_7 = (localize "str_playerstats_journal_3_1")};
|
||||||
|
case (r_fracture_legs and r_fracture_arms): {_7 = (localize "str_playerstats_journal_3_2")};
|
||||||
|
case (r_fracture_legs): {_7 = (localize "str_playerstats_journal_3_3")};
|
||||||
|
case (r_fracture_arms): {_7 = (localize "str_playerstats_journal_3_4")};
|
||||||
|
default {};
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (r_player_infected):
|
||||||
|
{
|
||||||
|
if (!r_fracture_legs and !r_fracture_arms) then
|
||||||
|
{
|
||||||
|
_8 = (localize "str_playerstats_journal_4_1");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_8 = (localize "str_playerstats_journal_4_2");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default {_8 = ""};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (r_fracture_legs or r_fracture_arms) then
|
||||||
|
{
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (r_player_blood < 3000): {_9 = (localize "str_playerstats_journal_5_1")};
|
||||||
|
case (r_player_blood < 6000): {_9 = (localize "str_playerstats_journal_5_2")};
|
||||||
|
case (r_player_blood < 9000): {_9 = (localize "str_playerstats_journal_5_3")};
|
||||||
|
case (r_player_blood < 11000): {_9 = (localize "str_playerstats_journal_5_4")};
|
||||||
|
case (r_player_blood == 12000): {_9 = (localize "str_playerstats_journal_5_5")};
|
||||||
|
default {_9 = "."};
|
||||||
|
};
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (r_player_blood < 3000): {_9 = (localize "str_playerstats_journal_5_6")};
|
||||||
|
case (r_player_blood < 6000): {_9 = (localize "str_playerstats_journal_5_7")};
|
||||||
|
case (r_player_blood < 9000): {_9 = (localize "str_playerstats_journal_5_8")};
|
||||||
|
case (r_player_blood < 11000): {_9 = (localize "str_playerstats_journal_5_9")};
|
||||||
|
case (r_player_blood == 12000):
|
||||||
|
{
|
||||||
|
if (r_player_infected) then
|
||||||
|
{
|
||||||
|
_9 = (localize "str_playerstats_journal_5_10");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_9 = (localize "str_playerstats_journal_5_11");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default {_9 = "."};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_blood_in_pack = false;
|
||||||
|
_backpack = unitBackpack player;
|
||||||
|
|
||||||
|
if (!isNull _backpack) then
|
||||||
|
{
|
||||||
|
_mag_arr = getMagazineCargo _backpack;
|
||||||
|
if ("ItemBloodbag" in (_mag_arr select 0)) then
|
||||||
|
{
|
||||||
|
_blood_in_pack = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_blood_in_inv = false;
|
||||||
|
|
||||||
|
if ("ItemBloodbag" in (magazines player)) then
|
||||||
|
{
|
||||||
|
_blood_in_inv = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
_10 = "";
|
||||||
|
|
||||||
|
if (r_player_blood < 9000 and (_blood_in_inv or _blood_in_pack)) then
|
||||||
|
{
|
||||||
|
if (_blood_in_inv) then
|
||||||
|
{
|
||||||
|
_10 = (localize "str_playerstats_journal_6_1");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_10 = (localize "str_playerstats_journal_6_2");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (r_player_blood < 9000 and ! _blood_in_inv and ! _blood_in_pack) then
|
||||||
|
{
|
||||||
|
_10 = (localize "str_playerstats_journal_6_3");
|
||||||
|
};
|
||||||
|
|
||||||
|
_11 = "";
|
||||||
|
|
||||||
|
_weapon = currentWeapon player;
|
||||||
|
_config = configFile >> "CfgWeapons";
|
||||||
|
|
||||||
|
// possibly filter out torch and the dayz_throwweapon thingy too. Need to get feedback..
|
||||||
|
|
||||||
|
if (_weapon != "" and _weapon != "Throw" and _weapon != "Put" and _weapon != "Flare") then
|
||||||
|
{
|
||||||
|
switch (true) do
|
||||||
|
{
|
||||||
|
case (getText (_config >> _weapon >> "melee") == "true"): // used getText as config entry had "" marks around it.
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_1", getText (_config >> _weapon >> "displayName")];
|
||||||
|
};
|
||||||
|
case (_weapon == "ItemFlashlight" or _weapon == "ItemFlashlightRed"):
|
||||||
|
{
|
||||||
|
if (sunOrMoon == 1) then
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_2", getText (_config >> _weapon >> "displayName")];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_3", getText (_config >> _weapon >> "displayName")];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case (_weapon == "Makarov"):
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_4", getText (_config >> _weapon >> "displayName")];
|
||||||
|
};
|
||||||
|
default
|
||||||
|
{
|
||||||
|
_mags_for_weap = getArray (_config >> _weapon >> "magazines");
|
||||||
|
|
||||||
|
_mssv_cnt = false;
|
||||||
|
{
|
||||||
|
if (_x in _mags_for_weap) then
|
||||||
|
{
|
||||||
|
_mssv_cnt = true;
|
||||||
|
};
|
||||||
|
} forEach (magazines player);
|
||||||
|
|
||||||
|
if (_mssv_cnt) then
|
||||||
|
{
|
||||||
|
if (player ammo _weapon > 0) then
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_5", getText (configFile >> "CfgWeapons" >> _weapon >> "displayName")];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_6", getText (configFile >> "CfgWeapons" >> _weapon >> "displayName")];
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_11 = format [localize "str_playerstats_journal_7_7", getText (_config >> _weapon >> "displayName")];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
_11 = (localize "str_playerstats_journal_7_8");
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
_moon = if (dayz_ForcefullmoonNights) then { "Yes" } else { "No" };
|
||||||
|
|
||||||
|
_spawnselection = switch (dayz_spawnselection) do {
|
||||||
|
case 1: { "Yes" };
|
||||||
|
case 0: { "No" };
|
||||||
|
};
|
||||||
|
|
||||||
|
_disabledTemperature = switch (dayz_temperature_override) do {
|
||||||
|
case true: { "Disabled" };
|
||||||
|
case false: { "Enabled" };
|
||||||
|
};
|
||||||
|
|
||||||
|
// left page
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1800) ctrlSetStructuredText parseText format ["
|
||||||
|
<br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Health: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%1</t><br/>
|
||||||
|
<br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Hunger: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%2%</t><br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Thirst: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%3%</t><br/>
|
||||||
|
<br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Temp: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%5/%13</t><br/>
|
||||||
|
<br />
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Humanity: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%6</t><br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Zombies: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%7</t><br/>
|
||||||
|
<br />
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>SpawnSelection: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%4</t><br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='left'>Full Moon: </t><t size='2' font='Zeppelin33' align='right' color='#FF0033'>%12</t><br/>
|
||||||
|
<br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='center'>Survived: %8 Day(s)</t><br/>
|
||||||
|
<br />
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='center'>Survivors:%9</t><br/>
|
||||||
|
<br/>
|
||||||
|
<t size='2' font='Zeppelin33' color = '#000000' align='center'>FPS:%10, FPSMin:%11</t><br/>
|
||||||
|
",
|
||||||
|
(round(r_player_blood)),
|
||||||
|
//(player getVariable['USEC_BloodQty', r_player_blood]),
|
||||||
|
//(r_player_bloodpersec),
|
||||||
|
//(r_player_foodstack),
|
||||||
|
//(r_player_bloodregen),
|
||||||
|
(round(dayz_hunger)),
|
||||||
|
(round(dayz_thirst)),
|
||||||
|
(_spawnselection),
|
||||||
|
(round(dayz_temperatur)),
|
||||||
|
(player getVariable['humanity', 0]),
|
||||||
|
({alive _x} count entities "zZombie_Base"),
|
||||||
|
(dayz_Survived),
|
||||||
|
(_survivors),
|
||||||
|
(round diag_fps),
|
||||||
|
(round diag_fpsmin),
|
||||||
|
(_moon),
|
||||||
|
(_disabledTemperature)
|
||||||
|
];
|
||||||
|
|
||||||
|
// right page - blank until humanity is checked
|
||||||
|
|
||||||
|
_b = "<img size = '5' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\0.paa'/>";
|
||||||
|
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1801) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1802) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1803) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1804) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1805) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1806) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1807) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1808) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1809) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
33
SQF/dayz_code/actions/playerstats/epeen_setText_stats.sqf
Normal file
33
SQF/dayz_code/actions/playerstats/epeen_setText_stats.sqf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/********************************************************************************************************************/
|
||||||
|
// Function file for [DayZ]
|
||||||
|
// Created by: [Horde]
|
||||||
|
//********************************************************************************************************************/
|
||||||
|
|
||||||
|
private ["_pge","_tally_idc_arr","_need_to_blank_idc_arr","_kills","_5","_4","_3","_2","_1","_b"];
|
||||||
|
|
||||||
|
if (isDedicated) exitWith {};
|
||||||
|
|
||||||
|
// _pge = _this select 0;
|
||||||
|
|
||||||
|
_kills = _this select 0;
|
||||||
|
|
||||||
|
_5 = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\5.paa'/>";
|
||||||
|
_4 = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\4.paa'/>";
|
||||||
|
_3 = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\3.paa'/>";
|
||||||
|
_2 = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\2.paa'/>";
|
||||||
|
_1 = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\1.paa'/>";
|
||||||
|
_b = "<img size = '4.8' image = '\z\addons\dayz_communityassets\pictures\playerstats\tally\0.paa'/>";
|
||||||
|
|
||||||
|
// array of IDC's for tallys
|
||||||
|
|
||||||
|
_tally_idc_arr = [1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238];
|
||||||
|
|
||||||
|
// array of IDC's for journal pages
|
||||||
|
|
||||||
|
_need_to_blank_idc_arr = [1800,1801,1802,1803,1804,1805,1806,1807,1808,1809];
|
||||||
|
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
} forEach _need_to_blank_idc_arr;
|
||||||
|
|
||||||
|
[_kills, _5, _4, _3, _2, _1, _b, _tally_idc_arr] call horde_epeen_fnc_fill_page;
|
||||||
62
SQF/dayz_code/actions/playerstats/fill_page_fnc.sqf
Normal file
62
SQF/dayz_code/actions/playerstats/fill_page_fnc.sqf
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/********************************************************************************************************************/
|
||||||
|
// Function file for [DayZ]
|
||||||
|
// Created by: [Horde]
|
||||||
|
//********************************************************************************************************************/
|
||||||
|
|
||||||
|
private ["_count","_kills","_5","_4","_3","_2","_1","_b","_idc_arr","_extra_kills","_tally_kills","_full_box_count","_partial_box_tally","_add_kills"];
|
||||||
|
|
||||||
|
_kills = _this select 0;
|
||||||
|
_5 = _this select 1;
|
||||||
|
_4 = _this select 2;
|
||||||
|
_3 = _this select 3;
|
||||||
|
_2 = _this select 4;
|
||||||
|
_1 = _this select 5;
|
||||||
|
_b = _this select 6;
|
||||||
|
_idc_arr = _this select 7;
|
||||||
|
|
||||||
|
_extra_kills = 175 * (floor (_kills / 175));
|
||||||
|
_tally_kills = _kills - _extra_kills;
|
||||||
|
_full_box_count = floor (_tally_kills / 5);
|
||||||
|
_partial_box_tally = _tally_kills - (5 * (floor (_tally_kills / 5)));
|
||||||
|
_add_kills = "<t size = '3' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>+</t>
|
||||||
|
" + format ["<t size = '3' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>%1", _extra_kills];
|
||||||
|
|
||||||
|
_count = 1;
|
||||||
|
{
|
||||||
|
if (_count <= _full_box_count) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _5];
|
||||||
|
};
|
||||||
|
if (_count == _full_box_count + 1) then
|
||||||
|
{
|
||||||
|
if (_partial_box_tally == 4) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _4];
|
||||||
|
};
|
||||||
|
if (_partial_box_tally == 3) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _3];
|
||||||
|
};
|
||||||
|
if (_partial_box_tally == 2) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _2];
|
||||||
|
};
|
||||||
|
if (_partial_box_tally == 1) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _1];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_count > _full_box_count + 1) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl _x) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
};
|
||||||
|
_count = _count + 1;
|
||||||
|
} forEach _idc_arr;
|
||||||
|
// additional kills
|
||||||
|
if (_extra_kills > 0) then
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1239) ctrlSetStructuredText parseText format ["<br />%1", _add_kills];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1239) ctrlSetStructuredText parseText format ["%1", _b];
|
||||||
|
};
|
||||||
34
SQF/dayz_code/actions/playerstats/show_humanity_fnc.sqf
Normal file
34
SQF/dayz_code/actions/playerstats/show_humanity_fnc.sqf
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/********************************************************************************************************************/
|
||||||
|
// Function file for [DayZ]
|
||||||
|
// Created by: [Horde]
|
||||||
|
//********************************************************************************************************************/
|
||||||
|
|
||||||
|
private ["_hum","_humanity","_pl_pic","_humanity_readout","_top_joker","_bot_joker","_top_value","_bot_value","_top_suit","_bot_suit","_pl_name"];
|
||||||
|
|
||||||
|
//check humanity
|
||||||
|
|
||||||
|
_humanity = player getVariable["humanity", 0];
|
||||||
|
|
||||||
|
_hum = [_humanity] call horde_epeen_determine_humanity_fnc;
|
||||||
|
|
||||||
|
_pl_pic = _hum select 0;
|
||||||
|
_humanity_readout = _hum select 1;
|
||||||
|
_top_joker = _hum select 2;
|
||||||
|
_bot_joker = _hum select 3;
|
||||||
|
_top_value = _hum select 4;
|
||||||
|
_bot_value = _hum select 5;
|
||||||
|
_top_suit = _hum select 6;
|
||||||
|
_bot_suit = _hum select 7;
|
||||||
|
_pl_name = format ["<t size = '1.1' font = 'Zeppelin33' color = '#000000' shadow = 'false' align = 'center' underline = 'false'>%1</t", name player];
|
||||||
|
|
||||||
|
ctrlShow [1906, false];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1801) ctrlSetStructuredText parseText format ["%1", _top_value];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1802) ctrlSetStructuredText parseText format ["%1", _bot_value];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1803) ctrlSetStructuredText parseText format ["%1", _top_suit];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1804) ctrlSetStructuredText parseText format ["%1", _bot_suit];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1805) ctrlSetStructuredText parseText format ["%1", _top_joker];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1806) ctrlSetStructuredText parseText format ["%1", _bot_joker];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1807) ctrlSetStructuredText parseText format ["%1", _pl_pic];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1808) ctrlSetStructuredText parseText format ["%1", _pl_name];
|
||||||
|
((uiNamespace getVariable "horde_myDisplay") displayCtrl 1809) ctrlSetStructuredText parseText format ["%1", _humanity_readout];
|
||||||
|
ctrlShow [1907, false];
|
||||||
29
SQF/dayz_code/eventHandlers/processSetAccessCode.sqf
Normal file
29
SQF/dayz_code/eventHandlers/processSetAccessCode.sqf
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
private ["_unitSending","_object","_object","_code"];
|
||||||
|
_unitSending = _this select 0;
|
||||||
|
_object = _this select 1;
|
||||||
|
_code = _this select 2;
|
||||||
|
|
||||||
|
//diag_log format["%1, %2-%3",_unitSending,_object,_code];
|
||||||
|
|
||||||
|
_ownerID = owner _unitSending;
|
||||||
|
_ownerArray = _object getVariable ["ownerArray",["0"]];
|
||||||
|
|
||||||
|
if ((_ownerArray select 0) == (getPlayerUID _unitSending)) then {
|
||||||
|
if (_unitSending distance _object < 5) then {
|
||||||
|
_object setVariable ["dayz_padlockCombination",_code,false];
|
||||||
|
|
||||||
|
PVCDZ_Client_processAccessCode = [_code];
|
||||||
|
_ownerID publicVariableClient "PVCDZ_Client_processAccessCode";
|
||||||
|
|
||||||
|
[_object,"accessCode",_code] call server_updateObject;
|
||||||
|
|
||||||
|
_object setVariable ["dayz_padlockHistory", [], true];
|
||||||
|
_object setVariable ["dayz_padlockLockStatus", true,true];
|
||||||
|
|
||||||
|
diag_log format["INFO: %1, %5 has changed the access code for %2 with %3 at time %4",(name _unitSending),(typeof _object),_code,time,(getPlayerUID _unitSending)];
|
||||||
|
} else {
|
||||||
|
diag_log format["WARNING: %1, %5 is asking to change access code of %2 from a distance of %3 at time %4",(name _unitSending),(typeof _object),(_unit distance _object),time,(getPlayerUID _unitSending)];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
diag_log format["WARNING: %1, %2 is trying to set a code for a gate he does not own.",(name _unitSending),(getPlayerUID _unitSending)];
|
||||||
|
};
|
||||||
14
SQF/dayz_code/loot/Loot.hpp
Normal file
14
SQF/dayz_code/loot/Loot.hpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _INCLUDE_GUARD_LOOT
|
||||||
|
#define _INCLUDE_GUARD_LOOT
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\Configs\CfgLoot\LootDefines.hpp"
|
||||||
|
|
||||||
|
#define Loot_GetGroup(name) (dz_loot_groups find (name))
|
||||||
|
#define Loot_Select(group, count) ([group, count] call dz_fn_loot_select)
|
||||||
|
#define Loot_SelectSingle(group) (Loot_Select(group, 1) select 0)
|
||||||
|
#define Loot_Spawn(def, loc) ([def, loc] call dz_fn_loot_spawn)
|
||||||
|
#define Loot_SpawnGroup(group, loc) ([group, loc] call dz_fn_loot_spawnGroup)
|
||||||
|
#define Loot_Insert(unit, group, count) ([unit, group, count] call dz_fn_loot_insert)
|
||||||
|
#define Loot_InsertCargo(object, group, count) ([object, group, count] call dz_fn_loot_insertCargo)
|
||||||
|
|
||||||
|
#endif
|
||||||
13
SQF/dayz_code/loot/compile.sqf
Normal file
13
SQF/dayz_code/loot/compile.sqf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#define STRINGIFY(x) #x
|
||||||
|
#define NAME(name) dz_fn_loot_##name
|
||||||
|
#define PATH(sub_path) STRINGIFY(\z\addons\dayz_code\loot\sub_path)
|
||||||
|
#define CPP compile preprocessFileLineNumbers
|
||||||
|
|
||||||
|
NAME(select) = CPP PATH(select.sqf);
|
||||||
|
NAME(spawn) = CPP (if (isServer) then { PATH(spawn_server.sqf) } else { PATH(spawn.sqf) });
|
||||||
|
NAME(spawnGroup) = CPP PATH(spawnGroup.sqf);
|
||||||
|
NAME(insert) = CPP PATH(insert.sqf);
|
||||||
|
NAME(insertCargo) = CPP PATH(insertCargo.sqf);
|
||||||
|
|
||||||
|
//Loot init
|
||||||
|
call CPP PATH(init.sqf);
|
||||||
141
SQF/dayz_code/loot/init.sqf
Normal file
141
SQF/dayz_code/loot/init.sqf
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
#include "\z\addons\dayz_code\util\math.hpp"
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
//If defined, minimizes memory usage at the expense of initialization time.
|
||||||
|
//#define MINIMIZE_MEMORY
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_cfgGroups",
|
||||||
|
"_cfg",
|
||||||
|
"_lootGroup",
|
||||||
|
"_weight",
|
||||||
|
"_weighted",
|
||||||
|
"_index",
|
||||||
|
"_indices",
|
||||||
|
"_count",
|
||||||
|
"_gcd"
|
||||||
|
];
|
||||||
|
|
||||||
|
#ifdef MINIMIZE_MEMORY
|
||||||
|
private ["_lootDefCompare", "_y", "_a", "_b", "_r"];
|
||||||
|
|
||||||
|
_lootDefCompare =
|
||||||
|
{
|
||||||
|
_a = _this select 0;
|
||||||
|
_b = _this select 1;
|
||||||
|
|
||||||
|
if ((_a select 0) != (_b select 0)) exitWith { false };
|
||||||
|
if ((_a select 1) != (_b select 1)) exitWith { false };
|
||||||
|
|
||||||
|
_r = true;
|
||||||
|
|
||||||
|
switch (_a select 0) do
|
||||||
|
{
|
||||||
|
case Loot_PILE:
|
||||||
|
{
|
||||||
|
_r = ((_a select 2) == (_b select 2)) &&
|
||||||
|
{(_a select 3) == (_b select 3)};
|
||||||
|
};
|
||||||
|
|
||||||
|
case Loot_CONTAINER:
|
||||||
|
{
|
||||||
|
_r = ((_a select 2) == (_b select 2)) &&
|
||||||
|
{(_a select 3) == (_b select 3)} &&
|
||||||
|
{(_a select 4) == (_b select 4)};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_r
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
dz_loot_groups = [];
|
||||||
|
dz_loot_weighted = [];
|
||||||
|
dz_loot_definitions = [];
|
||||||
|
|
||||||
|
_cfgGroups = (configFile >> "CfgLoot" >> "Groups");
|
||||||
|
|
||||||
|
for "_i" from 0 to (count _cfgGroups) - 1 do
|
||||||
|
{
|
||||||
|
_cfg = _cfgGroups select _i;
|
||||||
|
dz_loot_groups set [_i, configName _cfg];
|
||||||
|
};
|
||||||
|
|
||||||
|
dz_loot_weighted resize count dz_loot_groups;
|
||||||
|
|
||||||
|
for "_i" from 0 to (count _cfgGroups) - 1 do
|
||||||
|
{
|
||||||
|
_lootGroup = getArray (_cfgGroups select _i);
|
||||||
|
_weighted = [];
|
||||||
|
|
||||||
|
if ((count _lootGroup) > 0) then
|
||||||
|
{
|
||||||
|
_indices = [];
|
||||||
|
_indices resize count _lootGroup;
|
||||||
|
|
||||||
|
{
|
||||||
|
_weight = _x select 1;
|
||||||
|
|
||||||
|
//Remove weight from _x
|
||||||
|
for "_j" from 1 to (count _x) - 2 do { _x set [_j, _x select (_j + 1)]; };
|
||||||
|
_x resize ((count _x) - 1);
|
||||||
|
|
||||||
|
_index = -1;
|
||||||
|
|
||||||
|
//Search for an existing identical loot definition
|
||||||
|
#ifdef MINIMIZE_MEMORY
|
||||||
|
_y = _x;
|
||||||
|
{
|
||||||
|
if ([_y, _x] call _lootDefCompare) exitWith
|
||||||
|
{
|
||||||
|
_index = _forEachIndex;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
foreach dz_loot_definitions;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Existing loot definition not found, add it and set the index to point to the new definition
|
||||||
|
if (_index == -1) then
|
||||||
|
{
|
||||||
|
_index = count dz_loot_definitions;
|
||||||
|
dz_loot_definitions set [_index, _x];
|
||||||
|
};
|
||||||
|
|
||||||
|
_lootGroup set [_forEachIndex, round(_weight * 100)];
|
||||||
|
_indices set [_forEachIndex, _index];
|
||||||
|
}
|
||||||
|
foreach _lootGroup;
|
||||||
|
|
||||||
|
//Calculate GCD of all the weights
|
||||||
|
_gcd = Math_GCDArray(_lootGroup);
|
||||||
|
//_gcd = _lootGroup call math_gcdx;
|
||||||
|
|
||||||
|
_count = 0;
|
||||||
|
{
|
||||||
|
_weight = _x / _gcd;
|
||||||
|
_weighted resize (_count + _weight);
|
||||||
|
|
||||||
|
for "_j" from _count to (_count + _weight - 1) do
|
||||||
|
{
|
||||||
|
_weighted set [_j, _indices select _forEachIndex];
|
||||||
|
};
|
||||||
|
|
||||||
|
_count = _count + _weight;
|
||||||
|
}
|
||||||
|
foreach _lootGroup;
|
||||||
|
};
|
||||||
|
|
||||||
|
dz_loot_weighted set [_i, _weighted];
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
switch (_x select 0) do
|
||||||
|
{
|
||||||
|
case Loot_GROUP: { _x set [1, dz_loot_groups find (_x select 1)]; };
|
||||||
|
case Loot_PILE: { _x set [1, dz_loot_groups find (_x select 1)]; };
|
||||||
|
case Loot_CONTAINER: { _x set [2, dz_loot_groups find (_x select 2)]; };
|
||||||
|
case Loot_CUSTOM: { _x set [1, compile (_x select 1)]; };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
foreach dz_loot_definitions;
|
||||||
48
SQF/dayz_code/loot/insert.sqf
Normal file
48
SQF/dayz_code/loot/insert.sqf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Selects random loot from specified group and inserts into a unit.
|
||||||
|
Loot group should only contain Loot_WEAPON and Loot_MAGAZINE definitions. Others, if selected, will be ignored.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
object Unit to insert into.
|
||||||
|
integer Loot group index in dayz_lootGroups
|
||||||
|
integer Number of items to insert.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\util\debug.hpp"
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
if (!local (_this select 0)) exitWith
|
||||||
|
{
|
||||||
|
diag_log format ["ERROR: Loot_Insert unit must be local. (%1)", _this select 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
switch (_x select 0) do
|
||||||
|
{
|
||||||
|
case Loot_WEAPON:
|
||||||
|
{
|
||||||
|
(_this select 0) addWeapon (_x select 1);
|
||||||
|
|
||||||
|
Debug_Assert(typeName (_x select 1) == typeName "" && { (_x select 1) != "" });
|
||||||
|
//Debug_Log(String_Format2("DEBUG: Loot_Insert Weapon: %1 Unit: %2", _x select 1, _this select 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
case Loot_MAGAZINE:
|
||||||
|
{
|
||||||
|
(_this select 0) addMagazine (_x select 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
case Loot_BACKPACK:
|
||||||
|
{
|
||||||
|
if (!isNull unitBackpack (_this select 0)) then
|
||||||
|
{
|
||||||
|
(_this select 0) addBackpack (_x select 1);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
foreach Loot_Select(_this select 1, _this select 2);
|
||||||
|
//foreach ([_this select 1, _this select 2] call loot_select);
|
||||||
40
SQF/dayz_code/loot/insertCargo.sqf
Normal file
40
SQF/dayz_code/loot/insertCargo.sqf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Selects random loot from specified group and inserts into a container.
|
||||||
|
Loot group should only contain Loot_WEAPON and Loot_MAGAZINE definitions. Others, if selected, will be ignored.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
object Vehicle to insert into.
|
||||||
|
integer Loot group index in dayz_lootGroups
|
||||||
|
integer Number of items to insert.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\util\debug.hpp"
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
{
|
||||||
|
switch (_x select 0) do
|
||||||
|
{
|
||||||
|
case Loot_WEAPON:
|
||||||
|
{
|
||||||
|
(_this select 0) addWeaponCargoGlobal [_x select 1, 1];
|
||||||
|
|
||||||
|
Debug_Assert(typeName (_x select 1) == typeName "" && { (_x select 1) != "" });
|
||||||
|
//Debug_Log(String_Format2("DEBUG: Loot_Insert Weapon: %1 Vehicle: %2", _x select 1, _this select 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
case Loot_MAGAZINE:
|
||||||
|
{
|
||||||
|
(_this select 0) addMagazineCargoGlobal [_x select 1, 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
case Loot_BACKPACK:
|
||||||
|
{
|
||||||
|
(_this select 0) addBackpackCargoGlobal [_x select 1, 1];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
foreach Loot_Select(_this select 1, _this select 2);
|
||||||
|
//foreach ([_this select 1, _this select 2] call loot_select);
|
||||||
48
SQF/dayz_code/loot/select.sqf
Normal file
48
SQF/dayz_code/loot/select.sqf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Selects random items from loot tables defined in bin\config.bin/CfgLoot/Groups
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
integer Loot group index
|
||||||
|
integer Number of items to select.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_lootGroup",
|
||||||
|
"_lootNum",
|
||||||
|
"_result",
|
||||||
|
"_weighted",
|
||||||
|
"_def",
|
||||||
|
"_sub"
|
||||||
|
];
|
||||||
|
|
||||||
|
_lootGroup = _this select 0;
|
||||||
|
_lootNum = _this select 1;
|
||||||
|
|
||||||
|
if (_lootNum < 1 || _lootGroup < 0) exitWith { [] };
|
||||||
|
|
||||||
|
//Initialize the result array
|
||||||
|
_result = [];
|
||||||
|
_result resize _lootNum;
|
||||||
|
|
||||||
|
_weighted = dz_loot_weighted select _lootGroup;
|
||||||
|
|
||||||
|
for "_i" from 0 to _lootNum - 1 do
|
||||||
|
{
|
||||||
|
_def = dz_loot_definitions select (_weighted select floor random count _weighted);
|
||||||
|
|
||||||
|
while {(_def select 0) == Loot_GROUP} do
|
||||||
|
{
|
||||||
|
_sub = dz_loot_weighted select (_def select 1);
|
||||||
|
_def = dz_loot_definitions select (_sub select floor random count _sub);
|
||||||
|
};
|
||||||
|
|
||||||
|
_result set [_i, _def];
|
||||||
|
};
|
||||||
|
|
||||||
|
_result
|
||||||
149
SQF/dayz_code/loot/spawn.sqf
Normal file
149
SQF/dayz_code/loot/spawn.sqf
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
Spawns the specified loot definition at the specified location.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
array Loot definition
|
||||||
|
vector Spawn position relative to world
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
object Spawned vehicle.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "\z\addons\dayz_code\util\debug.hpp"
|
||||||
|
#include "\z\addons\dayz_code\util\vector.hpp"
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
//Maximum number of magazines spawned along with weapons
|
||||||
|
#define MAX_WEAPON_MAGAZINES 2
|
||||||
|
|
||||||
|
//If defined spawns random (but applicable) magazines along with weapons instead of their primary type.
|
||||||
|
//#define COMPLEX_WEAPON_MAGAZINES
|
||||||
|
|
||||||
|
//If defined calculates better placement for backpacks
|
||||||
|
//#define COMPLEX_BACKPACK_POSITION
|
||||||
|
|
||||||
|
#ifdef SERVER
|
||||||
|
#define INCREMENT_WEAPON_HOLDERS()
|
||||||
|
#else
|
||||||
|
#define INCREMENT_WEAPON_HOLDERS() dayz_currentWeaponHolders = dayz_currentWeaponHolders + 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private
|
||||||
|
[
|
||||||
|
"_lootInfo",
|
||||||
|
"_vehicle",
|
||||||
|
"_spawnCount",
|
||||||
|
"_magazines"
|
||||||
|
];
|
||||||
|
|
||||||
|
_lootInfo = _this select 0;
|
||||||
|
_vehicle = objNull;
|
||||||
|
|
||||||
|
//Switch on type of loot
|
||||||
|
switch (_lootInfo select 0) do
|
||||||
|
{
|
||||||
|
//Spawn a single weapon with [0,MAX_WEAPON_MAGAZINES] magazines.
|
||||||
|
case Loot_WEAPON:
|
||||||
|
{
|
||||||
|
_vehicle = createVehicle ["WeaponHolder", _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
_vehicle addWeaponCargoGlobal [_lootInfo select 1, 1];
|
||||||
|
|
||||||
|
Debug_Assert(typeName (_lootInfo select 1) == typeName "" && { (_lootInfo select 1) != "" });
|
||||||
|
//Debug_Log(String_Format2("DEBUG: Loot_Spawn Weapon: %1 Position: %2", _lootInfo select 1, _this select 1));
|
||||||
|
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
INCREMENT_WEAPON_HOLDERS();
|
||||||
|
|
||||||
|
_magazines = getArray (configFile >> "CfgWeapons" >> _lootInfo select 1 >> "magazines");
|
||||||
|
|
||||||
|
if (count _magazines > 0 && {getNumber (configFile >> "CfgWeapons" >> _lootInfo select 1 >> "melee") != 1}) then
|
||||||
|
{
|
||||||
|
#ifdef COMPLEX_WEAPON_MAGAZINES
|
||||||
|
for "_i" from 1 to (floor random (MAX_WEAPON_MAGAZINES + 1)) do
|
||||||
|
{
|
||||||
|
_vehicle addMagazineCargoGlobal [_magazines select floor random count _magazines, 1];
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
_vehicle addMagazineCargoGlobal [_magazines select 0, floor random (MAX_WEAPON_MAGAZINES + 1)];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//Spawn a single magazine
|
||||||
|
case Loot_MAGAZINE:
|
||||||
|
{
|
||||||
|
_vehicle = createVehicle ["WeaponHolder", _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
_vehicle addMagazineCargoGlobal [_lootInfo select 1, 1];
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
INCREMENT_WEAPON_HOLDERS();
|
||||||
|
};
|
||||||
|
|
||||||
|
//Spawn backpack
|
||||||
|
case Loot_BACKPACK:
|
||||||
|
{
|
||||||
|
#ifdef COMPLEX_BACKPACK_POSITION
|
||||||
|
private ["_b", "_p", "_d"];
|
||||||
|
_vehicle = createVehicle [_lootInfo select 1, [-10000,0,0], [], 0, "CAN_COLLIDE"];
|
||||||
|
|
||||||
|
_b = boundingBox _vehicle;
|
||||||
|
_b = ((_b select 1) select 1) - ((_b select 0) select 1);
|
||||||
|
|
||||||
|
_d = Vector_Rotate2D(Vector_NORTH, random 360);
|
||||||
|
|
||||||
|
_p = Vector_Subtract(_this select 1, Vector_Multiply_Fast(_d, _b));
|
||||||
|
_p = Vector_SetZ(_p, Vector_Z(_p) + Vector_Z(getPosATL _vehicle));
|
||||||
|
|
||||||
|
_vehicle setVectorDirAndUp [Vector_DOWN, _d];
|
||||||
|
_vehicle setPosATL _p;
|
||||||
|
#else
|
||||||
|
_vehicle = createVehicle [_lootInfo select 1, _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
//Spawn multiple items from a given group. All but weapons and magazines are ignored.
|
||||||
|
case Loot_PILE:
|
||||||
|
{
|
||||||
|
_spawnCount = (_lootInfo select 2) + floor random ((_lootInfo select 3) - (_lootInfo select 2) + 1);
|
||||||
|
_vehicle = createVehicle ["WeaponHolder", _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
Loot_InsertCargo(_vehicle, _lootInfo select 1, _spawnCount);
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
INCREMENT_WEAPON_HOLDERS();
|
||||||
|
};
|
||||||
|
|
||||||
|
//Spawn a vehicle
|
||||||
|
case Loot_VEHICLE:
|
||||||
|
{
|
||||||
|
_vehicle = createVehicle [_lootInfo select 1, _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
_vehicle setDir random 360;
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Spawn a container and populate it with loot from a given group
|
||||||
|
case Loot_CONTAINER:
|
||||||
|
{
|
||||||
|
_vehicle = createVehicle [_lootInfo select 1, _this select 1, [], 0, "CAN_COLLIDE"];
|
||||||
|
INCREMENT_WEAPON_HOLDERS();
|
||||||
|
|
||||||
|
//Number of items to spawn
|
||||||
|
_spawnCount = (_lootInfo select 3) + floor random ((_lootInfo select 4) - (_lootInfo select 3) + 1);
|
||||||
|
|
||||||
|
Loot_InsertCargo(_vehicle, _lootInfo select 2, _spawnCount);
|
||||||
|
|
||||||
|
_vehicle setDir random 360;
|
||||||
|
_vehicle setPosATL (_this select 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Call a function which is assumed to return an object reference.
|
||||||
|
case Loot_CUSTOM:
|
||||||
|
{
|
||||||
|
_vehicle = call (_lootInfo select 1);
|
||||||
|
if ((typeName _vehicle) != "OBJECT") exitWith {};
|
||||||
|
if (!isNull _vehicle) then { _vehicle setPosATL (_this select 1); };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_vehicle
|
||||||
18
SQF/dayz_code/loot/spawnGroup.sqf
Normal file
18
SQF/dayz_code/loot/spawnGroup.sqf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
Spawns randomly selected loot from given group.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
integer Loot group index in dayz_lootGroups
|
||||||
|
vector Spawn position relative to world
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
object Spawned vehicle.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
Foxy
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Loot.hpp"
|
||||||
|
|
||||||
|
Loot_Spawn(Loot_Select(_this select 0, 1) select 0, _this select 1);
|
||||||
|
//[([_this select 0, 1] call loot_select) select 0, _this select 1] call loot_spawn
|
||||||
2
SQF/dayz_code/loot/spawn_server.sqf
Normal file
2
SQF/dayz_code/loot/spawn_server.sqf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#define SERVER
|
||||||
|
#include "spawn.sqf"
|
||||||
43
SQF/dayz_code/medical/bloodCalc.sqf
Normal file
43
SQF/dayz_code/medical/bloodCalc.sqf
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Created exclusively for ArmA2:OA - DayZMod.
|
||||||
|
permission is required to use/alter/distribute from project leader (R4Z0R49) AND the author (icomrade).
|
||||||
|
|
||||||
|
breakdown of blood type distribution (based on world population)
|
||||||
|
O A B AB
|
||||||
|
39% 32% 23% 6%
|
||||||
|
|
||||||
|
We use realistic RH distribution per blood type as well
|
||||||
|
Ex. CID = 13... _randType = 31... Blood Type = A
|
||||||
|
*/
|
||||||
|
private ["_playerObj","_randRh","_randType","_bt_val","_rh_val"];
|
||||||
|
|
||||||
|
_playerObj = _this;
|
||||||
|
|
||||||
|
_randRh = random 100;
|
||||||
|
_randType = random 100;
|
||||||
|
_bt_val = nil;
|
||||||
|
_rh_val = nil;
|
||||||
|
switch true do {
|
||||||
|
case (_randType >= 61) : {
|
||||||
|
_bt_val = "O";
|
||||||
|
_rh_val = if (_randRh >= 89) then { false } else { true };
|
||||||
|
};
|
||||||
|
case (_randType >= 29) : {
|
||||||
|
_bt_val = "A";
|
||||||
|
_rh_val = if (_randRh >= 89) then { false } else { true };
|
||||||
|
};
|
||||||
|
case (_randType >= 6) : {
|
||||||
|
_bt_val = "B";
|
||||||
|
_rh_val = if (_randRh >= 94) then { false } else { true };
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_bt_val = "AB";
|
||||||
|
_rh_val = if (_randRh >= 91) then { false } else { true };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//diag_log ["_playerObj BLOOD CALC: Blood Type,Rh Type=", _bt_val, _rh_val];
|
||||||
|
|
||||||
|
//RH type
|
||||||
|
_playerObj setVariable ["rh_factor", _rh_val, true];
|
||||||
|
//blood type
|
||||||
|
_playerObj setVariable ["blood_type", _bt_val, true];
|
||||||
319
SQF/dayz_code/medical/blood_test.sqf
Normal file
319
SQF/dayz_code/medical/blood_test.sqf
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
/* ********************************************************
|
||||||
|
Used to check and display blood type + Rh
|
||||||
|
By icomrade for DayZ Mod
|
||||||
|
********************************************************* */
|
||||||
|
private ["_unit","_abc","_opened","_water_displayed","_A_Watered","_B_Watered","_allDisplayed","_water_closed","_D_Watered","_control_Watered","_needleOpened","_needleRed","_needleRest","_antiABlooded","_allClicked","_antiBBlooded","_antiDBlooded","_control_displayed","_antiA_displayed","_antiB_displayed","_antiD_displayed","_results_shown","_isDone","_watered","_watered_complete","_isClose","_unit","_hasTester","_dialog","_display","_resultsCard_hidden","_antiA","_AntiB","_AntiD","_Control","_waterBottle","_needle","_name","_resultsCard_front","_antiAUntested","_antiBUntested","_antiDUntested","_controlUntested","_waterBottleImage","_waterBottleClickedImage","_needleClosedImage","_needleOpenImage","_watered_image","_needleRedImage","_bloodTypeCard","_bloodTypeCardHidden","_controlImage","_RBWhole1","_RBWhole2","_RBWhole3","_RBWhole4","_RBWhole5","_Aglut1","_Aglut2","_Aglut3","_Aglut4","_Aglut5","_wholeArray","_aglutArray","_rnd1","_rnd2","_rnd3","_type","_rh"];
|
||||||
|
disableSerialization;
|
||||||
|
|
||||||
|
//remove option
|
||||||
|
call fnc_usec_medic_removeActions;
|
||||||
|
r_action = false;
|
||||||
|
|
||||||
|
_unit = (_this select 3) select 0;
|
||||||
|
if (dialog) then {
|
||||||
|
_abc = findDisplay 106;
|
||||||
|
_abc closeDisplay 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
_hasTester = "bloodTester" in magazines player;
|
||||||
|
_antiA_displayed = false;
|
||||||
|
_antiB_displayed = false;
|
||||||
|
_antiD_displayed = false;
|
||||||
|
_control_displayed = false;
|
||||||
|
_water_displayed = false;
|
||||||
|
_opened = false;
|
||||||
|
_isDone = false;
|
||||||
|
_A_Watered = false;
|
||||||
|
_B_Watered = false;
|
||||||
|
_D_Watered = false;
|
||||||
|
_control_Watered = false;
|
||||||
|
_results_shown = false;
|
||||||
|
_needleOpened = false;
|
||||||
|
_needleRed = false;
|
||||||
|
_antiABlooded = false;
|
||||||
|
_antiBBlooded = false;
|
||||||
|
_antiDBlooded = false;
|
||||||
|
_needleRest = false;
|
||||||
|
_allClicked = 0;
|
||||||
|
if (!_hasTester) exitWith {};
|
||||||
|
|
||||||
|
_dialog = createDialog "bloodTest";
|
||||||
|
|
||||||
|
sleep 0.02;
|
||||||
|
|
||||||
|
_display = uiNamespace getVariable 'DayZ_Blood_Test';
|
||||||
|
_resultsCard_hidden = _display displayCtrl 1288;
|
||||||
|
_antiA = _display displayCtrl 1293;
|
||||||
|
_AntiB = _display displayCtrl 1294;
|
||||||
|
_AntiD = _display displayCtrl 1295;
|
||||||
|
_Control = _display displayCtrl 1296;
|
||||||
|
_waterBottle = _display displayCtrl 1297;
|
||||||
|
_needle = _display displayCtrl 1298;
|
||||||
|
_name = _display displayCtrl 1289;
|
||||||
|
_resultsCard_front = _display displayCtrl 1299;
|
||||||
|
_resultsCard_front ctrlShow false;
|
||||||
|
_antiAUntested = "\z\addons\dayz_code\gui\blood\bloodtest_t_antiA.paa";
|
||||||
|
_antiBUntested = "\z\addons\dayz_code\gui\blood\bloodtest_t_antiB.paa";
|
||||||
|
_antiDUntested = "\z\addons\dayz_code\gui\blood\bloodtest_t_antiD.paa";
|
||||||
|
_controlUntested = "\z\addons\dayz_code\gui\blood\bloodtest_t_control.paa";
|
||||||
|
_waterBottleImage ="\z\addons\dayz_code\gui\blood\bloodtest_button_water.paa";
|
||||||
|
_waterBottleClickedImage = "\z\addons\dayz_code\gui\blood\bloodtest_button_water_enabled.paa";
|
||||||
|
_needleClosedImage = "\z\addons\dayz_code\gui\blood\bloodtest_button_drawblood_closed.paa";
|
||||||
|
_needleOpenImage = "\z\addons\dayz_code\gui\blood\bloodtest_button_drawblood_open.paa";
|
||||||
|
_watered_image = "\z\addons\dayz_code\gui\blood\bloodtest_waterdrop.paa";
|
||||||
|
_needleRedImage = "\z\addons\dayz_code\gui\blood\bloodtest_button_drawblood_enabled.paa";
|
||||||
|
_bloodTypeCard = "\z\addons\dayz_code\gui\blood\bloodtest_results.paa";
|
||||||
|
_bloodTypeCardHidden = "\z\addons\dayz_code\gui\blood\bloodtest_button_results.paa";
|
||||||
|
_controlImage = "\z\addons\dayz_code\gui\blood\bloodtest_blood_waiting.paa";
|
||||||
|
_RBWhole1 = "\z\addons\dayz_code\gui\blood\bloodtest_blood1.paa";
|
||||||
|
_RBWhole2 = "\z\addons\dayz_code\gui\blood\bloodtest_blood2.paa";
|
||||||
|
_RBWhole3 = "\z\addons\dayz_code\gui\blood\bloodtest_blood3.paa";
|
||||||
|
_RBWhole4 = "\z\addons\dayz_code\gui\blood\bloodtest_blood4.paa";
|
||||||
|
_RBWhole5 = "\z\addons\dayz_code\gui\blood\bloodtest_blood5.paa";
|
||||||
|
_Aglut1 = "\z\addons\dayz_code\gui\blood\bloodtest_blood_true1.paa";
|
||||||
|
_Aglut2 = "\z\addons\dayz_code\gui\blood\bloodtest_blood_true2.paa";
|
||||||
|
_Aglut3 = "\z\addons\dayz_code\gui\blood\bloodtest_blood_true3.paa";
|
||||||
|
_Aglut4 = "\z\addons\dayz_code\gui\blood\bloodtest_blood_true4.paa";
|
||||||
|
_Aglut5 = "\z\addons\dayz_code\gui\blood\bloodtest_blood_true5.paa";
|
||||||
|
_wholeArray = [_RBWhole1,_RBWhole2,_RBWhole3,_RBWhole4,_RBWhole5];
|
||||||
|
_aglutArray = [_Aglut1,_Aglut2,_Aglut3, _Aglut4,_Aglut5];
|
||||||
|
_allDisplayed = false;
|
||||||
|
_water_closed = false;
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
r_doLoop = true;
|
||||||
|
r_A_watered = false;
|
||||||
|
r_B_watered = false;
|
||||||
|
r_D_watered = false;
|
||||||
|
r_control_watered = false;
|
||||||
|
r_canClick_resultsCard = false;
|
||||||
|
r_resultsCard_Clicked = false;
|
||||||
|
r_water_clicked = false;
|
||||||
|
r_needleclicked = 0;
|
||||||
|
r_control_done = false;
|
||||||
|
r_antiA_done = false;
|
||||||
|
r_antiB_done = false;
|
||||||
|
r_antiD_done = false;
|
||||||
|
_watered_complete = 0;
|
||||||
|
_rnd1 = round(random 4);
|
||||||
|
_rnd2 = floor(random 4);
|
||||||
|
_rnd3 = ceil(random 4);
|
||||||
|
|
||||||
|
_type = _unit getVariable ["blood_type", false];
|
||||||
|
_rh = _unit getVariable ["rh_factor", false];
|
||||||
|
|
||||||
|
while {!_isDone and r_doLoop} do {
|
||||||
|
_watered = r_A_watered or r_B_watered or r_D_watered or r_control_watered;
|
||||||
|
|
||||||
|
//display untested images
|
||||||
|
if (!_opened) then {
|
||||||
|
if (alive _unit) then {
|
||||||
|
_name ctrlSetText (name _unit);
|
||||||
|
};
|
||||||
|
_antiA ctrlSetText _antiAUntested;
|
||||||
|
_antiB ctrlSetText _antiBUntested;
|
||||||
|
_antiD ctrlSetText _antiDUntested;
|
||||||
|
_Control ctrlSetText _controlUntested;
|
||||||
|
_waterBottle ctrlSetText _waterBottleImage;
|
||||||
|
_needle ctrlSetText _needleClosedImage;
|
||||||
|
_resultsCard_hidden ctrlSetText _bloodTypeCardHidden;
|
||||||
|
_opened = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
//display clicked water bottle image
|
||||||
|
if (r_water_clicked and !_water_displayed) then {
|
||||||
|
_waterBottle ctrlSetText _waterBottleClickedImage;
|
||||||
|
_water_displayed = true;
|
||||||
|
player removeMagazine "bloodTester";
|
||||||
|
};
|
||||||
|
|
||||||
|
//display water marks
|
||||||
|
if (r_water_clicked and _watered and (_watered_complete <= 4)) then {
|
||||||
|
if (r_A_watered and !_A_Watered) then {
|
||||||
|
_antiA ctrlSetText _watered_image;
|
||||||
|
_A_Watered = true;
|
||||||
|
_watered_complete = _watered_complete + 1;
|
||||||
|
};
|
||||||
|
if (r_B_watered and !_B_Watered) then {
|
||||||
|
_antiB ctrlSetText _watered_image;
|
||||||
|
_B_Watered = true;
|
||||||
|
_watered_complete = _watered_complete + 1;
|
||||||
|
};
|
||||||
|
if (r_D_watered and !_D_Watered) then {
|
||||||
|
_antiD ctrlSetText _watered_image;
|
||||||
|
_D_Watered = true;
|
||||||
|
_watered_complete = _watered_complete + 1;
|
||||||
|
};
|
||||||
|
if (r_control_watered and !_control_Watered) then {
|
||||||
|
_Control ctrlSetText _watered_image;
|
||||||
|
_control_Watered = true;
|
||||||
|
_watered_complete = _watered_complete + 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//open needle
|
||||||
|
if ((r_needleclicked == 1) and !_needleOpened) then {
|
||||||
|
_needle ctrlSetText _needleOpenImage;
|
||||||
|
_needleOpened = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//close water
|
||||||
|
if ((_watered_complete >= 4) and !_water_closed) then {
|
||||||
|
_water_closed = true;
|
||||||
|
_waterBottle ctrlSetText _waterBottleImage;
|
||||||
|
};
|
||||||
|
//needle clicked
|
||||||
|
if ((r_needleclicked >= 2) and !_needleRed and _needleOpened and (_watered_complete >= 4) and !r_needleReset) then {
|
||||||
|
_needle ctrlSetText _needleRedImage;
|
||||||
|
_needleRed = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
//reset needle
|
||||||
|
if (_needleRed and r_needleReset) then {
|
||||||
|
_needle ctrlSetText _needleOpenImage;
|
||||||
|
_needleRed = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//fill with blood
|
||||||
|
if (r_antiA_done and !_antiABlooded and _needleRed) then {
|
||||||
|
r_needleReset = true;
|
||||||
|
_antiA ctrlSetText _controlImage;
|
||||||
|
_antiABlooded = true;
|
||||||
|
_allClicked = _allClicked + 1;
|
||||||
|
};
|
||||||
|
if (r_antiB_done and !_antiBBlooded and _needleRed) then {
|
||||||
|
r_needleReset = true;
|
||||||
|
_antiB ctrlSetText _controlImage;
|
||||||
|
_antiBBlooded = true;
|
||||||
|
_allClicked = _allClicked + 1;
|
||||||
|
};
|
||||||
|
if (r_antiD_done and !_antiDBlooded and _needleRed) then {
|
||||||
|
r_needleReset = true;
|
||||||
|
_antiD ctrlSetText _controlImage;
|
||||||
|
_antiDBlooded = true;
|
||||||
|
_allClicked = _allClicked + 1;
|
||||||
|
};
|
||||||
|
if (r_control_done and !_control_displayed and _needleRed) then {
|
||||||
|
r_needleReset = true;
|
||||||
|
_Control ctrlSetText _controlImage;
|
||||||
|
_control_displayed = true;
|
||||||
|
_allClicked = _allClicked + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_isClose = ((player distance _unit) < ((sizeOf typeOf _unit) / 2));
|
||||||
|
if (r_interrupt or !_isClose) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
//The magic happens
|
||||||
|
if (_allClicked == 4) then {
|
||||||
|
switch (_type) do {
|
||||||
|
case "A" : {
|
||||||
|
if (!_allDisplayed) then {
|
||||||
|
sleep 2;
|
||||||
|
if (r_antiA_done and !_antiA_displayed) then {
|
||||||
|
_antiA ctrlSetText (_aglutArray select _rnd1);
|
||||||
|
_antiA_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiB_done and !_antiB_displayed) then {
|
||||||
|
_AntiB ctrlSetText (_wholeArray select _rnd2);
|
||||||
|
_antiB_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiD_done and !_antiD_displayed) then {
|
||||||
|
if (_rh) then {
|
||||||
|
_AntiD ctrlSetText (_aglutArray select _rnd3);
|
||||||
|
} else {
|
||||||
|
_AntiD ctrlSetText (_wholeArray select _rnd3);
|
||||||
|
};
|
||||||
|
_antiD_displayed = true;
|
||||||
|
};
|
||||||
|
_allDisplayed = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "B" : {
|
||||||
|
if (!_allDisplayed) then {
|
||||||
|
sleep 2;
|
||||||
|
if (r_antiA_done and !_antiA_displayed) then {
|
||||||
|
_antiA ctrlSetText (_wholeArray select _rnd1);
|
||||||
|
_antiA_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiB_done and !_antiB_displayed) then {
|
||||||
|
_AntiB ctrlSetText (_aglutArray select _rnd2);
|
||||||
|
_antiB_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiD_done and !_antiD_displayed) then {
|
||||||
|
if (_rh) then {
|
||||||
|
_AntiD ctrlSetText (_aglutArray select _rnd3);
|
||||||
|
} else {
|
||||||
|
_AntiD ctrlSetText (_wholeArray select _rnd3);
|
||||||
|
};
|
||||||
|
_antiD_displayed = true;
|
||||||
|
};
|
||||||
|
_allDisplayed = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "AB" : {
|
||||||
|
if (!_allDisplayed) then {
|
||||||
|
sleep 2;
|
||||||
|
if (r_antiA_done and !_antiA_displayed) then {
|
||||||
|
_antiA ctrlSetText (_aglutArray select _rnd1);
|
||||||
|
_antiA_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiB_done and !_antiB_displayed) then {
|
||||||
|
_AntiB ctrlSetText (_aglutArray select _rnd2);
|
||||||
|
_antiB_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiD_done and !_antiD_displayed) then {
|
||||||
|
if (_rh) then {
|
||||||
|
_AntiD ctrlSetText (_aglutArray select _rnd3);
|
||||||
|
} else {
|
||||||
|
_AntiD ctrlSetText (_wholeArray select _rnd3);
|
||||||
|
};
|
||||||
|
_antiD_displayed = true;
|
||||||
|
};
|
||||||
|
_allDisplayed = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case "O" : {
|
||||||
|
if (!_allDisplayed) then {
|
||||||
|
sleep 2;
|
||||||
|
if (r_antiA_done and !_antiA_displayed) then {
|
||||||
|
_antiA ctrlSetText (_wholeArray select _rnd1);
|
||||||
|
_antiA_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiB_done and !_antiB_displayed) then {
|
||||||
|
_AntiB ctrlSetText (_wholeArray select _rnd2);
|
||||||
|
_antiB_displayed = true;
|
||||||
|
};
|
||||||
|
if (r_antiD_done and !_antiD_displayed) then {
|
||||||
|
if (_rh) then {
|
||||||
|
_AntiD ctrlSetText (_aglutArray select _rnd3);
|
||||||
|
} else {
|
||||||
|
_AntiD ctrlSetText (_wholeArray select _rnd3);
|
||||||
|
};
|
||||||
|
_antiD_displayed = true;
|
||||||
|
};
|
||||||
|
_allDisplayed = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
r_canClick_resultsCard = true;
|
||||||
|
if (r_resultsCard_Clicked and _antiD_displayed and _antiB_displayed and _antiA_displayed and _control_displayed and !_results_shown) then {
|
||||||
|
_resultsCard_hidden ctrlShow false;
|
||||||
|
_resultsCard_front ctrlShow true;
|
||||||
|
_resultsCard_front ctrlSetText _bloodTypeCard;
|
||||||
|
_results_shown = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_antiD_displayed and _antiB_displayed and _antiA_displayed and _control_displayed and _results_shown) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_isDone = true;
|
||||||
|
[] spawn {
|
||||||
|
sleep 7;
|
||||||
|
player setVariable["blood_testDone",true,true];
|
||||||
|
player setVariable["medForceUpdate",true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
sleep 0.01;
|
||||||
|
};
|
||||||
65
SQF/dayz_code/medical/brokeBones.sqf
Normal file
65
SQF/dayz_code/medical/brokeBones.sqf
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
private ["_started","_finished","_animState","_isMedic","_id","_unit","_item"];
|
||||||
|
|
||||||
|
_unit = (_this select 3) select 0;
|
||||||
|
_item = (_this select 3) select 1;
|
||||||
|
|
||||||
|
player removeMagazine _item;
|
||||||
|
|
||||||
|
_unit setVariable ["hit_legs",0];
|
||||||
|
_unit setVariable ["hit_hands",0];
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
//not in a vehicle
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
if (vehicle player != player) then {
|
||||||
|
sleep 3;
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
if (_finished) then {
|
||||||
|
if (_unit == player) then {
|
||||||
|
//give to player, Ie the player fixed himself
|
||||||
|
|
||||||
|
//Self Healing
|
||||||
|
_id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
|
||||||
|
} else {
|
||||||
|
//give to remote player, ie the player fixed another player
|
||||||
|
|
||||||
|
//Give humanity reward to player giving the morphine to another player.
|
||||||
|
if (_item in ["ItemMorphine"]) then {
|
||||||
|
[player,50] call player_humanityChange;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
PVDZ_send = [_unit,"Morphine",[_unit,player]];
|
||||||
|
publicVariableServer "PVDZ_send";
|
||||||
|
} else {
|
||||||
|
player addMagazine _item;
|
||||||
|
r_interrupt = false;
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
};
|
||||||
128
SQF/dayz_code/medical/fillBloodBag.sqf
Normal file
128
SQF/dayz_code/medical/fillBloodBag.sqf
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
private ["_victim","_started","_UID","_hasEmptyBag","_bloodDrained","_bloodLevel","_forceExit","_bloodType","_rh","_timer","_i","_complete","_animState","_isMedic","_blood","_bloodAfter","_isClose"];
|
||||||
|
/* ********************************************************
|
||||||
|
Used to fill blood bags with whole blood, only 4k per bag.
|
||||||
|
By icomrade for DayZ Mod
|
||||||
|
********************************************************* */
|
||||||
|
|
||||||
|
call fnc_usec_medic_removeActions;
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
r_interrupt = false;
|
||||||
|
_victim = (_this select 3) select 0;
|
||||||
|
_hasEmptyBag = "emptyBloodBag" in magazines player;
|
||||||
|
_bloodLevel = _victim getVariable ["USEC_BloodQty", 0];
|
||||||
|
_bloodType = _victim getVariable ["blood_type", false];
|
||||||
|
_rh = _victim getVariable ["rh_factor", false];
|
||||||
|
r_doLoop = true;
|
||||||
|
_i = 0;
|
||||||
|
_started= false;
|
||||||
|
_timer = diag_tickTime;
|
||||||
|
_complete = false;
|
||||||
|
_bloodDrained = false;
|
||||||
|
_forceExit = false;
|
||||||
|
_UID = getPlayerUID player;
|
||||||
|
if ((isNil "_UID") or (_UID == "0")) exitWith {};
|
||||||
|
if (!_hasEmptyBag) exitWith { cutText [localize "str_actions_medical_bagEmpty", "PLAIN DOWN"]; };
|
||||||
|
|
||||||
|
if (_bloodLevel <= 4200) exitWith {cutText [localize "str_actions_medical_bagMissingBlood", "PLAIN DOWN"];};
|
||||||
|
|
||||||
|
if (!(alive _victim)) then {
|
||||||
|
_bloodDrained = _victim getVariable ["bloodTaken", false];
|
||||||
|
if (_bloodDrained) exitWith {_forceExit = true;};
|
||||||
|
_victim setVariable ["bloodTaken", true, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_forceExit) exitWith {cutText [localize "str_actions_medical_bagMissingBlood", "PLAIN DOWN"];};
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
//not in a vehicle
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
|
||||||
|
while {r_doLoop and (_i < 25)} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
|
||||||
|
if (_isMedic and !_started) then {
|
||||||
|
player removeMagazine "emptyBloodBag";
|
||||||
|
cutText [localize "str_actions_medical_transfusion_start", "PLAIN DOWN"];
|
||||||
|
[player,_victim,"loc",rTITLETEXT,localize "str_actions_medical_transfusion_start","PLAIN DOWN"] call RE;
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_started) then {
|
||||||
|
if ((diag_tickTime - _timer) >= 1) then {
|
||||||
|
_timer = diag_tickTime;
|
||||||
|
r_player_blood = r_player_blood - 160;
|
||||||
|
//PVDZ_send = [_victim,"Transfuse",[_victim,player,-160,_UID]];
|
||||||
|
//publicVariableServer "PVDZ_send";
|
||||||
|
_i = _i + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_isMedic) then {
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_blood = _victim getVariable ["USEC_BloodQty", 0];
|
||||||
|
_bloodAfter = (_blood - 4000);
|
||||||
|
|
||||||
|
if ((_blood <= _bloodAfter) or (_i == 25)) then {
|
||||||
|
cutText [localize "str_actions_medical_bagDone", "PLAIN DOWN"];
|
||||||
|
[player,_victim,"loc",rTITLETEXT,localize "str_actions_medical_bagDone","PLAIN DOWN"] call RE;
|
||||||
|
//_victim setVariable ["USEC_BloodQty", _bloodAfter, true];
|
||||||
|
r_doLoop = false;
|
||||||
|
_complete = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
_isClose = ((player distance _victim) < ((sizeOf typeOf _victim) / 2));
|
||||||
|
|
||||||
|
if (!_isClose) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
r_interrupt = true;
|
||||||
|
cutText [localize "str_actions_medical_bagInterrupted", "PLAIN DOWN"];
|
||||||
|
[player,_victim,"loc",rTITLETEXT,localize "str_actions_medical_bagInterrupted","PLAIN DOWN"] call RE;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (r_interrupt) exitWith {
|
||||||
|
r_interrupt = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_complete) then {
|
||||||
|
switch (_bloodType) do {
|
||||||
|
case "A" : {
|
||||||
|
if (_rh) then {
|
||||||
|
player addMagazine "wholeBloodBagAPOS";
|
||||||
|
} else {
|
||||||
|
player addMagazine "wholeBloodBagANEG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
case "B" : {
|
||||||
|
if (_rh) then {
|
||||||
|
player addMagazine "wholeBloodBagBPOS";
|
||||||
|
} else {
|
||||||
|
player addMagazine "wholeBloodBagBNEG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
case "AB" : {
|
||||||
|
if (_rh) then {
|
||||||
|
player addMagazine "wholeBloodBagABPOS";
|
||||||
|
} else {
|
||||||
|
player addMagazine "wholeBloodBagABNEG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
case "O" : {
|
||||||
|
if (_rh) then {
|
||||||
|
player addMagazine "wholeBloodBagOPOS";
|
||||||
|
} else {
|
||||||
|
player addMagazine "wholeBloodBagONEG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
diag_log format ["Fill Bag: Something went wrong and the bloodBag was not added!"];
|
||||||
|
};
|
||||||
52
SQF/dayz_code/medical/load_wounded.sqf
Normal file
52
SQF/dayz_code/medical/load_wounded.sqf
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// Load_wounded.sqf
|
||||||
|
// OCTOBER 2010 - norrin
|
||||||
|
|
||||||
|
private ["_wounded","_vcl","_group"];
|
||||||
|
|
||||||
|
_wounded = _this select 0;
|
||||||
|
|
||||||
|
if (!local _wounded) exitWith {};
|
||||||
|
|
||||||
|
r_action = false;
|
||||||
|
|
||||||
|
sleep 1;
|
||||||
|
_vcl = _wounded getVariable "NORRN_loadVcl";
|
||||||
|
_wounded setVariable ["NORRN_unit_dragged", true, true];
|
||||||
|
|
||||||
|
_wounded assignAsCargo _vcl;
|
||||||
|
_wounded moveInCargo _vcl;
|
||||||
|
sleep 1;
|
||||||
|
//["PVDZ_drg_RaLW",_wounded] call broadcastRpcCallAll;
|
||||||
|
PVDZ_drg_RaLW = _wounded;
|
||||||
|
publicVariable "PVDZ_drg_RaLW";
|
||||||
|
|
||||||
|
if (local _wounded) then
|
||||||
|
{
|
||||||
|
waitUntil {!(_wounded getVariable "NORRN_unconscious")|| !alive _wounded || vehicle _wounded == _wounded || (assignedVehicleRole _wounded) select 0 != "Cargo"};
|
||||||
|
|
||||||
|
if (vehicle _wounded == _wounded || (assignedVehicleRole _wounded) select 0 != "Cargo") exitWith
|
||||||
|
{
|
||||||
|
if (_wounded getVariable "NORRN_AIunconscious") then
|
||||||
|
{
|
||||||
|
if (vehicle _wounded != _wounded) then
|
||||||
|
{
|
||||||
|
unassignVehicle _wounded;
|
||||||
|
sleep 0.05;
|
||||||
|
_wounded action ["EJECT", _vcl];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
// PVDZ_drg_RAlie = _wounded; // not used
|
||||||
|
// publicVariable "PVDZ_drg_RAlie"; // not used
|
||||||
|
_wounded switchMove "ainjppnemstpsnonwrfldnon";
|
||||||
|
_wounded setVariable ["NORRN_unit_dragged", false, true];
|
||||||
|
sleep 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (vehicle _wounded != _wounded && alive _wounded) then
|
||||||
|
{
|
||||||
|
_wounded playMove "BasicDriver";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
sleep 0.01;
|
||||||
|
if (true) exitWith {};
|
||||||
9
SQF/dayz_code/medical/publicEH/medAntibiotics.sqf
Normal file
9
SQF/dayz_code/medical/publicEH/medAntibiotics.sqf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
private ["_array","_unit","_medic"];
|
||||||
|
_array = _this; //_this select 0;
|
||||||
|
_unit = _array select 0;
|
||||||
|
_medic = _array select 1;
|
||||||
|
|
||||||
|
if ((_unit == player) or (vehicle player != player)) then {
|
||||||
|
r_player_infected = false;
|
||||||
|
_unit setVariable["USEC_infected",false,true];
|
||||||
|
};
|
||||||
5
SQF/dayz_code/medical/publicEH/promptRName.sqf
Normal file
5
SQF/dayz_code/medical/publicEH/promptRName.sqf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// promptRName.sqf
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
|
||||||
|
call compile format ["server globalChat reviver_%1", _unit];
|
||||||
147
SQF/dayz_code/medical/selfbloodbag.sqf
Normal file
147
SQF/dayz_code/medical/selfbloodbag.sqf
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
private ["_unit","_blood","_lowBlood","_injured","_inPain","_lastused","_animState","_started","_finished","_timer","_i","_isMedic","_isClose","_duration","_rhVal","_bloodBagArrayNeeded","_BBneeded","_bbselect","_bloodBagNeeded","_badBag","_wholeBag","_bagFound","_bagToRemove","_forceClose","_bloodType","_rh","_bloodBagArray","_bbarray_length","_bloodBagWholeNeeded","_haswholebag","_r"];
|
||||||
|
// bleed.sqf
|
||||||
|
_unit = _this select 0;
|
||||||
|
_bagUsed = _this select 1;
|
||||||
|
|
||||||
|
_blood = _unit getVariable ["USEC_BloodQty", 0];
|
||||||
|
_lowBlood = _unit getVariable ["USEC_lowBlood", false];
|
||||||
|
_injured = _unit getVariable ["USEC_injured", false];
|
||||||
|
_inPain = _unit getVariable ["USEC_inPain", false];
|
||||||
|
_lastused = _unit getVariable ["LastTransfusion", time];
|
||||||
|
|
||||||
|
call gear_ui_init;
|
||||||
|
closeDialog 0;
|
||||||
|
|
||||||
|
_bloodType = _unit getVariable ["blood_type", false];
|
||||||
|
_rh = _unit getVariable ["rh_factor", false];
|
||||||
|
|
||||||
|
_badBag = false;
|
||||||
|
_wholeBag = false;
|
||||||
|
_bagFound = false;
|
||||||
|
_BBneeded = false;
|
||||||
|
_forceClose = false;
|
||||||
|
|
||||||
|
|
||||||
|
if (_blood <= 4000) then {
|
||||||
|
_duration = 3;
|
||||||
|
} else {
|
||||||
|
_duration = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
_bloodBagArray = ["wholeBloodBagANEG","wholeBloodBagAPOS","wholeBloodBagBNEG","wholeBloodBagBPOS","wholeBloodBagABNEG","wholeBloodBagABPOS","wholeBloodBagONEG","wholeBloodBagOPOS"];
|
||||||
|
|
||||||
|
if (_rh) then {_rhVal = "POS";} else {_rhVal = "NEG";};
|
||||||
|
|
||||||
|
|
||||||
|
//No subs for whole blood :(
|
||||||
|
_bloodBagWholeNeeded = "wholeBloodBag" + _bloodType + _rhVal;
|
||||||
|
_haswholebag = _bloodBagWholeNeeded in magazines player;
|
||||||
|
|
||||||
|
if (_haswholebag) then {
|
||||||
|
_wholeBag = true;
|
||||||
|
} else {
|
||||||
|
_badBag = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
call fnc_usec_medic_removeActions;
|
||||||
|
r_action = false;
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
//not in a vehicle
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
_timer = diag_tickTime;
|
||||||
|
_i = 0;
|
||||||
|
_r = 0;
|
||||||
|
|
||||||
|
while {r_doLoop and (_i < 12)} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
|
||||||
|
if (_isMedic and !_started) then {
|
||||||
|
closeDialog 0;
|
||||||
|
diag_log format ["TRANSFUSION: starting blood transfusion (%1 > %2)", name player, name _unit];
|
||||||
|
if (_badBag) then {
|
||||||
|
for "_r" from 0 to 15 do {
|
||||||
|
_bagToRemove = _bagUsed;
|
||||||
|
if (_bagToRemove in magazines player) exitWith { //TODO: add separate action menu options so the removed bag isn't random
|
||||||
|
_bagFound = true;
|
||||||
|
if (_r >= 8) then {
|
||||||
|
_wholeBag = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (_wholeBag) then {_bagToRemove = _bloodBagWholeNeeded; };
|
||||||
|
if (_bagToRemove in magazines player) then { _bagFound = true; };
|
||||||
|
};
|
||||||
|
if (!_bagFound) then {_forceClose = true;} else { player removeMagazine _bagToRemove;};
|
||||||
|
cutText [localize "str_actions_medical_transfusion_start", "PLAIN DOWN"];
|
||||||
|
[player,_unit,"loc",rTITLETEXT,localize "str_actions_medical_transfusion_start","PLAIN DOWN"] call RE;
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_started) then {
|
||||||
|
if ((diag_tickTime - _timer) >= 1) then {
|
||||||
|
_timer = diag_tickTime;
|
||||||
|
_i = _i + 3;
|
||||||
|
if (!_badBag) then {
|
||||||
|
if (!_forceClose) then {
|
||||||
|
if (!_wholeBag) then {
|
||||||
|
_randomamount = round(random 60);
|
||||||
|
r_player_blood = r_player_blood + 100 + _randomamount;
|
||||||
|
} else {
|
||||||
|
_randomamount = round(random 200);
|
||||||
|
r_player_blood = r_player_blood + 800 + _randomamount;
|
||||||
|
};
|
||||||
|
|
||||||
|
//PVDZ_send = [_unit,"Transfuse",[_unit,player,1000]];
|
||||||
|
//publicVariableServer "PVDZ_send";
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (!_forceClose and (_i >= 12)) then {
|
||||||
|
[_unit, _duration] call fnc_usec_damageUnconscious;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_isMedic) then {
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_blood = _unit getVariable ["USEC_BloodQty", 0];
|
||||||
|
|
||||||
|
if (((_blood >= r_player_bloodTotal) and !_badBag and _bagFound) or (_i == 12)) then {
|
||||||
|
diag_log format ["TRANSFUSION: completed blood transfusion successfully (_i = %1)", _i];
|
||||||
|
cutText [localize "str_actions_medical_transfusion_successful", "PLAIN DOWN"];
|
||||||
|
[player,_unit,"loc",rTITLETEXT,localize "str_actions_medical_transfusion_successful","PLAIN DOWN"] call RE;
|
||||||
|
[player,25] call player_humanityChange;
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
_isClose = ((player distance _unit) < ((sizeOf typeOf _unit) / 2));
|
||||||
|
|
||||||
|
if (r_interrupt or !_isClose or _forceClose) then {
|
||||||
|
diag_log format ["TRANSFUSION: transfusion was interrupted (r_interrupt: %1 | distance: %2 (%3) | _i = %4)", r_interrupt, player distance _unit, _isClose, _i];
|
||||||
|
cutText [localize "str_actions_medical_transfusion_interrupted", "PLAIN DOWN"];
|
||||||
|
[player,_unit,"loc",rTITLETEXT,localize "str_actions_medical_transfusion_interrupted","PLAIN DOWN"] call RE;
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_interrupt = false;
|
||||||
|
player switchMove "";
|
||||||
|
player playActionNow "stop";
|
||||||
|
};
|
||||||
59
SQF/dayz_code/medical/wipes.sqf
Normal file
59
SQF/dayz_code/medical/wipes.sqf
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
private ["_started","_finished","_animState","_isMedic","_id","_unit"];
|
||||||
|
_unit = (_this select 3) select 0;
|
||||||
|
player removeMagazine "ItemAntibacterialWipe";
|
||||||
|
|
||||||
|
call fnc_usec_medic_removeActions;
|
||||||
|
r_action = false;
|
||||||
|
|
||||||
|
if (vehicle player == player) then {
|
||||||
|
//not in a vehicle
|
||||||
|
player playActionNow "Medic";
|
||||||
|
};
|
||||||
|
|
||||||
|
r_interrupt = false;
|
||||||
|
_animState = animationState player;
|
||||||
|
r_doLoop = true;
|
||||||
|
_started = false;
|
||||||
|
_finished = false;
|
||||||
|
[player,"bandage",0,false] call dayz_zombieSpeak;
|
||||||
|
while {r_doLoop} do {
|
||||||
|
_animState = animationState player;
|
||||||
|
_isMedic = ["medic",_animState] call fnc_inString;
|
||||||
|
if (_isMedic) then {
|
||||||
|
_started = true;
|
||||||
|
};
|
||||||
|
if (_started and !_isMedic) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
if (r_interrupt) then {
|
||||||
|
r_doLoop = false;
|
||||||
|
};
|
||||||
|
if (vehicle player != player) then {
|
||||||
|
sleep 3;
|
||||||
|
r_doLoop = false;
|
||||||
|
_finished = true;
|
||||||
|
};
|
||||||
|
sleep 0.1;
|
||||||
|
};
|
||||||
|
r_doLoop = false;
|
||||||
|
|
||||||
|
if (_finished) then {
|
||||||
|
//["PVCDZ_hlt_Bandage",[_unit,player]] call broadcastRpcCallAll;
|
||||||
|
//PVCDZ_hlt_Bandage = [_unit,player];
|
||||||
|
//publicVariable "PVCDZ_hlt_Bandage";
|
||||||
|
//PVDZ_send = [_unit,"Bandage",[_unit,player]];
|
||||||
|
//publicVariableServer "PVDZ_send";
|
||||||
|
|
||||||
|
|
||||||
|
if ((_unit == player) or (vehicle player != player)) then {
|
||||||
|
r_player_Sepsis = [false, 0];
|
||||||
|
player setVariable ["USEC_Sepsis", false, true];
|
||||||
|
player setVariable ["sepsisStarted", nil];
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
r_interrupt = false;
|
||||||
|
[objNull, player, rSwitchMove,""] call RE;
|
||||||
|
player playActionNow "stop";
|
||||||
|
player addMagazine "ItemAntibacterialWipe";
|
||||||
|
};
|
||||||
564
SQF/dayz_code/system/DynamicWeatherEffects.sqf
Normal file
564
SQF/dayz_code/system/DynamicWeatherEffects.sqf
Normal file
@@ -0,0 +1,564 @@
|
|||||||
|
/* DynamicWeatherEffects.sqf version 1.01 by Engima of Ostgota Ops
|
||||||
|
* Description:
|
||||||
|
* Script that generates dynamic (random) weather. Works in single player, multiplayer (hosted and dedicated), and is JIP compatible.
|
||||||
|
* Arguments:
|
||||||
|
* [_initialFog]: Optional. Fog when mission starts. Must be between 0 and 1 where 0 = no fog, 1 = maximum fog. -1 = random fog.
|
||||||
|
* [_initialOvercast]: Optional. Overcast when mission starts. Must be between 0 and 1 where 0 = no overcast, 1 = maximum overcast. -1 = random overcast.
|
||||||
|
* [_initialRain]: Optional. Rain when mission starts. Must be between 0 and 1 where 0 = no rain, 1 = maximum rain. -1 = random rain. (Overcast must be greater than or equal to 0.75).
|
||||||
|
* [_initialWind]: Optional. Wind when mission starts. Must be an array of form [x, z], where x is one wind strength vector and z is the other. x and z must be greater than or equal to 0. [-1, -1] = random wind.
|
||||||
|
* [_debug]: Optional. true if debug text is to be shown, otherwise false.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_initialFog", "_initialOvercast", "_initialRain", "_initialWind", "_debug"];
|
||||||
|
private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_rainIntervalRainProbability", "_windChangeProbability"];
|
||||||
|
private ["_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumRain", "_maximumRain", "_minimumWind", "_maximumWind", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_forceRainToStopAfterOneRainInterval", "_maxWind"];
|
||||||
|
|
||||||
|
if (isNil "_this") then { _this = []; };
|
||||||
|
if (count _this > 0) then { _initialFog = _this select 0; } else { _initialFog = -1; };
|
||||||
|
if (count _this > 1) then { _initialOvercast = _this select 1; } else { _initialOvercast = -1; };
|
||||||
|
if (count _this > 2) then { _initialRain = _this select 2; } else { _initialRain = -1; };
|
||||||
|
if (count _this > 3) then { _initialWind = _this select 3; } else { _initialWind = [-1, -1]; };
|
||||||
|
if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; };
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The following variables can be changed to tweak weather behaviour
|
||||||
|
|
||||||
|
// Minimum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to 1 and less than or equal to
|
||||||
|
// _maxWeatherChangeTimeMin. When weather changes, it is fog OR overcast that changes, not both at the same time. (Suggested value: 10).
|
||||||
|
_minWeatherChangeTimeMin = 10;
|
||||||
|
|
||||||
|
// Maximum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to _minWeatherChangeTimeMin.
|
||||||
|
// (Suggested value: 20).
|
||||||
|
_maxWeatherChangeTimeMin = 20;
|
||||||
|
|
||||||
|
// Minimum time in minutes that weather (fog and overcast) stays constant between weather changes. Must be less than or equal to 0 and
|
||||||
|
// greater than or equal to _minWeatherChangeTimeMin. (Suggested value: 5).
|
||||||
|
_minTimeBetweenWeatherChangesMin = 5;
|
||||||
|
|
||||||
|
// Maximum time in minutes that weather (fog and overcast) stays unchanged between weather changes. Must be greater than or equal to
|
||||||
|
// _minWeatherChangeTimeMin. (Suggested value: 10).
|
||||||
|
_maxTimeBetweenWeatherChangesMin = 10;
|
||||||
|
|
||||||
|
// Fog intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumFog
|
||||||
|
// (0 = no fog, 1 = pea soup). (Suggested value: 0).
|
||||||
|
_minimumFog = 0;
|
||||||
|
|
||||||
|
// Fog intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumFog
|
||||||
|
// (0 = no fog, 1 = pea soup). (Suggested value: 0.8).
|
||||||
|
_maximumFog = 0.2; //0.5
|
||||||
|
|
||||||
|
// Overcast intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumOvercast
|
||||||
|
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 0).
|
||||||
|
_minimumOvercast = 0;
|
||||||
|
|
||||||
|
// Overcast intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumOvercast
|
||||||
|
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 1).
|
||||||
|
_maximumOvercast = 1;
|
||||||
|
|
||||||
|
// When raining, rain intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumRain
|
||||||
|
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0);
|
||||||
|
_minimumRain = 0;
|
||||||
|
|
||||||
|
// When raining, rain intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumRain
|
||||||
|
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8);
|
||||||
|
_maximumRain = 0.8;
|
||||||
|
|
||||||
|
// Wind vector strength never falls below this value. Must be greater or equal to 0 and less than or equal to _maximumWind.
|
||||||
|
// (Suggested value: 0);
|
||||||
|
_minimumWind = 0;
|
||||||
|
|
||||||
|
// Wind vector strength never exceeds this value. Must be greater or equal to 0 and greater than or equal to _minimumWind.
|
||||||
|
// (Suggested value: 8).
|
||||||
|
_maximumWind = 8;
|
||||||
|
|
||||||
|
// Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will
|
||||||
|
// change every time the weather (fog or overcast) start to change. (Suggested value: 25);
|
||||||
|
_windChangeProbability = 25;
|
||||||
|
|
||||||
|
// A "rain interval" is defined as "a time interval during which it may rain in any intensity (or it may not rain at all)". When overcast
|
||||||
|
// goes above 0.75, a chain of rain intervals (defined below) is started. It cycles on until overcast falls below 0.75. At overcast
|
||||||
|
// below 0.75 rain intervals never execute (thus it cannot rain).
|
||||||
|
|
||||||
|
// Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100
|
||||||
|
// if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then
|
||||||
|
// lower this value and vice versa. (Suggested value: 50).
|
||||||
|
_rainIntervalRainProbability = 50;
|
||||||
|
|
||||||
|
// Minimum time in minutes for rain intervals. Must be greater or equal to 0 and less than or equal to _maxRainIntervalTimeMin.
|
||||||
|
// (Suggested value: 0).
|
||||||
|
_minRainIntervalTimeMin = 0;
|
||||||
|
|
||||||
|
// Maximum time in minutes for rain intervals. Must be greater than or equal to _minRainIntervalTimeMin. (Suggested value:
|
||||||
|
// (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2).
|
||||||
|
_maxRainIntervalTimeMin = (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2;
|
||||||
|
|
||||||
|
// If set to true, then the rain is forced to stop after one rain interval during which it has rained (use this for example if you only want
|
||||||
|
// small occational cloudbursts ). If set to false, then the rain may stop, but it may also just change intensity for an
|
||||||
|
// immedeate new rain interval. (Suggested value: false).
|
||||||
|
_forceRainToStopAfterOneRainInterval = false;
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Don't touch anything beneath this line
|
||||||
|
|
||||||
|
drn_DynamicWeather_DebugTextEventArgs = []; // Empty
|
||||||
|
|
||||||
|
"drn_DynamicWeather_DebugTextEventArgs" addPublicVariableEventHandler {
|
||||||
|
drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Summary: Shows debug text on local client.
|
||||||
|
* Arguments:
|
||||||
|
* _text: Debug text.
|
||||||
|
*/
|
||||||
|
drn_fnc_DynamicWeather_ShowDebugTextLocal = {
|
||||||
|
private ["_minutes", "_seconds"];
|
||||||
|
|
||||||
|
if (!isNull player) then {
|
||||||
|
player sideChat (_this select 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
_minutes = floor (time / 60);
|
||||||
|
_seconds = floor (time - (_minutes * 60));
|
||||||
|
diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Summary: Shows debug text on all clients.
|
||||||
|
* Arguments:
|
||||||
|
* _text: Debug text.
|
||||||
|
*/
|
||||||
|
drn_fnc_DynamicWeather_ShowDebugTextAllClients = {
|
||||||
|
drn_DynamicWeather_DebugTextEventArgs = _this;
|
||||||
|
publicVariable "drn_DynamicWeather_DebugTextEventArgs";
|
||||||
|
drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Starting script WeatherEffects.sqf..."] call drn_fnc_DynamicWeather_ShowDebugTextLocal;
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_DynamicWeatherEventArgs = []; // [current overcast, current fog, current rain, current weather change ("OVERCAST", "FOG" or ""), target weather value, time until weather completion (in seconds), current wind x, current wind z]
|
||||||
|
drn_AskServerDynamicWeatherEventArgs = []; // []
|
||||||
|
|
||||||
|
drn_fnc_DynamicWeather_SetWeatherLocal = {
|
||||||
|
private ["_currentOvercast", "_currentFog", "_currentRain", "_currentWeatherChange", "_targetWeatherValue", "_timeUntilCompletion", "_currentWindX", "_currentWindZ"];
|
||||||
|
|
||||||
|
_currentOvercast = _this select 0;
|
||||||
|
_currentFog = _this select 1;
|
||||||
|
_currentRain = _this select 2;
|
||||||
|
_currentWeatherChange = _this select 3;
|
||||||
|
_targetWeatherValue = _this select 4;
|
||||||
|
_timeUntilCompletion = _this select 5;
|
||||||
|
_currentWindX = _this select 6;
|
||||||
|
_currentWindZ = _this select 7;
|
||||||
|
|
||||||
|
// Set current weather values
|
||||||
|
0 setOvercast _currentOvercast;
|
||||||
|
0 setFog _currentFog;
|
||||||
|
drn_var_DynamicWeather_Rain = _currentRain;
|
||||||
|
setWind [_currentWindX, _currentWindZ, true];
|
||||||
|
|
||||||
|
// Set forecast
|
||||||
|
if (_currentWeatherChange == "OVERCAST") then {
|
||||||
|
_timeUntilCompletion setOvercast _targetWeatherValue;
|
||||||
|
};
|
||||||
|
if (_currentWeatherChange == "FOG") then {
|
||||||
|
_timeUntilCompletion setFog _targetWeatherValue;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isServer) then {
|
||||||
|
"drn_DynamicWeatherEventArgs" addPublicVariableEventHandler {
|
||||||
|
drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
|
||||||
|
};
|
||||||
|
|
||||||
|
waitUntil {!isNil "drn_var_DynamicWeather_ServerInitialized"};
|
||||||
|
|
||||||
|
drn_AskServerDynamicWeatherEventArgs = [true];
|
||||||
|
publicVariable "drn_AskServerDynamicWeatherEventArgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
drn_fnc_DynamicWeather_SetWeatherAllClients = {
|
||||||
|
private ["_timeUntilCompletion", "_currentWeatherChange"];
|
||||||
|
|
||||||
|
_timeUntilCompletion = drn_DynamicWeather_WeatherChangeCompletedTime - drn_DynamicWeather_WeatherChangeStartedTime;
|
||||||
|
if (_timeUntilCompletion > 0) then {
|
||||||
|
_currentWeatherChange = drn_DynamicWeather_CurrentWeatherChange;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentWeatherChange = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_DynamicWeatherEventArgs = [overcast, fog, drn_var_DynamicWeather_Rain, _currentWeatherChange, drn_DynamicWeather_WeatherTargetValue, _timeUntilCompletion, drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ];
|
||||||
|
publicVariable "drn_DynamicWeatherEventArgs";
|
||||||
|
drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
|
||||||
|
};
|
||||||
|
|
||||||
|
"drn_AskServerDynamicWeatherEventArgs" addPublicVariableEventHandler {
|
||||||
|
call drn_fnc_DynamicWeather_SetWeatherAllClients;
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_DynamicWeather_CurrentWeatherChange = "";
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = 0;
|
||||||
|
drn_DynamicWeather_WeatherChangeStartedTime = time;
|
||||||
|
drn_DynamicWeather_WeatherChangeCompletedTime = time;
|
||||||
|
drn_DynamicWeather_WindX = _initialWind select 0;
|
||||||
|
drn_DynamicWeather_WindZ = _initialWind select 1;
|
||||||
|
|
||||||
|
if (_initialFog == -1) then {
|
||||||
|
_initialFog = (_minimumFog + random (_maximumFog - _minimumFog));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_initialFog < _minimumFog) then {
|
||||||
|
_initialFog = _minimumFog;
|
||||||
|
};
|
||||||
|
if (_initialFog > _maximumFog) then {
|
||||||
|
_initialFog = _maximumFog;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
0 setFog _initialFog;
|
||||||
|
|
||||||
|
if (_initialOvercast == -1) then {
|
||||||
|
_initialOvercast = (_minimumOvercast + random (_maximumOvercast - _minimumOvercast));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_initialOvercast < _minimumOvercast) then {
|
||||||
|
_initialOvercast = _minimumOvercast;
|
||||||
|
};
|
||||||
|
if (_initialOvercast > _maximumOvercast) then {
|
||||||
|
_initialOvercast = _maximumOvercast;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
0 setOvercast _initialOvercast;
|
||||||
|
|
||||||
|
if (_initialOvercast >= 0.75) then {
|
||||||
|
if (_initialRain == -1) then {
|
||||||
|
_initialRain = (_minimumRain + random (_minimumRain - _minimumRain));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_initialRain < _minimumRain) then {
|
||||||
|
_initialRain = _minimumRain;
|
||||||
|
};
|
||||||
|
if (_initialRain > _maximumRain) then {
|
||||||
|
_initialRain = _maximumRain;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_initialRain = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_var_DynamicWeather_Rain = _initialRain;
|
||||||
|
0 setRain drn_var_DynamicWeather_Rain;
|
||||||
|
|
||||||
|
_maxWind = _minimumWind + random (_maximumWind - _minimumWind);
|
||||||
|
|
||||||
|
if (drn_DynamicWeather_WindX == -1) then {
|
||||||
|
if (random 100 < 50) then {
|
||||||
|
drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (drn_DynamicWeather_WindZ == -1) then {
|
||||||
|
if (random 100 < 50) then {
|
||||||
|
drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
setWind [drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ, true];
|
||||||
|
|
||||||
|
sleep 0.05;
|
||||||
|
|
||||||
|
publicVariable "drn_var_DynamicWeather_Rain";
|
||||||
|
drn_var_DynamicWeather_ServerInitialized = true;
|
||||||
|
publicVariable "drn_var_DynamicWeather_ServerInitialized";
|
||||||
|
|
||||||
|
// Start weather thread
|
||||||
|
[_minWeatherChangeTimeMin, _maxWeatherChangeTimeMin, _minTimeBetweenWeatherChangesMin, _maxTimeBetweenWeatherChangesMin, _minimumFog, _maximumFog, _minimumOvercast, _maximumOvercast, _minimumWind, _maximumWind, _windChangeProbability, _debug] spawn {
|
||||||
|
private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumWind", "_maximumWind", "_windChangeProbability", "_debug"];
|
||||||
|
private ["_weatherType", "_fogLevel", "_overcastLevel", "_oldFogLevel", "_oldOvercastLevel", "_weatherChangeTimeSek"];
|
||||||
|
|
||||||
|
_minWeatherChangeTimeMin = _this select 0;
|
||||||
|
_maxWeatherChangeTimeMin = _this select 1;
|
||||||
|
_minTimeBetweenWeatherChangesMin = _this select 2;
|
||||||
|
_maxTimeBetweenWeatherChangesMin = _this select 3;
|
||||||
|
_minimumFog = _this select 4;
|
||||||
|
_maximumFog = _this select 5;
|
||||||
|
_minimumOvercast = _this select 6;
|
||||||
|
_maximumOvercast = _this select 7;
|
||||||
|
_minimumWind = _this select 8;
|
||||||
|
_maximumWind = _this select 9;
|
||||||
|
_windChangeProbability = _this select 10;
|
||||||
|
_debug = _this select 11;
|
||||||
|
|
||||||
|
// Set initial fog level
|
||||||
|
_fogLevel = 2;
|
||||||
|
_overcastLevel = 2;
|
||||||
|
|
||||||
|
while {1 == 1} do {
|
||||||
|
// Sleep a while until next weather change
|
||||||
|
sleep floor (_minTimeBetweenWeatherChangesMin * 60 + random ((_maxTimeBetweenWeatherChangesMin - _minTimeBetweenWeatherChangesMin) * 60));
|
||||||
|
|
||||||
|
if (_minimumFog == _maximumFog && _minimumOvercast != _maximumOvercast) then {
|
||||||
|
_weatherType = "OVERCAST";
|
||||||
|
};
|
||||||
|
if (_minimumFog != _maximumFog && _minimumOvercast == _maximumOvercast) then {
|
||||||
|
_weatherType = "FOG";
|
||||||
|
};
|
||||||
|
if (_minimumFog != _maximumFog && _minimumOvercast != _maximumOvercast) then {
|
||||||
|
|
||||||
|
// Select type of weather to change
|
||||||
|
if ((random 100) < 50) then {
|
||||||
|
_weatherType = "OVERCAST";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_weatherType = "FOG";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
//_weatherType = "OVERCAST";
|
||||||
|
|
||||||
|
if (_weatherType == "FOG") then {
|
||||||
|
|
||||||
|
drn_DynamicWeather_CurrentWeatherChange = "FOG";
|
||||||
|
|
||||||
|
// Select a new fog level
|
||||||
|
_oldFogLevel = _fogLevel;
|
||||||
|
_fogLevel = floor ((random 100) / 25);
|
||||||
|
|
||||||
|
while {_fogLevel == _oldFogLevel} do {
|
||||||
|
_fogLevel = floor ((random 100) / 25);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_fogLevel == 0) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * random 0.05;
|
||||||
|
};
|
||||||
|
if (_fogLevel == 1) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.05 + random 0.2);
|
||||||
|
};
|
||||||
|
if (_fogLevel == 2) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.25 + random 0.3);
|
||||||
|
};
|
||||||
|
if (_fogLevel == 3) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.55 + random 0.45);
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_DynamicWeather_WeatherChangeStartedTime = time;
|
||||||
|
_weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
|
||||||
|
drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Weather forecast: Fog " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_weatherType == "OVERCAST") then {
|
||||||
|
|
||||||
|
drn_DynamicWeather_CurrentWeatherChange = "OVERCAST";
|
||||||
|
|
||||||
|
// Select a new overcast level
|
||||||
|
_oldOvercastLevel = _overcastLevel;
|
||||||
|
//_overcastLevel = floor ((random 100) / 25);
|
||||||
|
_overcastLevel = 3;
|
||||||
|
|
||||||
|
while {_overcastLevel == _oldOvercastLevel} do {
|
||||||
|
_overcastLevel = floor ((random 100) / 25);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_overcastLevel == 0) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * random 0.05;
|
||||||
|
};
|
||||||
|
if (_overcastLevel == 1) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.05 + random 0.3);
|
||||||
|
};
|
||||||
|
if (_overcastLevel == 2) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.35 + random 0.35);
|
||||||
|
};
|
||||||
|
if (_overcastLevel == 3) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.7 + random 0.3);
|
||||||
|
};
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
/*
|
||||||
|
if (overcast > 0.8) then {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = 0.5;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_DynamicWeather_WeatherTargetValue = 0.85;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
drn_DynamicWeather_WeatherChangeStartedTime = time;
|
||||||
|
_weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
|
||||||
|
drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Weather forecast: Overcast " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// On average every one fourth of weather changes, change wind too
|
||||||
|
if (random 100 < _windChangeProbability) then {
|
||||||
|
private ["_maxWind"];
|
||||||
|
|
||||||
|
_maxWind = _minimumWind + random (_maximumWind - _minimumWind);
|
||||||
|
|
||||||
|
if (random 100 < 50) then {
|
||||||
|
drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
|
||||||
|
};
|
||||||
|
if (random 100 < 50) then {
|
||||||
|
drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Wind changes: [" + str drn_DynamicWeather_WindX + ", " + str drn_DynamicWeather_WindZ + "]."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
call drn_fnc_DynamicWeather_SetWeatherAllClients;
|
||||||
|
|
||||||
|
sleep _weatherChangeTimeSek;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Start rain thread
|
||||||
|
if (_rainIntervalRainProbability > 0) then {
|
||||||
|
[_minimumRain, _maximumRain, _forceRainToStopAfterOneRainInterval, _minRainIntervalTimeMin, _maxRainIntervalTimeMin, _rainIntervalRainProbability, _debug] spawn {
|
||||||
|
private ["_minimumRain", "_maximumRain", "_forceRainToStopAfterOneRainInterval", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_rainIntervalRainProbability", "_debug"];
|
||||||
|
private ["_nextRainEventTime", "_forceStop"];
|
||||||
|
|
||||||
|
_minimumRain = _this select 0;
|
||||||
|
_maximumRain = _this select 1;
|
||||||
|
_forceRainToStopAfterOneRainInterval = _this select 2;
|
||||||
|
_minRainIntervalTimeMin = _this select 3;
|
||||||
|
_maxRainIntervalTimeMin = _this select 4;
|
||||||
|
_rainIntervalRainProbability = _this select 5;
|
||||||
|
_debug = _this select 6;
|
||||||
|
|
||||||
|
if (rain > 0) then {
|
||||||
|
drn_var_DynamicWeather_Rain = rain;
|
||||||
|
publicVariable "drn_var_DynamicWeather_Rain";
|
||||||
|
};
|
||||||
|
|
||||||
|
_nextRainEventTime = time;
|
||||||
|
_forceStop = false;
|
||||||
|
|
||||||
|
while {1 == 1} do {
|
||||||
|
|
||||||
|
if (overcast > 0.75) then {
|
||||||
|
|
||||||
|
if (time >= _nextRainEventTime) then {
|
||||||
|
private ["_rainTimeSec"];
|
||||||
|
|
||||||
|
// At every rain event time, start or stop rain with 50% probability
|
||||||
|
if (random 100 < _rainIntervalRainProbability && !_forceStop) then {
|
||||||
|
drn_var_DynamicWeather_rain = _minimumRain + random (_maximumRain - _minimumRain);
|
||||||
|
publicVariable "drn_var_DynamicWeather_rain";
|
||||||
|
|
||||||
|
_forceStop = _forceRainToStopAfterOneRainInterval;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drn_var_DynamicWeather_rain = 0;
|
||||||
|
publicVariable "drn_var_DynamicWeather_rain";
|
||||||
|
|
||||||
|
_forceStop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Pick a time for next rain change
|
||||||
|
_rainTimeSec = _minRainIntervalTimeMin * 60 + random ((_maxRainIntervalTimeMin - _minRainIntervalTimeMin) * 60);
|
||||||
|
_nextRainEventTime = time + _rainTimeSec;
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Rain set to " + str drn_var_DynamicWeather_rain + " for " + str (_rainTimeSec / 60) + " minutes"] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (drn_var_DynamicWeather_rain != 0) then {
|
||||||
|
drn_var_DynamicWeather_rain = 0;
|
||||||
|
publicVariable "drn_var_DynamicWeather_rain";
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
["Rain stops due to low overcast."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_nextRainEventTime = time;
|
||||||
|
_forceStop = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
sleep 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sleep 10;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
drn_var_rainRoutine = [_rainIntervalRainProbability, _debug] spawn {
|
||||||
|
private ["_rainIntervalRainProbability", "_debug"];
|
||||||
|
private ["_rain", "_rainPerSecond"];
|
||||||
|
|
||||||
|
_rainIntervalRainProbability = _this select 0;
|
||||||
|
_debug = _this select 1;
|
||||||
|
|
||||||
|
if (_debug) then {
|
||||||
|
_rainPerSecond = 0.2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_rainPerSecond = 0.03;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_rainIntervalRainProbability > 0) then {
|
||||||
|
_rain = drn_var_DynamicWeather_Rain;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_rain = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
0 setRain _rain;
|
||||||
|
sleep 0.1;
|
||||||
|
|
||||||
|
while {1 == 1} do {
|
||||||
|
if (_rainIntervalRainProbability > 0) then {
|
||||||
|
if (_rain < drn_var_DynamicWeather_Rain) then {
|
||||||
|
_rain = _rain + _rainPerSecond;
|
||||||
|
if (_rain > 1) then { _rain = 1; };
|
||||||
|
};
|
||||||
|
if (_rain > drn_var_DynamicWeather_Rain) then {
|
||||||
|
_rain = _rain - _rainPerSecond;
|
||||||
|
if (_rain < 0) then { _rain = 0; };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_rain = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
3 setRain _rain;
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
45
SQF/dayz_code/system/ca/functions/fn_initCounter.sqf
Normal file
45
SQF/dayz_code/system/ca/functions/fn_initCounter.sqf
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
private ["_mode", "_activationCount", "_maxCount", "_timesActivated", "_keyString"];
|
||||||
|
_mode = _this;
|
||||||
|
_activationCount = 4;
|
||||||
|
_maxCount = 25;
|
||||||
|
_timesActivated = 1;
|
||||||
|
_keyString = "BIS_IAmBeingNaughty";
|
||||||
|
|
||||||
|
for "_i" from 1 to (_maxCount - 1) do
|
||||||
|
{
|
||||||
|
if (isKeyActive (_keyString + (str _i))) then
|
||||||
|
{
|
||||||
|
_timesActivated = _timesActivated + 1
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_mode) then
|
||||||
|
{
|
||||||
|
if (_timesActivated <= _maxCount) then
|
||||||
|
{
|
||||||
|
activateKey (_keyString + (str _timesActivated));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_timesActivated >= _activationCount) then
|
||||||
|
{
|
||||||
|
private ["_handle"];
|
||||||
|
_handle = [_timesActivated] execVM "ca\modules\functions\systems\fn_enableSystem.sqf";
|
||||||
|
|
||||||
|
if ((random 5) < 1) then
|
||||||
|
{
|
||||||
|
_handle = [_timesActivated] execVM "ca\modules\functions\systems\fn_enableAnotherSystem.sqf";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((configName (configFile >> "CfgPatches" >> "CA_E")) != "") then
|
||||||
|
{
|
||||||
|
for "_i" from 1 to (_timesActivated - 1) do
|
||||||
|
{
|
||||||
|
call (compile "deactivateKey (_keyString + (str _i))");
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
||||||
114
SQF/dayz_code/system/ca/functions/init.sqf
Normal file
114
SQF/dayz_code/system/ca/functions/init.sqf
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
scriptName "Functions\init.sqf";
|
||||||
|
textLogFormat ["PRELOAD_ Functions\init.sqf %1", _this];
|
||||||
|
/*
|
||||||
|
File: init.sqf
|
||||||
|
Author: Karel Moricky
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Function library initialization.
|
||||||
|
All files have to start with 'fn_' prefix && they name have to be same as name of function.
|
||||||
|
Don't forget to exclude comma after last item in array!
|
||||||
|
|
||||||
|
Caution:
|
||||||
|
Do not execute this init directly - there is dependency with MPF && need to run on all machines.
|
||||||
|
|
||||||
|
Parameter(s):
|
||||||
|
_this select 0: 'Function manager' logic
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isServer) then {textLogFormat ["MPF_Client FUNCTIONS init.sqf ..."];};
|
||||||
|
|
||||||
|
private ["_recompile"];
|
||||||
|
_recompile = (count _this) > 0;
|
||||||
|
|
||||||
|
//--- Functions are already running
|
||||||
|
if ((!isNil "BIS_fnc_init") && !_recompile) exitwith {textLogFormat["PRELOAD_ Functions already running."];};
|
||||||
|
textLogFormat ["Log: [Functions] Init script executed at %1",time];
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
//--- PREPROCESS -----------------------------------------------------------------------------------------
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//--- Create variables for all functions (&& preprocess them after first call)
|
||||||
|
for "_t" from 0 to 2 do {
|
||||||
|
_pathConfig = [configfile,campaignconfigfile,missionconfigfile] select _t;
|
||||||
|
_pathFile = ["ca\modules\functions","functions","functions"] select _t;
|
||||||
|
|
||||||
|
_cfgFunctions = (_pathConfig >> "cfgfunctions");
|
||||||
|
for "_c" from 0 to (count _cfgFunctions - 1) do {
|
||||||
|
_currentTag = _cfgFunctions select _c;
|
||||||
|
|
||||||
|
//--- Is Tag
|
||||||
|
if (isclass _currentTag) then {
|
||||||
|
_tagName = configname _currentTag;
|
||||||
|
_itemPathTag = gettext (_currentTag >> "file");
|
||||||
|
|
||||||
|
for "_i" from 0 to (count _currentTag - 1) do {
|
||||||
|
_currentCategory = _currentTag select _i;
|
||||||
|
|
||||||
|
//--- Is Category
|
||||||
|
if (isclass _currentCategory) then {
|
||||||
|
_categoryName = configname _currentCategory;
|
||||||
|
_itemPathCat = gettext (_currentCategory >> "file");
|
||||||
|
|
||||||
|
for "_n" from 0 to (count _currentCategory - 1) do {
|
||||||
|
_currentItem = _currentCategory select _n;
|
||||||
|
|
||||||
|
//--- Is Item
|
||||||
|
if (isclass _currentItem) then {
|
||||||
|
|
||||||
|
_itemName = configname _currentItem;
|
||||||
|
_itemPathItem = gettext (_currentItem >> "file");
|
||||||
|
_itemPath = if (_itemPathItem != "") then {_itemPathItem} else {
|
||||||
|
if (_itemPathCat != "") then {_itemPathCat + "\fn_" + _itemName + ".sqf"} else {
|
||||||
|
if (_itemPathTag != "") then {_itemPathTag + "\fn_" + _itemName + ".sqf"} else {""};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_itemPath = if (_itemPath == "") then {_pathFile + "\" + _categoryName + "\fn_" + _itemName + ".sqf"} else {_itemPath};
|
||||||
|
call compile format ["
|
||||||
|
if (isnil '%2_fnc_%3' || %4) then {
|
||||||
|
%2_fnc_%3 = {
|
||||||
|
if (!%4) then {debuglog ('Log: [Functions] %2_fnc_%3 loaded (%1)')};
|
||||||
|
%2_fnc_%3 = compile preprocessFileLineNumbers '%1';
|
||||||
|
_this call %2_fnc_%3;
|
||||||
|
};
|
||||||
|
%2_fnc_%3_path = '%1';
|
||||||
|
};
|
||||||
|
",_itemPath,_tagName,_itemName,_recompile];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//"
|
||||||
|
|
||||||
|
private ["_test", "_test2"];
|
||||||
|
_test = (_this select 0) setPos (getPos (_this select 0)); if (isnil "_test") then {_test = false};
|
||||||
|
_test2 = (_this select 0) playMove ""; if (isnil "_test2") then {_test2 = false};
|
||||||
|
_testvar = getText (configFile >> "CfgMissions" >> "Missions" >> "SP_BearRising" >> "directory");
|
||||||
|
if (_testvar != "") then {
|
||||||
|
(_test || _test2) call (compile (preprocessFileLineNumbers "\z\addons\dayz_code\system\ca\functions\fn_initCounter.sqf"));
|
||||||
|
} else { // Player has A2 Free
|
||||||
|
if (_test || _test2) then {0 call (compile (preprocessFileLineNumbers "ca\modules\functions\misc\fn_initCounter.sqf"))};
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
//--- INIT COMPLETE --------------------------------------------------------------------------------------
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
waitUntil {!isNil "BIS_MPF_InitDone"}; //functions init must be after MPF init
|
||||||
|
BIS_fnc_init = true;
|
||||||
|
|
||||||
|
|
||||||
|
//if ((missionStart select 0) != 0) then {endLoadingScreen;textLogFormat["PRELOAD_ HACK isServer %1 endLoadingScreen (init functions EH)", isServer];}; //TODO:FIXME:HACK: - in multiplayer game freezes because init.sqf is not launched in MP preload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
textLogFormat ["Log: [Functions] Init script terminated at %1",time];
|
||||||
Reference in New Issue
Block a user