lazer1982

Init.c File Dayz

Feb 18th, 2020
1,571
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void main()
  2. {
  3. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  4. Weather weather = g_Game.GetWeather();
  5.  
  6. weather.MissionWeather(false); // false = use weather controller from Weather.c
  7.  
  8. weather.GetOvercast().SetLimits( 0.0 , 0.0 );
  9. weather.GetRain().SetLimits( 0.0 , 0.0 );
  10. weather.GetFog().SetLimits( 0.0 , 0.0 );
  11.  
  12. //INIT ECONOMY--------------------------------------
  13. Hive ce = CreateHive();
  14. if ( ce )
  15. ce.InitOffline();
  16.  
  17. //DATE RESET AFTER ECONOMY INIT-------------------------
  18. int year, month, day, hour, minute;
  19. int reset_month = 9, reset_day = 20;
  20. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  21.  
  22. if ((month == reset_month) && (day < reset_day))
  23. {
  24. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  25. }
  26. else
  27. {
  28. if ((month == reset_month + 1) && (day > reset_day))
  29. {
  30. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  31. }
  32. else
  33. {
  34. if ((month < reset_month) || (month > reset_month + 1))
  35. {
  36. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  37. }
  38. }
  39. }
  40. }
  41.  
  42. class CustomMission: MissionServer
  43. {
  44. void SetRandomHealth(EntityAI itemEnt)
  45. {
  46. if ( itemEnt )
  47. {
  48. int rndHlt = Math.RandomInt(55,100);
  49. itemEnt.SetHealth("","",rndHlt);
  50. }
  51. }
  52.  
  53. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  54. {
  55. Entity playerEnt;
  56. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  57. Class.CastTo(m_player, playerEnt);
  58.  
  59. GetGame().SelectPlayer(identity, m_player);
  60.  
  61. return m_player;
  62. }
  63.  
  64. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  65. {
  66.  
  67. EntityAI itemTop;
  68. EntityAI itemEnt;
  69. ItemBase itemBs;
  70. float rand;
  71.  
  72. player.RemoveAllItems();
  73.  
  74. itemEnt = player.GetInventory().CreateInInventory("USMCJacket_Woodland");
  75. itemEnt = player.GetInventory().CreateInInventory("USMCPants_Woodland");
  76. itemEnt = player.GetInventory().CreateInInventory("AliceBag_Black");
  77. itemEnt = player.GetInventory().CreateInInventory("CombatBoots_Black");
  78. itemEnt = player.GetInventory().CreateInInventory("TacticalGloves_Black");
  79. itemEnt = player.GetInventory().CreateInInventory("BoonieHat_DPM");
  80. itemEnt = player.GetInventory().CreateInInventory("MilitaryBelt");
  81. itemEnt = player.GetInventory().CreateInInventory("NylonKnifeSheath");
  82. itemEnt = player.GetInventory().CreateInInventory("Canteen");
  83. itemEnt = player.GetInventory().CreateInInventory("PlateCarrierHolster");
  84. itemEnt = player.GetInventory().CreateInInventory("HighCapacityVest_Olive");
  85.  
  86.  
  87. itemTop = player.FindAttachmentBySlotName("Body");
  88.  
  89. if ( itemTop )
  90. {
  91. itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  92. if ( Class.CastTo(itemBs, itemEnt ) )
  93. itemBs.SetQuantity(6);
  94.  
  95. itemEnt = player.GetInventory().CreateInInventory("Colt1911");
  96. itemBs = ItemBase.Cast(itemEnt);
  97.  
  98. itemEnt = player.GetInventory().CreateInInventory("Mag_1911_7Rnd");
  99. itemBs = ItemBase.Cast(itemEnt);
  100.  
  101. itemEnt = player.GetInventory().CreateInInventory("Mag_1911_7Rnd");
  102. itemBs = ItemBase.Cast(itemEnt);
  103.  
  104. itemEnt = player.GetInventory().CreateInInventory("Binoculars");
  105. itemBs = ItemBase.Cast(itemEnt);
  106.  
  107. itemEnt = player.GetInventory().CreateInInventory("Ammo_45ACP");
  108. itemBs = ItemBase.Cast(itemEnt);
  109.  
  110. itemEnt = player.GetInventory().CreateInInventory("Ammo_45ACP");
  111. itemBs = ItemBase.Cast(itemEnt);
  112.  
  113. itemEnt = player.GetInventory().CreateInInventory("Battery9V");
  114. itemBs = ItemBase.Cast(itemEnt);
  115.  
  116. itemEnt = player.GetInventory().CreateInInventory("PersonalRadio");
  117. itemBs = ItemBase.Cast(itemEnt);
  118.  
  119. itemEnt = player.GetInventory().CreateInInventory("Ammo_45ACP");
  120. itemBs = ItemBase.Cast(itemEnt);
  121.  
  122. itemEnt = player.GetInventory().CreateInInventory("UMP45");
  123. itemBs = ItemBase.Cast(itemEnt);
  124.  
  125. itemEnt = player.GetInventory().CreateInInventory("Mag_UMP_25Rnd");
  126. itemBs = ItemBase.Cast(itemEnt);
  127.  
  128. itemEnt = player.GetInventory().CreateInInventory("Mag_UMP_25Rnd");
  129. itemBs = ItemBase.Cast(itemEnt);
  130.  
  131. itemEnt = player.GetInventory().CreateInInventory("Mag_UMP_25Rnd");
  132. itemBs = ItemBase.Cast(itemEnt);
  133.  
  134. string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
  135. int rndIndex = Math.RandomInt(2, 4);
  136. itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
  137. SetRandomHealth(itemEnt);
  138.  
  139.  
  140. rand = Math.RandomFloatInclusive(0.0, 1.0);
  141. if ( rand < 0.35 )
  142. itemEnt = player.GetInventory().CreateInInventory("Apple");
  143. else if ( rand > 0.65 )
  144. itemEnt = player.GetInventory().CreateInInventory("Pear");
  145. else
  146. itemEnt = player.GetInventory().CreateInInventory("Plum");
  147.  
  148. SetRandomHealth(itemEnt);
  149. }
  150. }
  151. };
  152.  
  153. Mission CreateCustomMission(string path)
  154. {
  155. return new CustomMission();
  156. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×