Advertisement
Guest User

Black-barret_new

a guest
Sep 12th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.69 KB | None | 0 0
  1. void SpawnObject(string objectName, vector position, vector orientation)
  2. {
  3. Object obj;
  4. obj = Object.Cast(GetGame().CreateObject(objectName, "0 0 0"));
  5. obj.SetPosition(position);
  6. obj.SetOrientation(orientation);
  7.  
  8. // Force update collisions
  9. if (obj.CanAffectPathgraph())
  10. {
  11. obj.SetAffectPathgraph(true, false);
  12. GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj);
  13. }
  14. }
  15.  
  16. //caves mod : Put // in front of # to disable
  17. //#include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\caves.c"
  18. //chernarus-islands : Put // in front of # to disable
  19. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\prisonship.c"
  20. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\island01.c"
  21. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\island02.c"
  22. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\container.c"
  23. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\islandmili.c"
  24.  
  25. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\PlayersMessagesCount.c"
  26. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\ConnectMessagesInChat.c"
  27. #include "$CurrentDir:\\mpmissions\\Arenda_61_dayzOffline.chernarusplus\\Buildings.c"
  28.  
  29. void main()
  30. {
  31. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  32. Weather weather = g_Game.GetWeather();
  33.  
  34. weather.MissionWeather(false); // false = use weather controller from Weather.c
  35.  
  36. weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  37. weather.GetRain().Set( 0, 0, 1);
  38. weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  39.  
  40. //INIT ECONOMY--------------------------------------
  41. Hive ce = CreateHive();
  42. if ( ce )
  43. ce.InitOffline();
  44.  
  45. //DATE RESET AFTER ECONOMY INIT-------------------------
  46. int year, month, day, hour, minute;
  47. int reset_month = 9, reset_day = 20;
  48. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  49.  
  50. if ((month == reset_month) && (day < reset_day))
  51. {
  52. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  53. }
  54. else
  55. {
  56. if ((month == reset_month + 1) && (day > reset_day))
  57. {
  58. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  59. }
  60. else
  61. {
  62. if ((month < reset_month) || (month > reset_month + 1))
  63. {
  64. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  65. }
  66. }
  67. }
  68.  
  69. //caves mod : Put // in front of # to disable
  70. //caves();
  71. //chernarus-islands : Put // in front of # to disable
  72. prisonship();
  73. island01();
  74. island02();
  75. container();
  76. islandmili();
  77.  
  78. PlayersMessagesCount();
  79. ConnectMessagesInChat();
  80. Buildings();
  81.  
  82. //This line ads custom loot to buildings Remove // and let server run for 1 restart, then add // back
  83. //GetCEApi().ExportProxyData("7500 0 7500", 10000); //Centre of map, radius of how far to go out and find buildings.
  84.  
  85. }
  86.  
  87. class CustomMission: MissionServer
  88. {
  89. void SetRandomHealth(EntityAI itemEnt)
  90. {
  91. if ( itemEnt )
  92. {
  93. int rndHlt = Math.RandomInt(55,100);
  94. itemEnt.SetHealth("","",rndHlt);
  95. }
  96. }
  97.  
  98. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  99. {
  100. Entity playerEnt;
  101. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  102. Class.CastTo(m_player, playerEnt);
  103.  
  104. GetGame().SelectPlayer(identity, m_player);
  105.  
  106. return m_player;
  107. }
  108.  
  109. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  110. {
  111. EntityAI itemTop;
  112. EntityAI itemEnt;
  113. ItemBase itemBs;
  114. float rand;
  115.  
  116. itemTop = player.FindAttachmentBySlotName("Body");
  117.  
  118. if ( itemTop )
  119. {
  120. itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  121. if ( Class.CastTo(itemBs, itemEnt ) )
  122. itemBs.SetQuantity(4);
  123.  
  124. SetRandomHealth(itemEnt);
  125.  
  126. itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
  127. SetRandomHealth(itemEnt);
  128.  
  129. itemEnt = itemTop.GetInventory().CreateInInventory("ChernarusMap");
  130. SetRandomHealth(itemEnt);
  131.  
  132. itemEnt = itemTop.GetInventory().CreateInInventory("Canteen");
  133. SetRandomHealth(itemEnt);
  134.  
  135. itemEnt = itemTop.GetInventory().CreateInInventory("StoneKnife");
  136. SetRandomHealth(itemEnt);
  137.  
  138. /*
  139. string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
  140. int rndIndex = Math.RandomInt(0, 4);
  141. itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
  142. SetRandomHealth(itemEnt);
  143. */
  144.  
  145. rand = Math.RandomFloatInclusive(0.0, 1.0);
  146. if ( rand < 0.35 )
  147. itemEnt = player.GetInventory().CreateInInventory("Apple");
  148. else if ( rand > 0.65 )
  149. itemEnt = player.GetInventory().CreateInInventory("Pear");
  150. else
  151. itemEnt = player.GetInventory().CreateInInventory("Plum");
  152.  
  153. SetRandomHealth(itemEnt);
  154. }
  155. }
  156. };
  157.  
  158. Mission CreateCustomMission(string path)
  159. {
  160. return new CustomMission();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement