Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 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. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\prisonship.c"
  17. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island01.c"
  18. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island02.c"
  19. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\container.c"
  20. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\islandmili.c"
  21. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\caves.c"
  22.  
  23. void main()
  24. {
  25. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  26. Weather weather = g_Game.GetWeather();
  27.  
  28. weather.MissionWeather(false); // false = use weather controller from Weather.c
  29.  
  30. weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  31. weather.GetRain().Set( 0, 0, 1);
  32. weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  33.  
  34. //INIT ECONOMY--------------------------------------
  35. Hive ce = CreateHive();
  36. if ( ce )
  37. ce.InitOffline();
  38.  
  39. //DATE RESET AFTER ECONOMY INIT-------------------------
  40. int year, month, day, hour, minute;
  41. int reset_month = 9, reset_day = 20;
  42. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  43.  
  44. if ((month == reset_month) && (day < reset_day))
  45. {
  46. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  47. }
  48. else
  49. {
  50. if ((month == reset_month + 1) && (day > reset_day))
  51. {
  52. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  53. }
  54. else
  55. {
  56. if ((month < reset_month) || (month > reset_month + 1))
  57. {
  58. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  59. }
  60. }
  61. }
  62.  
  63. prisonship();
  64. island01();
  65. island02();
  66. container();
  67. islandmili();
  68. caves();
  69.  
  70. //GetCEApi().ExportProxyData("7500 0 7500", 10000); //Centre of map, radius of how far to go out and find buildings.
  71. }
  72.  
  73. class CustomMission: MissionServer
  74. {
  75. void SetRandomHealth(EntityAI itemEnt)
  76. {
  77. if ( itemEnt )
  78. {
  79. int rndHlt = Math.RandomInt(55,100);
  80. itemEnt.SetHealth("","",rndHlt);
  81. }
  82. }
  83.  
  84. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  85. {
  86. Entity playerEnt;
  87. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  88. Class.CastTo(m_player, playerEnt);
  89.  
  90. GetGame().SelectPlayer(identity, m_player);
  91.  
  92. return m_player;
  93. }
  94.  
  95. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  96. {
  97. EntityAI itemTop;
  98. EntityAI itemEnt;
  99. ItemBase itemBs;
  100. float rand;
  101.  
  102. itemTop = player.FindAttachmentBySlotName("Body");
  103.  
  104. if ( itemTop )
  105. {
  106. itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  107. if ( Class.CastTo(itemBs, itemEnt ) )
  108. itemBs.SetQuantity(4);
  109.  
  110. SetRandomHealth(itemEnt);
  111.  
  112. itemEnt = itemTop.GetInventory().CreateInInventory("flashlight");
  113. SetRandomHealth(itemEnt);
  114.  
  115. itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
  116. SetRandomHealth(itemEnt);
  117.  
  118. itemEnt = itemTop.GetInventory().CreateInInventory("WaterBottle");
  119. SetRandomHealth(itemEnt);
  120.  
  121. itemEnt = itemTop.GetInventory().CreateInInventory("MoneyRuble100");
  122. SetRandomHealth(itemEnt);
  123.  
  124. itemEnt = itemTop.GetInventory().CreateInInventory("KitchenKnife");
  125. SetRandomHealth(itemEnt);
  126.  
  127. rand = Math.RandomFloatInclusive(0.0, 1.0);
  128. if ( rand < 0.35 )
  129. itemEnt = player.GetInventory().CreateInInventory("rice");
  130. else if ( rand > 0.65 )
  131. itemEnt = player.GetInventory().CreateInInventory("Pear");
  132.  
  133. SetRandomHealth(itemEnt);
  134. }
  135. }
  136. };
  137.  
  138. Mission CreateCustomMission(string path)
  139. {
  140. return new CustomMission();
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement