Advertisement
termy

Untitled

Sep 14th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.58 KB | None | 0 0
  1. DESCRIPTION.SQF:
  2. loadscreen=dayznight.jpg;
  3. respawn = "BASE";
  4. respawndelay = 5;
  5. onLoadMission= "DayZ Taviana";
  6. OnLoadIntro = "Welcome to Taviana";
  7. OnLoadIntroTime = False;
  8. OnLoadMissionTime = False;
  9. disabledAI = true;
  10. disableChannels[]={0,2,6};
  11. enableItemsDropping = 0;
  12.  
  13. class Header
  14. {
  15. gameType = COOP; //DM, Team, Coop, ...
  16. minPlayers = 1; //min # of players the mission supports
  17. maxPlayers = 100; //Max # of players the mission supports
  18. };
  19.  
  20. aiKills = 1;
  21. diagRadio = 1;
  22. diagHit = 1;
  23.  
  24. class RscText
  25. {
  26. type = 0;
  27. idc = -1;
  28. x = 0;
  29. y = 0;
  30. h = 0.037;
  31. w = 0.3;
  32. style = 0x100;
  33. font = Zeppelin32;
  34. SizeEx = 0.03921;
  35. colorText[] = {1,1,1,1};
  36. colorBackground[] = {0, 0, 0, 0};
  37. linespacing = 1;
  38. };
  39. class RscPicture
  40. {
  41. access=0;
  42. type=0;
  43. idc=-1;
  44. style=48;
  45. colorBackground[]={0,0,0,0};
  46. colorText[]={1,1,1,1};
  47. font="TahomaB";
  48. sizeEx=0;
  49. lineSpacing=0;
  50. text="";
  51. };
  52. class RscLoadingText : RscText
  53. {
  54. style = 2;
  55. x = 0.323532;
  56. y = 0.666672;
  57. w = 0.352944;
  58. h = 0.039216;
  59. sizeEx = 0.03921;
  60. colorText[] = {0.543,0.5742,0.4102,1.0};
  61. };
  62. class RscProgress
  63. {
  64. x = 0.344;
  65. y = 0.619;
  66. w = 0.313726;
  67. h = 0.0261438;
  68. texture = "\ca\ui\data\loadscreen_progressbar_ca.paa";
  69. colorFrame[] = {0,0,0,0};
  70. colorBar[] = {1,1,1,1};
  71. };
  72. class RscProgressNotFreeze
  73. {
  74. idc = -1;
  75. type = 45;
  76. style = 0;
  77. x = 0.022059;
  78. y = 0.911772;
  79. w = 0.029412;
  80. h = 0.039216;
  81. texture = "#(argb,8,8,3)color(0,0,0,0)";
  82. };
  83. //
  84. // the loading screen itself
  85. //
  86. class DayZ_loadingScreen
  87. {
  88. idd = -1;
  89. duration = 10e10;
  90. fadein = 0;
  91. fadeout = 0;
  92. name = "loading screen";
  93. class controlsBackground
  94. {
  95. class blackBG : RscText
  96. {
  97. x = safezoneX;
  98. y = safezoneY;
  99. w = safezoneW;
  100. h = safezoneH;
  101. text = "";
  102. colorText[] = {0,0,0,0};
  103. colorBackground[] = {0,0,0,1};
  104. };
  105. /*
  106. class nicePic : RscPicture
  107. {
  108. style = 48 + 0x800; // ST_PICTURE + ST_KEEP_ASPECT_RATIO
  109. x = safezoneX + safezoneW/2 - 0.25;
  110. y = safezoneY + safezoneH/2 - 0.2;
  111. w = 0.5;
  112. h = 0.4;
  113. text = "img\nicePic.paa";
  114. };
  115. */
  116. };
  117. class controls
  118. {
  119. class Title1 : RscLoadingText
  120. {
  121. text = "$STR_LOADING"; // "Loading" text in the middle of the screen
  122. };
  123. class CA_Progress : RscProgress // progress bar, has to have idc 104
  124. {
  125. idc = 104;
  126. type = 8; // CT_PROGRESS
  127. style = 0; // ST_SINGLE
  128. texture = "\ca\ui\data\loadscreen_progressbar_ca.paa";
  129. };
  130. class CA_Progress2 : RscProgressNotFreeze // progress bar that will go reverse
  131. {
  132. idc = 103;
  133. };
  134. class Name2: RscText // the text on the top-left
  135. {
  136. idc = 101;
  137. x = 0.05;
  138. y = 0.029412;
  139. w = 0.9;
  140. h = 0.04902;
  141. text = "";
  142. sizeEx = 0.05;
  143. colorText[] = {0.543,0.5742,0.4102,1.0};
  144. };
  145. };
  146. };
  147. class CfgSounds
  148. {
  149. sounds[] = {};
  150.  
  151. class playerSnoring
  152. {
  153. name="playerSnoring";
  154. sound[]={\custom\sfx\snoring.ogg,0.9,1};
  155. titles[] = {};
  156. };
  157. };
  158.  
  159. INIT.SQF:
  160. startLoadingScreen ["","DayZ_loadingScreen"];
  161. enableSaving [false, false];
  162.  
  163. dayZ_instance = 2031; //The instance
  164. hiveInUse = true;
  165. initialized = false;
  166. dayz_previousID = 0;
  167.  
  168. call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf"; //Initilize the Variables (IMPORTANT: Must happen very early)
  169.  
  170. // (Taviana) Override some of the variables:
  171. call compile preprocessFileLineNumbers "\kh\dayztaviana\init\variables.sqf";
  172.  
  173. // Load in the settings compiles:
  174. call compile preprocessFileLineNumbers "\kh\dayztaviana\settingsinit\kh_compiles.sqf";
  175.  
  176. diag_log "Started executing user settings file.";
  177. call compile preprocessFileLineNumbers "settings.sqf";
  178. diag_log "Finished executing user settings file.";
  179.  
  180. progressLoadingScreen 0.1;
  181. call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf"; //Initilize the publicVariable event handlers
  182. progressLoadingScreen 0.2;
  183. call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf"; //Functions used by CLIENT for medical
  184. progressLoadingScreen 0.4;
  185.  
  186. // (Taviana) Don't call the regular compile:
  187. // call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf"; //Compile regular functions
  188.  
  189. // (Taviana) Instead, call a copy of the DayZ 1.7.4.4 compiles:
  190. call compile preprocessFileLineNumbers "\kh\dayztaviana\init\compiles.sqf"; //Compile regular functions
  191.  
  192. // (Taviana) Set up the for maule multiplayer prop hit support:
  193. call compile preprocessFileLineNumbers "\khr\maule\scripts\maule_init.sqf";
  194.  
  195. /*
  196. The Bliss package system works a bit like sticking your arm in a bunch
  197. of snake nests and noticing you don't always get bitten. In this case
  198. we got bitten; this line is to fool the merge process:
  199.  
  200. call compile preprocessFileLineNumbers "\fixes\compiles.sqf"; //Compile regular functions
  201. */
  202.  
  203. progressLoadingScreen 1.0;
  204.  
  205. player setVariable ["BIS_noCoreConversations", true];
  206. //enableRadio false;
  207.  
  208. "filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
  209.  
  210. if (isServer) then {
  211. hiveInUse = true;
  212. _serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
  213. };
  214.  
  215. if (!isDedicated) then {
  216. 0 fadeSound 0;
  217. 0 cutText [(localize "STR_AUTHENTICATING"), "BLACK FADED",60];
  218. _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
  219. _playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
  220.  
  221. };
  222.  
  223. // Extra actions for Taviana:
  224. if (!isDedicated) then {
  225. [] execVM "kh_actions.sqf";
  226. [] ExecVM "axs_gearmanagement\doGear.sqf";
  227. };
  228. [] ExecVM "custom_monitor.sqf";
  229. //R3F Towing and shit (or whatever you want to title it)
  230. execVM "R3F_ARTY_AND_LOG\init.sqf"
  231.  
  232. COMPILES.SQF
  233. /*
  234. FUNCTION COMPILES
  235. */
  236. //Player only
  237.  
  238. if (!isDedicated) then {
  239. "filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
  240.  
  241. BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
  242. player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
  243. player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
  244. fnc_usec_damageActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageActions.sqf"; //Checks which actions for nearby casualty
  245. fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
  246. fnc_usec_selfActions = compile preprocessFileLineNumbers "\fixes\fn_selfActions.sqf"; //Checks which actions for self
  247. fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
  248. player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
  249. player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
  250. player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
  251. player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
  252. player_spawnLootCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnlootCheck.sqf";
  253. player_spawnZedCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnzedCheck.sqf";
  254. building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
  255. player_taskHint = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_taskHint.sqf";
  256. building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
  257. //animal_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\animal_monitor.sqf";
  258. building_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\building_monitor.sqf";
  259. player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating
  260. player_packTent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_packTent.sqf";
  261. control_zombieAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\control_zombieAgent.sqf";
  262. player_updateGui = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_updateGui.sqf";
  263. player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
  264. spawn_flies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_flies.sqf";
  265. stream_locationFill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationFill.sqf";
  266. stream_locationDel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationDel.sqf";
  267. stream_locationCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\stream_locationCheck.sqf";
  268. player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
  269. player_login = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_login.sqf"; //Used to generate ambient music
  270. player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
  271. player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
  272. player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
  273. world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
  274. world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
  275. player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
  276. player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
  277. player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
  278. player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
  279.  
  280. //Objects
  281. object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
  282. object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
  283. object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
  284.  
  285. //Zombies
  286. zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
  287. zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
  288. zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
  289. //swarm_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\swarm_generate.sqf"; //Server compile, used for Swarms behaviour
  290.  
  291. //
  292. dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
  293.  
  294.  
  295. //actions
  296. player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
  297. player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
  298. player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
  299. player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
  300. player_createstash = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_createstash.sqf";
  301. player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
  302. player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
  303. player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
  304. player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
  305. player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
  306. player_chopWood = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_chopWood.sqf";
  307. player_build = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_build.sqf";
  308. player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
  309. player_dropWeapon = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_dropWeapon.sqf";
  310. player_setTrap = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_setTrap.sqf";
  311. object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
  312. player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
  313. player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
  314. player_combineMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_combineMags.sqf";
  315. player_createquiver = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_createQuiver.sqf";
  316. player_fillquiver = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_fillQuiver.sqf";
  317. player_takearrow = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_takeArrow.sqf";
  318.  
  319. //ui
  320. player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
  321. player_gearSync = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSync.sqf";
  322. player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
  323. ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
  324.  
  325. //playerstats
  326. horde_epeen_fnc_fill_page = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\fill_page_fnc.sqf";
  327. horde_epeen_determine_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\determine_humanity_fnc.sqf";
  328. horde_epeen_setText_journal_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_journal.sqf";
  329. horde_epeen_setText_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_humanity.sqf";
  330. horde_epeen_setText_stats_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\epeen_setText_stats.sqf";
  331. horde_epeen_show_humanity_fnc = compile preProcessFile "\z\addons\dayz_code\actions\playerstats\show_humanity_fnc.sqf";
  332.  
  333. //System
  334. player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
  335. player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
  336. player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
  337. onPreloadStarted "dayz_preloadFinished = false;";
  338. onPreloadFinished "dayz_preloadFinished = true;";
  339. infectedcamps = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_infectedcamps.sqf";
  340. camp_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\camp_spawnZombies.sqf"; //Server compile, used for loiter behaviour
  341.  
  342. //Crafting
  343. //player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
  344.  
  345. // TODO: need move it in player_monitor.fsm
  346. // allow player disconnect from server, if loading hang, kicked by BE etc.
  347.  
  348. //This is still needed but the fsm should terminate if any errors pop up.
  349.  
  350. [] spawn {
  351. private["_timeOut","_display","_control1","_control2"];
  352. disableSerialization;
  353. _timeOut = 0;
  354. dayz_loadScreenMsg = "";
  355. diag_log "DEBUG: loadscreen guard started.";
  356. _display = uiNameSpace getVariable "BIS_loadingScreen";
  357. _control1 = _display displayctrl 8400;
  358. _control2 = _display displayctrl 102;
  359. // 120 sec timeout
  360. while { _timeOut < 3000 && !dayz_clientPreload && !dayz_authed } do {
  361.  
  362. if ( isNull _display ) then {
  363. waitUntil { !dialog; };
  364. startLoadingScreen ["","RscDisplayLoadCustom"];
  365. _display = uiNameSpace getVariable "BIS_loadingScreen";
  366. _control1 = _display displayctrl 8400;
  367. _control2 = _display displayctrl 102;
  368. };
  369.  
  370. if ( dayz_loadScreenMsg != "" ) then {
  371. _control1 ctrlSetText dayz_loadScreenMsg;
  372. dayz_loadScreenMsg = "";
  373. };
  374. _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
  375. _timeOut = _timeOut + 1;
  376. sleep 0.01;
  377. };
  378. endLoadingScreen;
  379. /*
  380. if ( !dayz_clientPreload && !dayz_authed ) then {
  381. diag_log "DEBUG: loadscreen guard ended with timeout.";
  382. disableUserInput false;
  383. 1 cutText ["Disconnected!", "PLAIN"];
  384. player enableSimulation false;
  385. } else { diag_log "DEBUG: loadscreen guard ended."; };
  386. */
  387. };
  388.  
  389. dayz_losChance = {
  390. private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
  391. _agent = _this select 0;
  392. _dis = _this select 1;
  393. _maxDis = _this select 2;
  394. //diag_log ("VAL: " + str(_this));
  395. _val = (_maxDis - _dis) max 0;
  396. _maxExp = ((exp 2) * _maxDis);
  397. _myExp = ((exp 2) * (_val)) / _maxExp;
  398. _myExp = _myExp * 0.7;
  399. _myExp
  400. };
  401.  
  402. ui_initDisplay = {
  403. private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
  404. disableSerialization;
  405. _display = uiNamespace getVariable 'DAYZ_GUI_display';
  406. _control = _display displayCtrl 1204;
  407. _control ctrlShow false;
  408. if (!r_player_injured) then {
  409. _ctrlBleed = _display displayCtrl 1303;
  410. _ctrlBleed ctrlShow false;
  411. };
  412. if (!r_fracture_legs and !r_fracture_arms) then {
  413. _ctrlFracture = _display displayCtrl 1203;
  414. _ctrlFracture ctrlShow false;
  415. };
  416. _ctrlDogFoodBorder = _display displayCtrl 1501;
  417. _ctrlDogFoodBorder ctrlShow false;
  418. _ctrlDogFood = _display displayCtrl 1701;
  419. _ctrlDogFood ctrlShow false;
  420.  
  421. _ctrlDogWaterBorder = _display displayCtrl 1502;
  422. _ctrlDogWaterBorder ctrlShow false;
  423. _ctrlDogWater = _display displayCtrl 1702;
  424. _ctrlDogWater ctrlShow false
  425. };
  426.  
  427. dayz_losCheck = {
  428. private["_target","_agent","_cantSee"];
  429. _target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
  430. _agent = _this select 1;
  431. _cantSee = true;
  432. if (!isNull _target) then {
  433. _tPos = eyePos _target;
  434. _zPos = eyePos _agent;
  435. if ((count _tPos > 0) and (count _zPos > 0)) then {
  436. _cantSee = terrainIntersectASL [_tPos, _zPos];
  437. if (!_cantSee) then {
  438. _cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
  439. };
  440. };
  441. };
  442. _cantSee
  443. };
  444.  
  445. dayz_losCheck_attack = {
  446. private["_target","_agent","_cantSee"];
  447. _target = _this select 0;
  448. _agent = _this select 1;
  449. _cantSee = true;
  450. if (!isNull _target) then {
  451. _tPos = eyePos _target;
  452. _zPos = eyePos _agent;
  453. if ((count _tPos > 0) and (count _zPos > 0)) then {
  454. _cantSee = terrainIntersectASL [_tPos, _zPos];
  455. if (!_cantSee) then {
  456. _ob_arr = lineIntersectsWith [_zPos, _tPos, _agent, _target];
  457. _cantSee = ((count _ob_arr) != 0 and {((_ob_arr select 0) isKindOf "All")});
  458. };
  459. };
  460. };
  461. _cantSee
  462. };
  463.  
  464. // eh_zombieInit = {
  465. // private["_unit","_pos"];
  466. // //_unit = _this select 0;
  467. // //_pos = getPosATL _unit;
  468. // //_id = [_pos,_unit] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
  469. // };
  470.  
  471. // dayz_equipCheck = {
  472. // private ["_empty", "_needed","_diff","_success"];
  473. // _config = _this;
  474. // _empty = [player] call BIS_fnc_invSlotsEmpty;
  475. // _needed = [_config] call BIS_fnc_invSlotType;
  476. // _diff = [_empty,_needed] call BIS_fnc_vectorDiff;
  477. //
  478. // _success = true;
  479. // {
  480. // if (_x > 0) then {_success = false};
  481. // } forEach _diff;
  482. // hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
  483. // _success
  484. // };
  485.  
  486. dayz_spaceInterrupt = {
  487. private ["_dikCode", "_handled","_displayg"];
  488. _dikCode = _this select 1;
  489. _handled = false;
  490. if (_dikCode in (actionKeys "GetOver")) then {
  491. if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then {
  492. _inBuilding = [player] call fnc_isInsideBuilding;
  493. _nearbyObjects = nearestObjects[getPosATL player, ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"], 8];
  494. if (!_inBuilding and (count _nearbyObjects == 0)) then {
  495. dayz_lastCheckBit = time;
  496. call player_CombatRoll;
  497. };
  498. };
  499. };
  500. //if (_dikCode == 57) then {_handled = true}; // space
  501. //if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
  502. /*
  503. if (_dikCode == 210) then //insert Key
  504. {
  505. _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
  506. };
  507. */
  508. //Prevent exploit of drag body
  509. if ((_dikCode in actionKeys "Prone") and r_drag_sqf) then { force_dropBody = true; };
  510. if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) then { force_dropBody = true; };
  511.  
  512. if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
  513. if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
  514. if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
  515. if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
  516. if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
  517. if (_dikCode in actionKeys "PushToTalk" and (time - dayz_lastCheckBit > 10)) then {
  518. dayz_lastCheckBit = time;
  519. [player,15,true,(getPosATL player)] spawn player_alertZombies;
  520. };
  521. if (_dikCode in actionKeys "VoiceOverNet" and (time - dayz_lastCheckBit > 10)) then {
  522. dayz_lastCheckBit = time;
  523. [player,15,true,(getPosATL player)] spawn player_alertZombies;
  524. };
  525. if (_dikCode in actionKeys "PushToTalkDirect" and (time - dayz_lastCheckBit > 10)) then {
  526. dayz_lastCheckBit = time;
  527. [player,5,false,(getPosATL player)] spawn player_alertZombies;
  528. };
  529. if (_dikCode in actionKeys "Chat" and (time - dayz_lastCheckBit > 10)) then {
  530. dayz_lastCheckBit = time;
  531. [player,15,false,(getPosATL player)] spawn player_alertZombies;
  532. };
  533. if (_dikCode in actionKeys "User20" and (time - dayz_lastCheckBit > 5)) then {
  534. dayz_lastCheckBit = time;
  535. _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
  536. };
  537. if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (time - dayz_lastCheckBit > 10)) then {
  538. dayz_lastCheckBit = time;
  539. call dayz_forceSave;
  540. };
  541. if (_dikCode == 0xB8 or _dikCode == 0x38 or _dikCode == 0x3E or _dikCode == 0x2A or _dikCode == 0x36 or _dikCode == 0x01) then {
  542. _displayg = findDisplay 106;
  543. if (!isNull _displayg) then {
  544. call player_gearSync;
  545. call dayz_forceSave;
  546. } else {
  547. if (dialog) then {
  548. call player_gearSync;
  549. call dayz_forceSave;
  550. };
  551. };
  552. };
  553. /*
  554. if (_dikCode in actionKeys "IngamePause") then {
  555. waitUntil {
  556. _display = findDisplay 49;
  557. !isNull _display;
  558. };
  559. _btnRespawn = _display displayCtrl 1010;
  560. _btnAbort = _display displayCtrl 104;
  561. _btnRespawn ctrlEnable false;
  562. _btnAbort ctrlEnable false;
  563. };
  564. */
  565. _handled
  566. };
  567.  
  568. player_CombatRoll = {
  569. DoRE = ({isPlayer _x} count (player nearEntities ["AllVehicles",100]) > 1);
  570. if (canRoll && animationState player in ["amovpercmrunslowwrfldf","amovpercmrunsraswrfldf","amovpercmevaslowwrfldf","amovpercmevasraswrfldf"]) then {
  571. canRoll = false;
  572. null = [] spawn {
  573. if (DoRE) then {
  574. [nil, player, rSWITCHMOVE, "ActsPercMrunSlowWrflDf_FlipFlopPara"] call RE;
  575. } else {
  576. player switchMove "ActsPercMrunSlowWrflDf_FlipFlopPara";
  577. };
  578. sleep 0.3;
  579. player setVelocity [(velocity player select 0) + 1.5 * sin direction player, (velocity player select 1) + 1.5 * cos direction player, (velocity player select 2) + 4];
  580. sleep 1;
  581. canRoll = true;
  582. };
  583. _handled = true;
  584. };
  585. };
  586.  
  587. // player_serverModelChange = {
  588. // private["_object","_model"];
  589. // _object = _this select 0;
  590. // _model = _this select 1;
  591. // if (_object == player) then {
  592. // _model call player_switchModel;
  593. // };
  594. // };
  595.  
  596. player_guiControlFlash = {
  597. private["_control"];
  598. _control = _this;
  599. if (ctrlShown _control) then {
  600. _control ctrlShow false;
  601. } else {
  602. _control ctrlShow true;
  603. };
  604. };
  605.  
  606. gear_ui_offMenu = {
  607. private["_control","_parent","_menu"];
  608. disableSerialization;
  609. _control = _this select 0;
  610. _parent = findDisplay 106;
  611. if (!(_this select 3)) then {
  612. for "_i" from 0 to 9 do {
  613. _menu = _parent displayCtrl (1600 + _i);
  614. _menu ctrlShow false;
  615. };
  616. _grpPos = ctrlPosition _control;
  617. _grpPos set [3,0];
  618. _control ctrlSetPosition _grpPos;
  619. _control ctrlShow false;
  620. _control ctrlCommit 0;
  621. };
  622. };
  623.  
  624.  
  625. gear_ui_init = {
  626. private["_control","_parent","_menu","_dspl","_grpPos"];
  627. disableSerialization;
  628. _parent = findDisplay 106;
  629. _control = _parent displayCtrl 6902;
  630. for "_i" from 0 to 9 do {
  631. _menu = _parent displayCtrl (1600 + _i);
  632. _menu ctrlShow false;
  633. };
  634. _grpPos = ctrlPosition _control;
  635. _grpPos set [3,0];
  636. _control ctrlSetPosition _grpPos;
  637. _control ctrlShow false;
  638. _control ctrlCommit 0;
  639. };
  640.  
  641. // dayz_eyeDir = {
  642. // private["_vval","_vdir"];
  643. // _vval = (eyeDirection _this);
  644. // _vdir = (_vval select 0) atan2 (_vval select 1);
  645. // if (_vdir < 0) then {_vdir = 360 + _vdir};
  646. // _vdir
  647. // };
  648.  
  649. dayz_lowHumanity = {
  650. private["_unit","_humanity","_delay"];
  651. _unit = _this;
  652. if ((_unit distance player) < 15) then {
  653. _humanity = _unit getVariable["humanity",0];
  654. dayz_heartBeat = true;
  655. if (_humanity < -3000) then {
  656. _delay = ((10000 + _humanity) / 5500) + 0.3;
  657. playSound "heartbeat_1";
  658. sleep _delay;
  659. };
  660. dayz_heartBeat = false;
  661. };
  662. };
  663.  
  664. dayz_meleeMagazineCheck = {
  665. private["_meleeNum","_magType","_wpnType","_ismelee"];
  666. _wpnType = primaryWeapon player;
  667. _ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
  668. if (_ismelee == "true") then {
  669. _magType = ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
  670. _meleeNum = ({_x == _magType} count magazines player);
  671. if (_meleeNum < 1) then {
  672. player addMagazine _magType;
  673. };
  674. };
  675. };
  676.  
  677. dayz_futurePos = {
  678. private ["_vehicle","_velo","_speed","_nextPlayerPos"];
  679.  
  680. _vehicle = (vehicle _this);
  681. _velo = velocity _vehicle;
  682. _speed = ([0, 0, 0] distance (_velo)); // buggy: if player/veh is blocked by an object, speed is not zero
  683. _nextPlayerPos = getPosATL _this;
  684. if (_speed > 0) then {
  685. // try compute next player pos. This works both whether player is bare foot, or in a vehicle, whatever his place.
  686. _velo = [ (_velo select 0) / _speed, (_velo select 1) / _speed, (_velo select 2) / _speed]; // normalize speed vector
  687. _nextPlayerPos set [0, (_nextPlayerPos select 0) + (_velo select 0) * 1]; // 1 = a meter alongside the movement
  688. _nextPlayerPos set [1, (_nextPlayerPos select 1) + (_velo select 1) * 1];
  689. _nextPlayerPos set [2, (_nextPlayerPos select 2) + (_velo select 2) * 1];
  690. };
  691.  
  692. _nextPlayerPos
  693. };
  694.  
  695. dayz_originalPlayer = player;
  696. };
  697.  
  698. progressLoadingScreen 0.8;
  699.  
  700. //Both
  701. BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandom.sqf"; //Checks which actions for nearby casualty
  702. fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
  703. zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\zombie_init.sqf";
  704. object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
  705. object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_getHit.sqf"; //gets the hit value for a HitPoint (i.e. HitLegs) against the selection (i.e. "legs"), returns the value
  706. object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  707. object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records and sets hit)
  708. object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
  709. object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player or server to monitor changes in cargo contents
  710. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
  711. // Vehicle damage fix
  712. fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleDam.sqf";
  713. fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";
  714. fnc_veh_handleRepair = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleRepair.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
  715. fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
  716. fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
  717. fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
  718. dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
  719. vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
  720. local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object
  721. local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
  722. local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
  723. local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
  724. //player_weaponCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponCheck.sqf"; //Run by the player or server to monitor whether they have picked up a new weapon
  725. curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
  726. player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
  727. player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
  728. player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
  729. player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
  730. player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
  731. player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
  732. world_isDay = {if ((daytime < (24 - dayz_sunRise)) and (daytime > dayz_sunRise)) then {true} else {false}};
  733. player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
  734. spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
  735. player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
  736.  
  737.  
  738. player_sumMedical = {
  739. private["_character","_wounds","_legs","_arms","_medical", "_status"];
  740. _character = _this;
  741. _wounds = [];
  742. if (_character getVariable["USEC_injured",false]) then {
  743. {
  744. _status = _character getVariable["hit_"+_x,false];
  745. if ((typeName _status == "BOOLEAN") AND {(_status)}) then {
  746. _wounds set [count _wounds,_x];
  747. };
  748. } forEach USEC_typeOfWounds;
  749. };
  750. _legs = _character getVariable ["hit_legs",0];
  751. _arms = _character getVariable ["hit_arms",0];
  752. _medical = [
  753. _character getVariable["USEC_isDead",false],
  754. _character getVariable["NORRN_unconscious", false],
  755. _character getVariable["USEC_infected",false],
  756. _character getVariable["USEC_injured",false],
  757. _character getVariable["USEC_inPain",false],
  758. _character getVariable["USEC_isCardiac",false],
  759. _character getVariable["USEC_lowBlood",false],
  760. _character getVariable["USEC_BloodQty",12000],
  761. _wounds,
  762. [_legs,_arms],
  763. _character getVariable["unconsciousTime",0],
  764. _character getVariable["messing",[0,0]]
  765. ];
  766. _medical
  767. };
  768.  
  769. fn_niceSpot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_niceSpot.sqf";
  770.  
  771. //Server Only
  772. if (isServer) then {
  773. call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
  774. } else {
  775. eh_localCleanup = {};
  776. };
  777.  
  778. //Start Dynamic Weather
  779. execVM "\z\addons\dayz_code\system\DynamicWeatherEffects.sqf";
  780. initialized = true;
  781.  
  782. FN_SELFACTIONS.SQF:
  783. scriptName "Functions\misc\fn_selfActions.sqf";
  784. /***********************************************************
  785. ADD ACTIONS FOR SELF
  786. - Function
  787. - [] call fnc_usec_selfActions;
  788. ************************************************************/
  789. private["_isStash","_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasFuel5","_hasbottleitem","_hastinitem","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_rawmeat","_hasRawMeat","_allFixed","_hitpoints","_damage","_part","_cmpt","_damagePercent","_color","_string","_handle","_dogHandle","_lieDown","_warn","_dog","_speed"];
  790.  
  791. _vehicle = vehicle player;
  792. _inVehicle = (_vehicle != player);
  793. _bag = unitBackpack player;
  794. _classbag = typeOf _bag;
  795. _isWater = (surfaceIsWater (position player)) or dayz_isSwimming;
  796. _hasAntiB = "ItemAntibiotic" in magazines player;
  797. _hasFuelE20 = "ItemJerrycanEmpty" in magazines player;
  798. _hasFuelE5 = "ItemFuelcanEmpty" in magazines player;
  799. //boiled Water
  800. _hasbottleitem = "ItemWaterbottle" in magazines player;
  801. _hastinitem = false;
  802. {
  803. if (_x in magazines player) then {
  804. _hastinitem = true;
  805. };
  806.  
  807. } forEach boil_tin_cans;
  808.  
  809.  
  810. _hasKnife = "ItemKnife" in items player;
  811. _hasToolbox = "ItemToolbox" in items player;
  812. //_hasTent = "ItemTent" in items player;
  813. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  814. _nearLight = nearestObject [player,"LitObject"];
  815. _canPickLight = false;
  816.  
  817. if (!isNull _nearLight) then {
  818. if (_nearLight distance player < 4) then {
  819. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  820. };
  821. };
  822. _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
  823.  
  824. //Grab Flare
  825. if (_canPickLight and !dayz_hasLight) then {
  826. if (s_player_grabflare < 0) then {
  827. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  828. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  829. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  830. };
  831. } else {
  832. player removeAction s_player_grabflare;
  833. player removeAction s_player_removeflare;
  834. s_player_grabflare = -1;
  835. s_player_removeflare = -1;
  836. };
  837.  
  838. if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) then { //Has some kind of target
  839. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  840. _isVehicle = cursorTarget isKindOf "AllVehicles";
  841. _isVehicletype = typeOf cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  842. _isMan = cursorTarget isKindOf "Man";
  843. _ownerID = cursorTarget getVariable ["characterID","0"];
  844. _isAnimal = cursorTarget isKindOf "Animal";
  845. _isDog = (cursorTarget isKindOf "DZ_Pastor" || cursorTarget isKindOf "DZ_Fin");
  846. _isZombie = cursorTarget isKindOf "zZombie_base";
  847. _isDestructable = cursorTarget isKindOf "BuiltItems";
  848. _isTent = cursorTarget isKindOf "TentStorage";
  849. _isStash = cursorTarget isKindOf "StashSmall";
  850. _isMediumStash = cursorTarget isKindOf "StashMedium";
  851. _isFuel = false;
  852. _hasFuel20 = "ItemJerrycan" in magazines player;
  853. _hasFuel5 = "ItemFuelcan" in magazines player;
  854. _isAlive = alive cursorTarget;
  855. _canmove = canmove cursorTarget;
  856. _text = getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName");
  857.  
  858. _rawmeat = meatraw;
  859. _hasRawMeat = false;
  860. {
  861. if (_x in magazines player) then {
  862. _hasRawMeat = true;
  863. };
  864. } forEach _rawmeat;
  865.  
  866.  
  867. if (_hasFuelE20 or _hasFuelE5) then {
  868. _isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_wagon_tanker");
  869. };
  870. //diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  871.  
  872. //Allow player to delete objects
  873. if(_isDestructable and _hasToolbox and _canDo) then {
  874. if (s_player_deleteBuild < 0) then {
  875. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",cursorTarget, 1, true, true, "", ""];
  876. };
  877. } else {
  878. player removeAction s_player_deleteBuild;
  879. s_player_deleteBuild = -1;
  880. };
  881.  
  882. //Allow player to force save
  883. if((_isVehicle or _isTent or _isStash or _isMediumStash) and _canDo and !_isMan and (damage cursorTarget < 1)) then {
  884. if (s_player_forceSave < 0) then {
  885. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",cursorTarget, 1, true, true, "", ""];
  886. };
  887. } else {
  888. player removeAction s_player_forceSave;
  889. s_player_forceSave = -1;
  890. };
  891.  
  892. //flip vehicle
  893. if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
  894. if (s_player_flipveh < 0) then {
  895. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
  896. };
  897. } else {
  898. player removeAction s_player_flipveh;
  899. s_player_flipveh = -1;
  900. };
  901.  
  902. //Allow player to fill Fuel can
  903. if((_hasFuelE20 or _hasFuelE5) and _isFuel and _canDo and !a_player_jerryfilling) then {
  904. if (s_player_fillfuel < 0) then {
  905. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  906. };
  907. } else {
  908. player removeAction s_player_fillfuel;
  909. s_player_fillfuel = -1;
  910. };
  911.  
  912. //Allow player to fill vehilce 20L
  913. if(_hasFuel20 and _canDo and _isVehicle and (fuel cursorTarget < 1)) then {
  914. if (s_player_fillfuel20 < 0) then {
  915. s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10"+" with 20L",_text], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan"], 0, true, true, "", "'ItemJerrycan' in magazines player"];
  916. };
  917. } else {
  918. player removeAction s_player_fillfuel20;
  919. s_player_fillfuel20 = -1;
  920. };
  921.  
  922. //Allow player to fill vehilce 5L
  923. if(_hasFuel5 and _canDo and _isVehicle and (fuel cursorTarget < 1)) then {
  924. if (s_player_fillfuel5 < 0) then {
  925. s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10"+" with 5L",_text], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan"], 0, true, true, "", "'ItemFuelcan' in magazines player"];
  926. };
  927. } else {
  928. player removeAction s_player_fillfuel5;
  929. s_player_fillfuel5 = -1;
  930. };
  931.  
  932. //Harvested
  933. if (!alive cursorTarget and _isAnimal and _hasKnife and !_isHarvested and _canDo) then {
  934. if (s_player_butcher < 0) then {
  935. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
  936. };
  937. } else {
  938. player removeAction s_player_butcher;
  939. s_player_butcher = -1;
  940. };
  941.  
  942. //Fireplace Actions check
  943. if (inflamed cursorTarget and _hasRawMeat and _canDo and !a_player_cooking) then {
  944. if (s_player_cook < 0) then {
  945. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",cursorTarget, 3, true, true, "", ""];
  946. };
  947. } else {
  948. player removeAction s_player_cook;
  949. s_player_cook = -1;
  950. };
  951. if (inflamed cursorTarget and (_hasbottleitem and _hastinitem) and _canDo and !a_player_boil) then {
  952. if (s_player_boil < 0) then {
  953. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",cursorTarget, 3, true, true, "", ""];
  954. };
  955. } else {
  956. player removeAction s_player_boil;
  957. s_player_boil = -1;
  958. };
  959.  
  960. if(cursorTarget == dayz_hasFire and _canDo) then {
  961. if ((s_player_fireout < 0) and !(inflamed cursorTarget) and (player distance cursorTarget < 3)) then {
  962. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",cursorTarget, 0, false, true, "",""];
  963. };
  964. } else {
  965. player removeAction s_player_fireout;
  966. s_player_fireout = -1;
  967. };
  968.  
  969. //Packing my tent
  970. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  971. if ((s_player_packtent < 0) and (player distance cursorTarget < 3)) then {
  972. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",cursorTarget, 0, false, true, "",""];
  973. };
  974. } else {
  975. player removeAction s_player_packtent;
  976. s_player_packtent = -1;
  977. };
  978.  
  979. //Sleep
  980. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  981. if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
  982. s_player_sleep = player addAction ["Sleep", "\fixes\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
  983. };
  984. } else {
  985. player removeAction s_player_sleep;
  986. s_player_sleep = -1;
  987. };
  988.  
  989. //Repairing Vehicles
  990. if ((dayz_myCursorTarget != cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then {
  991. _vehicle = cursorTarget;
  992. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  993. dayz_myCursorTarget = _vehicle;
  994.  
  995. _allFixed = true;
  996. _hitpoints = _vehicle call vehicle_getHitpoints;
  997.  
  998. {
  999. _damage = [_vehicle,_x] call object_getHit;
  1000.  
  1001. _cmpt = toArray (_x);
  1002. _cmpt set [0,20];
  1003. _cmpt set [1,toArray ("-") select 0];
  1004. _cmpt set [2,20];
  1005. _cmpt = toString _cmpt;
  1006.  
  1007. _configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
  1008. _part = getText(_configVeh >> "part");
  1009. if (isnil ("_part")) then { _part = "PartGeneric"; };
  1010.  
  1011. // get every damaged part no matter how tiny damage is!
  1012. _damagePercent = round((1 - _damage) * 100);
  1013. if (_damage > 0) then {
  1014. _allFixed = false;
  1015. _color = "color='#ffff00'"; //yellow
  1016. if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
  1017. if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
  1018. _cmpt = format[localize "str_actions_medical_09_status",_cmpt,_damagePercent];
  1019.  
  1020. _string = format[localize "str_actions_medical_09",_cmpt,_color]; //Repair - Part
  1021. _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
  1022. s_player_repairActions set [count s_player_repairActions,_handle];
  1023. };
  1024.  
  1025. } forEach _hitpoints;
  1026. if (_allFixed) then {
  1027. _vehicle setDamage 0;
  1028. };
  1029. };
  1030. /*
  1031. if (_isMan and !_isAlive) then {
  1032. if (s_player_dragbody < 0) then {
  1033. s_player_dragbody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\drag_body.sqf",cursorTarget, 0, false, true, "",""];
  1034. };
  1035. } else {
  1036. player removeAction s_player_dragbody;
  1037. s_player_dragbody = -1;
  1038. };
  1039. */
  1040. if (_isMan and !_isAlive and !_isZombie) then {
  1041. if (s_player_studybody < 0) then {
  1042. s_player_studybody = player addAction [localize "str_action_studybody", "\fixes\study_body.sqf",cursorTarget, 0, false, true, "",""];
  1043. };
  1044. } else {
  1045. player removeAction s_player_studybody;
  1046. s_player_studybody = -1;
  1047. };
  1048. /*
  1049. //Dog
  1050. if (_isDog and _isAlive and (_hasRawMeat) and _canDo and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
  1051. if (s_player_tamedog < 0) then {
  1052. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", cursorTarget, 1, false, true, "", ""];
  1053. };
  1054. } else {
  1055. player removeAction s_player_tamedog;
  1056. s_player_tamedog = -1;
  1057. };
  1058.  
  1059. if (_isDog and _ownerID == dayz_characterID and _isAlive and _canDo) then {
  1060. _dogHandle = player getVariable ["dogID", 0];
  1061. if (s_player_feeddog < 0 and _hasRawMeat) then {
  1062. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  1063. };
  1064. if (s_player_waterdog < 0 and "ItemWaterbottle" in magazines player) then {
  1065. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  1066. };
  1067. if (s_player_staydog < 0) then {
  1068. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  1069. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  1070. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  1071. };
  1072. if (s_player_trackdog < 0) then {
  1073. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  1074. };
  1075. if (s_player_barkdog < 0) then {
  1076. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", cursorTarget, 3, false, true,"",""];
  1077. };
  1078. if (s_player_warndog < 0) then {
  1079. _warn = _dogHandle getFSMVariable "_watchDog";
  1080. if (_warn) then { _text = "Quiet"; _warn = false; } else { _text = "Alert"; _warn = true; };
  1081. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  1082. };
  1083. if (s_player_followdog < 0) then {
  1084. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  1085. };
  1086. } else {
  1087. player removeAction s_player_feeddog;
  1088. s_player_feeddog = -1;
  1089. player removeAction s_player_waterdog;
  1090. s_player_waterdog = -1;
  1091. player removeAction s_player_staydog;
  1092. s_player_staydog = -1;
  1093. player removeAction s_player_trackdog;
  1094. s_player_trackdog = -1;
  1095. player removeAction s_player_barkdog;
  1096. s_player_barkdog = -1;
  1097. player removeAction s_player_warndog;
  1098. s_player_warndog = -1;
  1099. player removeAction s_player_followdog;
  1100. s_player_followdog = -1;
  1101. };
  1102. */
  1103. } else {
  1104. //Engineering
  1105. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  1106. dayz_myCursorTarget = objNull;
  1107. //Others
  1108. player removeAction s_player_forceSave;
  1109. s_player_forceSave = -1;
  1110. player removeAction s_player_flipveh;
  1111. s_player_flipveh = -1;
  1112. player removeAction s_player_sleep;
  1113. s_player_sleep = -1;
  1114. player removeAction s_player_deleteBuild;
  1115. s_player_deleteBuild = -1;
  1116. player removeAction s_player_butcher;
  1117. s_player_butcher = -1;
  1118. player removeAction s_player_cook;
  1119. s_player_cook = -1;
  1120. player removeAction s_player_boil;
  1121. s_player_boil = -1;
  1122. player removeAction s_player_fireout;
  1123. s_player_fireout = -1;
  1124. player removeAction s_player_packtent;
  1125. s_player_packtent = -1;
  1126. player removeAction s_player_fillfuel;
  1127. s_player_fillfuel = -1;
  1128. player removeAction s_player_studybody;
  1129. s_player_studybody = -1;
  1130. /*
  1131. //Drag Body
  1132. player removeAction s_player_dragbody;
  1133. s_player_dragbody = -1;
  1134. */
  1135. //fuel
  1136. player removeAction s_player_fillfuel20;
  1137. s_player_fillfuel20 = -1;
  1138. player removeAction s_player_fillfuel5;
  1139. s_player_fillfuel5 = -1;
  1140.  
  1141. //Dog
  1142. //player removeAction s_player_tamedog;
  1143. //s_player_tamedog = -1;
  1144. player removeAction s_player_feeddog;
  1145. s_player_feeddog = -1;
  1146. player removeAction s_player_waterdog;
  1147. s_player_waterdog = -1;
  1148. player removeAction s_player_staydog;
  1149. s_player_staydog = -1;
  1150. player removeAction s_player_trackdog;
  1151. s_player_trackdog = -1;
  1152. player removeAction s_player_barkdog;
  1153. s_player_barkdog = -1;
  1154. player removeAction s_player_warndog;
  1155. s_player_warndog = -1;
  1156. player removeAction s_player_followdog;
  1157. s_player_followdog = -1;
  1158. };
  1159.  
  1160. PLAYER_SLEEP.SQF:
  1161. // Script writen by Krixes
  1162. // Version 1.1
  1163. //
  1164. //
  1165. // Change Log 1.1:
  1166. // 1: Made some minor tweaks in the code
  1167. // 2: Lowered quality of the snoring for smaller file size
  1168. //
  1169. // Animation references - http://community.bistudio.com/wiki/ArmA2:_Moves
  1170.  
  1171. private ["_timeLeft", "_totalSleepTime","_i","_bloodAmount","_sleepCooldown","_sleepTime"];
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180. //////////////////////////////////////////////////////////////////////////////////////////////////////
  1181. // Config Area Start //
  1182. //////////////////////////////////////////////////////////////////////////////////////////////////////
  1183.  
  1184. // This script in its current state is set up perfectly for 45 seconds changing it can yield some wierd results!
  1185. _totalSleepTime = 45; // Total ammount of time it takes before you wake up
  1186.  
  1187. _bloodAmount = 8000; // Total amount of blood to give back to player on sleep (12000 is the max life for a player)
  1188.  
  1189. _sleepCooldown = 60; // This is how long in seconds before you can sleep again
  1190.  
  1191. //////////////////////////////////////////////////////////////////////////////////////////////////////
  1192. // Config Area End //
  1193. //////////////////////////////////////////////////////////////////////////////////////////////////////
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205. ////////////////////////////////////////////////////////////////////////////////////
  1206. // Everything below here need not be modified unless you know what you are doing! //
  1207. ////////////////////////////////////////////////////////////////////////////////////
  1208.  
  1209.  
  1210. _sleepTime = time - sleepTimer; // Variable used for easy reference in determining the sleep cooldown
  1211.  
  1212. if(_sleepTime < _sleepCooldown) exitWith { // If cooldown is not done then exit script
  1213. cutText [format["You are not tired yet please wait %1!",(_sleepTime - _sleepCooldown)], "PLAIN DOWN"]; //display text at bottom center of screen when players cooldown is not done
  1214. };
  1215.  
  1216. if (dayz_combat == 1) then { // Check if in combat (dunno why you would want to sleep in combat but the check is here anyway)
  1217. cutText [format["You cannot sleep while in combat!"], "PLAIN DOWN"]; //display text at bottom center of screen when in combat
  1218. } else {
  1219.  
  1220. _timeLeft = _totalSleepTime; // Variable used as a countdown timer
  1221.  
  1222. disableUserInput true; // Disable the players keyboard/mouse input when sleeping
  1223.  
  1224. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_layDown"] call RE; // Public RPC call to change animation so all players see the animation when laying down
  1225.  
  1226. sleep 3;
  1227.  
  1228. cutText [format["You begin sleeping. %1 seconds left.",_timeLeft], "BLACK OUT"]; // Text displayed when starting to sleep
  1229. _nul = [objNull, player, rSAY, "playerSnoring"] call RE; // This is a RPC sound call for the snoring
  1230.  
  1231. for "_i" from 0 to _totalSleepTime do { // For loop for counting down sleep timers and changing animations
  1232. sleep 1;
  1233. _timeLeft = _timeLeft - 1; // Minus _timeLeft by one every second
  1234.  
  1235. if (_timeLeft > 0) then {
  1236. cutText [format["You are sleeping. %1 seconds left.",_timeLeft], "BLACK FADED"]; // Display sleep countdown while sleeping
  1237. } else {cutText [format["You are beginning to wake up!"], "BLACK FADED"];}; // This is a fix for when timer reaches zero... displays text
  1238.  
  1239. if (_timeLeft == 40) then {
  1240. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_sleep2"] call RE; // Public RPC call to change animation so all players see the animation while sleeping
  1241. };
  1242.  
  1243. if (_timeLeft == 30) then {
  1244. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_sleep1"] call RE; // Public RPC call to change animation so all players see the animation while sleeping
  1245.  
  1246. };
  1247.  
  1248. if (_timeLeft == 20) then {
  1249. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_sleep2"] call RE; // Public RPC call to change animation so all players see the animation while sleeping
  1250. };
  1251.  
  1252. if (_timeLeft == 10) then {
  1253. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_sleep3"] call RE; // Public RPC call to change animation so all players see the animation while sleeping
  1254. };
  1255.  
  1256. if (_timeLeft == 5) then {
  1257. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_sleep1"] call RE; // Public RPC call to change animation so all players see the animation while sleeping
  1258. };
  1259. };
  1260.  
  1261. if (_timeLeft == 0 || _timeLeft < 0) then { // If sleep countdown is done then.....
  1262. sleep 3;
  1263. cutText [format["You wake up!"], "BLACK IN"]; // Display wake up text (don't think this actually gets shown)
  1264.  
  1265. [objNull, player, rSwitchMove,"AidlPpneMstpSnonWnonDnon_SleepA_standUp"] call RE; // Public RPC call to change animation so all players see the animation on wake up
  1266.  
  1267. r_player_blood = r_player_blood + _bloodAmount; // LOCAL variable to give player certain blood amount
  1268.  
  1269. if(r_player_blood > 12000) then {
  1270. r_player_blood = 12000; // If players blood is greater then max amount allowed set it to max allowed (this check keeps an error at bay)
  1271. };
  1272.  
  1273. r_player_lowblood = false; // Set lowblood to false
  1274. 10 fadeSound 1; // Fades sound in over time
  1275. "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; // Disable post processing blur effect
  1276. "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1], [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5; // Give player their color back
  1277. r_player_lowblood = false; // Just double checking players blood isnt low
  1278. player setVariable["USEC_BloodQty",r_player_blood,true]; // Save this blood ammount to the database
  1279.  
  1280. cutText [format["You are awake and fully rested!"], "PLAIN DOWN"]; // Text displayed on wakeup!
  1281. disableUserInput false; // Give players input controls back
  1282.  
  1283. sleepTimer = time; // Set public cooldown variable
  1284. };
  1285. };
  1286.  
  1287. STUD_BODY.SQF:
  1288. private ["_body", "_name", "_kills", "_killsH", "_killsB", "_headShots", "_humanity"];
  1289.  
  1290. titleText ["You have found a journal on the survivor's corpse.","PLAIN DOWN"]; titleFadeOut 5;
  1291. sleep 2;
  1292.  
  1293. _body = _this select 3;
  1294. _name = _body getVariable ["bodyName","unknown"];
  1295. _kills = _body getVariable ["zombieKills",0];
  1296. _killsH = _body getVariable ["humanKills",0];
  1297. _killsB = _body getVariable ["banditKills",0];
  1298. _headShots = _body getVariable ["headShots",0];
  1299. _humanity = _body getVariable ["humanity",0];
  1300.  
  1301. cutText [format["Zombie Kills: %1, Murders: %2, Bandit Kills: %3, Humanity: %4.",_kills,_killsH,_killsB,_humanity], "PLAIN DOWN"];
  1302. sleep 5;
  1303.  
  1304. //hint parseText format["
  1305. //<t size='1.5' font='Bitstream' color='#5882FA'>%1's Journal</t><br/><br/>
  1306. //<t size='1.25' font='Bitstream' align='left'>Zombies Killed: </t><t size='1.25' font='Bitstream' align='right'>%2</t><br/>
  1307. //<t size='1.25' font='Bitstream' align='left'>Bandits Killed: </t><t size='1.25' font='Bitstream' align='right'>%4</t><br/>
  1308. //<t size='1.25' font='Bitstream' align='left'>Humanity: </t><t size='1.25' font='Bitstream' align='right'>%6</t><br/>",
  1309. //_name,_kills,_killsH,_killsB,_headShots,_humanity];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement