Guest User

Untitled

a guest
Jun 12th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. // Step 2
  2. //-----------------------------------------------------------------------------
  3. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\BiathlonArena.c"
  4. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Location_2.c"
  5. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Location_3.c"
  6. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Location_4.c"
  7. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\location_5.c"
  8. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Location_6.c"
  9. //---- Step 2 END -------------------------------------------------------------
  10.  
  11.  
  12. // Step 3
  13. //-----------------------------------------------------------------------------
  14. /////////////////////////////////////////////////////////
  15. ////////// This is for objects to be placed on the map //
  16. ////////////////////////////////////////////////////////
  17.  
  18. //Spawn helper function
  19. void SpawnObject(string objectName, vector position, vector orientation)
  20. {
  21. Object obj;
  22. obj = Object.Cast(GetGame().CreateObject(objectName, "0 0 0"));
  23. obj.SetPosition(position);
  24. obj.SetOrientation(orientation);
  25.  
  26. // Force update collisions
  27. if (obj.CanAffectPathgraph())
  28. {
  29. obj.SetAffectPathgraph(true, false);
  30. GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj);
  31. }
  32. }
  33. //--- Step 3 END ----------------------------------------------------------------
  34.  
  35.  
  36. void main()
  37. {
  38. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  39. Weather weather = g_Game.GetWeather();
  40.  
  41. weather.MissionWeather(false); // false = use weather controller from Weather.c
  42.  
  43. weather.GetOvercast().Set( Math.RandomFloatInclusive(0.02, 0.1), 1, 0);
  44. weather.GetRain().Set( 0, 1, 0);
  45. weather.GetFog().Set( 0, 1, 0);
  46.  
  47. //INIT ECONOMY--------------------------------------
  48. Hive ce = CreateHive();
  49. if ( ce )
  50. ce.InitOffline();
  51.  
  52. //DATE RESET AFTER ECONOMY INIT-------------------------
  53. int year, month, day, hour, minute;
  54. int reset_month = 8, reset_day = 10;
  55. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  56.  
  57. if ((month == reset_month) && (day < reset_day))
  58. {
  59. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  60. }
  61. else
  62. {
  63. if ((month == reset_month + 1) && (day > reset_day))
  64. {
  65. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  66. }
  67. else
  68. {
  69. if ((month < reset_month) || (month > reset_month + 1))
  70. {
  71. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  72. }
  73. }
  74. }
  75. // Step 4
  76. //---------------------------------------------------------------------------
  77. // Here is the name of the .c file //
  78. BiathlonArena();
  79. Location_2();
  80. Location_3();
  81. Location_4();
  82. Location_5();
  83. Location_6();
  84. // Step 4 END ---------------------------------------------------------------
  85.  
  86. // Step 5
  87. //---------------------------------------------------------------------------
  88. // This is to create the mapgrouppos.xml file //
  89. GetCEApi().ExportProxyData( "7500 0 7500", 10000 ); //Centre of map
  90. // Step 5 END ---------------------------------------------------------------
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // Read the instructions in the info folder for more information //
  94. ////////////////////////////////////////////////////////////////////////////
  95. }
  96.  
  97. class CustomMission: MissionServer
  98. {
  99. void SetRandomHealth(EntityAI itemEnt)
  100. {
  101. if ( itemEnt )
  102. {
  103. int rndHlt = Math.RandomInt(55,100);
  104. itemEnt.SetHealth("","",rndHlt);
  105. }
  106. }
  107.  
  108. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  109. {
  110. Entity playerEnt;
  111. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  112. Class.CastTo(m_player, playerEnt);
  113.  
  114. GetGame().SelectPlayer(identity, m_player);
  115.  
  116. return m_player;
  117. }
  118.  
  119. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  120. {
  121. EntityAI itemTop;
  122. EntityAI itemEnt;
  123. ItemBase itemBs;
  124. float rand;
  125.  
  126. itemTop = player.FindAttachmentBySlotName("Body");
  127.  
  128. if ( itemTop )
  129. {
  130. itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  131. if ( Class.CastTo(itemBs, itemEnt ) )
  132. itemBs.SetQuantity(4);
  133.  
  134. SetRandomHealth(itemEnt);
  135.  
  136. string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
  137. int rndIndex = Math.RandomInt(0, 4);
  138. itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
  139. SetRandomHealth(itemEnt);
  140. }
  141. }
  142. };
  143.  
  144. Mission CreateCustomMission(string path)
  145. {
  146. return new CustomMission();
  147. }
Advertisement
Add Comment
Please, Sign In to add comment