Advertisement
gigiwwa

init.c

Jan 15th, 2022
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. //Vanilla Banov Init.c
  2. // Thank you for using my map
  3. void main()
  4. {
  5. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  6. //Banov Init
  7. Weather weather = g_Game.GetWeather();
  8.  
  9. weather.MissionWeather(false); // false = use weather controller from Weather.c
  10.  
  11. weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  12. weather.GetRain().Set( 0, 0, 1);
  13. weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  14.  
  15. //INIT ECONOMY--------------------------------------
  16. Hive ce = CreateHive();
  17. if ( ce )
  18. ce.InitOffline();
  19.  
  20. //Loot spawn Creator
  21. //GetCEApi().ExportProxyData(vector.Zero, 100000); //Loot
  22. //GetCEApi().ExportClusterData(); //Fruit
  23.  
  24. //DATE RESET AFTER ECONOMY INIT-------------------------
  25. int year, month, day, hour, minute;
  26. int reset_month = 9, reset_day = 20;
  27. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  28.  
  29. if ((month == reset_month) && (day < reset_day))
  30. {
  31. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  32. }
  33. else
  34. {
  35. if ((month == reset_month + 1) && (day > reset_day))
  36. {
  37. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  38. }
  39. else
  40. {
  41. if ((month < reset_month) || (month > reset_month + 1))
  42. {
  43. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  44. }
  45. }
  46. }
  47. }
  48.  
  49. class CustomMission: MissionServer
  50. {
  51. void SetRandomHealth(EntityAI itemEnt)
  52. {
  53. if ( itemEnt )
  54. {
  55. int rndHlt = Math.RandomInt(55,100);
  56. itemEnt.SetHealth("","",rndHlt);
  57. }
  58. }
  59.  
  60. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  61. {
  62. Entity playerEnt;
  63. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  64. Class.CastTo(m_player, playerEnt);
  65.  
  66. GetGame().SelectPlayer(identity, m_player);
  67.  
  68. return m_player;
  69. }
  70.  
  71. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  72. {
  73. EntityAI itemTop;
  74. EntityAI itemEnt;
  75. ItemBase itemBs;
  76. float rand;
  77.  
  78. itemTop = player.FindAttachmentBySlotName("Body");
  79.  
  80. if ( itemTop )
  81. {
  82. itemEnt = itemTop.GetInventory().CreateInInventory("BandageDressing");
  83. if ( Class.CastTo(itemBs, itemEnt ) )
  84. itemBs.SetQuantity(2);
  85.  
  86. SetRandomHealth(itemEnt);
  87.  
  88. string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
  89. int rndIndex = Math.RandomInt(0, 4);
  90. itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
  91. SetRandomHealth(itemEnt);
  92. itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
  93.  
  94. rand = Math.RandomFloatInclusive(0.0, 1.0);
  95. if ( rand < 0.35 )
  96. itemEnt = player.GetInventory().CreateInInventory("Apple");
  97. else if ( rand > 0.65 )
  98. itemEnt = player.GetInventory().CreateInInventory("Pear");
  99. else
  100. itemEnt = player.GetInventory().CreateInInventory("Plum");
  101.  
  102. SetRandomHealth(itemEnt);
  103. player.GetInventory().CreateInInventory("DryBag_Black"); // added items
  104. player.GetInventory().CreateInInventory("Compass"); // added items
  105. player.GetInventory().CreateInInventory("Canteen"); // added items
  106. player.GetInventory().CreateInInventory("SardinesCan"); // added items
  107. player.GetInventory().CreateInInventory("CombatKnife"); // added items
  108. player.GetInventory().CreateInInventory("CanOpener"); // added items
  109. player.GetInventory().CreateInInventory("ChernarusMap"); // added items
  110. player.GetInventory().CreateInInventory("M4A1"); // added items
  111. player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd"); // added items
  112. player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd"); // added items
  113. player.GetInventory().CreateInInventory("BandageDressing"); // added items
  114. player.GetInventory().CreateInInventory("PurificationTablets"); // added items
  115. player.GetInventory().CreateInInventory("WoodAxe"); // added items
  116. player.GetInventory().CreateInInventory("BakedBeansCan"); // added items
  117. player.GetInventory().CreateInInventory("SodaCan_Pipsi"); // added items
  118. player.GetInventory().CreateInInventory("SodaCan_Spite"); // added items
  119. player.GetInventory().CreateInInventory("TacticalBaconCan"); // added items
  120. player.GetInventory().CreateInInventory("Matchbox"); // added items
  121. player.GetInventory().CreateInInventory("DuctTape"); // added items
  122. player.GetInventory().CreateInInventory("Whetstone"); // added items
  123. player.GetInventory().CreateInInventory("Mag_STANAGCoupled_30Rnd"); // added items
  124. player.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd"); // added items
  125. player.GetInventory().CreateInInventory("Binoculars"); // added items
  126. player.GetInventory().CreateInInventory("SewingKit"); // added items
  127. player.GetInventory().CreateInInventory("WeaponCleaningKit"); // added items
  128. }
  129. }
  130. };
  131.  
  132. Mission CreateCustomMission(string path)
  133. {
  134. return new CustomMission();
  135. }
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement