Advertisement
Guest User

AngusK2.2

a guest
Aug 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 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\\container.c"
  17. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island01.c"
  18. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\island02.c"
  19. #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\prisonship.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.  
  74. class CustomMission: MissionServer
  75. {
  76. void SetRandomHealth(EntityAI itemEnt)
  77. {
  78. if ( itemEnt )
  79. {
  80. int rndHlt = Math.RandomInt(55,100);
  81. itemEnt.SetHealth("","",rndHlt);
  82. }
  83. }
  84.  
  85. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  86. {
  87. Entity playerEnt;
  88. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  89. Class.CastTo(m_player, playerEnt);
  90.  
  91. GetGame().SelectPlayer(identity, m_player);
  92.  
  93. return m_player;
  94. }
  95.  
  96. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  97. {
  98. EntityAI itemTop;
  99. EntityAI itemEnt;
  100. ItemBase itemBs;
  101. float rand;
  102.  
  103. itemTop = player.FindAttachmentBySlotName("Body");
  104.  
  105. if ( itemTop )
  106. {
  107. itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
  108. if ( Class.CastTo(itemBs, itemEnt ) )
  109. itemBs.SetQuantity(4);
  110.  
  111. SetRandomHealth(itemEnt);
  112.  
  113. itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare");
  114. SetRandomHealth(itemEnt);
  115.  
  116. itemEnt = itemTop.GetInventory().CreateInInventory("StoneKnife");
  117. SetRandomHealth(itemEnt);
  118.  
  119. rand = Math.RandomFloatInclusive(0.0, 1.0);
  120. if ( rand < 0.35 )
  121. itemEnt = player.GetInventory().CreateInInventory("Apple");
  122. else if ( rand > 0.65 )
  123. itemEnt = player.GetInventory().CreateInInventory("Pear");
  124. else
  125. itemEnt = player.GetInventory().CreateInInventory("Plum");
  126.  
  127. SetRandomHealth(itemEnt);
  128. }
  129. }
  130. };
  131.  
  132. Mission CreateCustomMission(string path)
  133. {
  134. return new CustomMission();
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement