Advertisement
Demonburger

init.c for Namalsk updates

Jan 1st, 2021
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.21 KB | None | 0 0
  1. static void SpawnObject(string type, vector position, vector orientation)
  2. {
  3. auto obj = GetGame().CreateObjectEx(type, position, ECE_SETUP | ECE_UPDATEPATHGRAPH | ECE_CREATEPHYSICS);
  4. obj.SetPosition(position);
  5. obj.SetOrientation(orientation);
  6. obj.SetOrientation(obj.GetOrientation());
  7. obj.SetFlags(EntityFlags.STATIC, false);
  8. obj.Update();
  9. obj.SetAffectPathgraph(true, false);
  10. if (obj.CanAffectPathgraph()) GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, obj);
  11. }
  12.  
  13. void main()
  14. {
  15.  
  16.  
  17. //ATMS
  18. SpawnObject("DC_BankingATM", "7246.01 238.252 7038.83", "-8.999998 0.000000 0.000000"); //Safe Trader
  19.  
  20. // Tara Trader
  21. SpawnObject("bldr_hbarrier_round", "7243.262695 239.141342 7025.149902", "12.691935 0.000000 0.000000");
  22. SpawnObject("bldr_hbarrier_round", "7238.111328 239.141342 7027.649414", "52.748150 -0.000000 -0.000000");
  23. SpawnObject("bldr_hbarrier_round", "7236.049805 239.188004 7032.890137", "100.096275 0.000000 0.000000");
  24. SpawnObject("bldr_hbarrier_round", "7238.111328 239.159866 7038.243164", "137.243286 0.000000 -0.000000");
  25. SpawnObject("bldr_hbarrier_round", "7248.669922 239.141342 7026.606934", "-27.000010 0.000000 0.000000");
  26. SpawnObject("bldr_hbarrier_round", "7243.145020 239.185364 7040.863281", "-179.999939 0.000000 -0.000000");
  27. SpawnObject("Land_Mil_GuardShed", "7247.792480 238.784241 7027.925781", "143.999969 0.000000 -0.000000");
  28. SpawnObject("Land_Mil_GuardShed", "7243.382813 238.783585 7026.812500", "-171.000031 0.000000 -0.000000");
  29. SpawnObject("Land_Mil_GuardShed", "7239.398926 238.799194 7028.716797", "-131.963409 0.000000 -0.000000");
  30. SpawnObject("Land_Mil_GuardShed", "7237.911133 238.850739 7032.817383", "-89.999977 0.000000 0.000000");
  31. SpawnObject("bldr_mil_guardshed", "7239.458008 238.817307 7037.260742", "-45.000000 0.000000 0.000000");
  32. SpawnObject("Land_Mil_GuardShed", "7243.605957 238.813538 7039.163086", "-8.999998 0.000000 0.000000");
  33. SpawnObject("Land_Mil_CamoNet_Roof_east", "7240.221680 239.751160 7030.966309", "63.000000 0.000000 0.000000");
  34. SpawnObject("ExpansionSign_Trader_Consumables", "7247.086426 237.862427 7028.767090", "143.999969 0.000000 -0.000000");
  35. SpawnObject("ExpansionSign_Trader_Weapons", "7240.293945 237.813080 7029.533691", "-130.691055 -0.000000 -0.000000");
  36. SpawnObject("ExpansionSign_Trader_Attachments", "7239.104492 237.853302 7032.863770", "-90.000038 0.000000 -0.000000");
  37. SpawnObject("ExpansionSign_Trader_Clothing", "7240.227539 237.828583 7036.509277", "-45.000053 0.000000 0.000000");
  38. SpawnObject("ExpansionSign_Trader_Vehicles", "7243.856934 237.835800 7038.103516", "-9.000000 0.000000 0.000000");
  39. SpawnObject("ExpansionSign_Trader_Accessoires", "7243.508789 237.807877 7027.983887", "-174.044357 -0.000000 -0.000000");
  40.  
  41. // Namalsk Airbase
  42. SpawnObject("Land_Mil_ATC_Small", "6281.133301 31.865360 9282.232422", "91.889534 -0.000000 -0.000000");
  43. SpawnObject("Land_Mil_Barracks_Round", "6280.693848 22.596621 9263.980469", "-90.000038 0.000000 -0.000000");
  44. SpawnObject("Land_Mil_Barracks_Round", "6280.700684 22.664263 9252.673828", "-89.999939 0.000000 0.000000");
  45. SpawnObject("Land_Mil_Fortified_Nest_Watchtower", "6279.749023 24.025724 9226.510742", "-99.000031 0.000000 -0.000000");
  46. SpawnObject("bldr_hbarrier_big", "6287.216309 23.174833 9233.403320", "89.999977 -0.000000 -0.000000");
  47. SpawnObject("bldr_hbarrier_big", "6286.763672 23.183363 9241.871094", "89.999977 -0.000000 -0.000000");
  48. SpawnObject("bldr_hbarrier_big", "6269.817871 22.619736 9244.187500", "89.999977 -0.000000 -0.000000");
  49. SpawnObject("bldr_hbarrier_big", "6270.167480 22.670408 9235.803711", "89.999977 -0.000000 -0.000000");
  50. SpawnObject("bldr_misc_barbedwire", "6270.730469 22.571636 9226.550781", "57.371552 0.000000 -0.000000");
  51. SpawnObject("bldr_misc_barbedwire", "6287.065430 22.821747 9226.770508", "125.999992 0.000000 -0.000000");
  52. SpawnObject("bldr_misc_barbedwire", "6289.298340 22.863621 9231.716797", "89.999992 -0.000000 -0.000000");
  53. SpawnObject("bldr_misc_barbedwire", "6289.281738 22.929468 9237.715820", "89.999977 -0.000000 -0.000000");
  54. SpawnObject("bldr_misc_barbedwire", "6288.877441 22.843649 9243.665039", "89.999977 -0.000000 -0.000000");
  55. SpawnObject("bldr_misc_barbedwire", "6268.033203 22.564787 9234.409180", "85.486847 0.000000 -0.000000");
  56. SpawnObject("bldr_misc_barbedwire", "6267.479004 22.544670 9240.354492", "89.999977 -0.000000 -0.000000");
  57. SpawnObject("bldr_misc_barbedwire", "6267.382813 22.481789 9246.212891", "89.999977 -0.000000 -0.000000");
  58. SpawnObject("bldr_hbarrier_big", "6269.370605 22.547380 9252.622070", "87.807930 0.000000 -0.000000");
  59. SpawnObject("bldr_hbarrier_big", "6268.859863 22.512800 9260.830078", "90.000000 0.000000 0.000000");
  60. SpawnObject("bldr_hbarrier_big", "6272.515625 22.480555 9268.350586", "144.000015 0.000000 -0.000000");
  61. SpawnObject("bldr_hbarrier_big", "6272.454590 22.814432 9227.299805", "-116.688370 -0.000000 -0.000000");
  62. SpawnObject("bldr_misc_barbedwire", "6275.693848 22.717571 9222.161133", "0.000000 -0.000000 -0.000000");
  63. SpawnObject("bldr_misc_barbedwire", "6282.227051 22.814552 9222.840820", "-9.000000 0.000000 0.000000");
  64. SpawnObject("bldr_misc_barbedwire", "6267.173340 22.394402 9252.347656", "87.240891 0.000000 -0.000000");
  65. SpawnObject("bldr_misc_barbedwire", "6266.903809 22.334454 9258.768555", "87.240891 0.000000 -0.000000");
  66. SpawnObject("bldr_misc_barbedwire", "6266.928711 22.287111 9265.083008", "-89.999977 0.000000 0.000000");
  67. SpawnObject("bldr_misc_barbedwire", "6269.881836 22.309063 9269.069336", "143.999969 0.000000 -0.000000");
  68. SpawnObject("bldr_misc_barbedwire", "6273.580566 22.369129 9273.416016", "116.999977 0.000000 -0.000000");
  69. SpawnObject("Land_Mil_Tent_Big4", "6279.250000 23.151300 9237.089844", "-9.000000 0.000000 0.000000");
  70. SpawnObject("bldr_hbarrier_4m", "6284.228027 22.367245 9258.145508", "89.999977 -0.000000 -0.000000");
  71. SpawnObject("Land_Mil_Barracks1", "6320.133301 23.475285 9269.735352", "179.999954 0.000000 -0.000000");
  72. SpawnObject("Land_Mil_Barracks1", "6320.266602 23.573318 9255.591797", "179.999939 0.000000 -0.000000");
  73. SpawnObject("Land_Mil_GuardTower", "6325.685059 26.760927 9238.028320", "-89.999977 0.000000 0.000000");
  74. SpawnObject("Land_Mil_GuardTower", "6327.812988 25.006784 9092.879883", "-98.999977 0.000000 -0.000000");
  75. SpawnObject("Land_Mil_GuardTower", "6257.613770 25.448290 8960.162109", "-17.999996 0.000000 0.000000");
  76. SpawnObject("Land_Mil_GuardTower", "6329.575684 29.713659 9004.066406", "-71.999985 0.000000 0.000000");
  77. SpawnObject("bldr_hbarrier_big", "6276.449707 21.917517 9077.341797", "-0.000008 0.000000 0.000000");
  78. SpawnObject("bldr_hbarrier_big", "6285.197266 22.035852 9077.485352", "0.000002 -0.000000 -0.000000");
  79. SpawnObject("bldr_hbarrier_big", "6293.953125 22.168051 9077.587891", "0.000000 -0.000000 -0.000000");
  80. SpawnObject("bldr_hbarrier_big", "6302.728027 22.292084 9078.088867", "0.000000 -0.000000 -0.000000");
  81. SpawnObject("bldr_hbarrier_big", "6273.649902 21.561537 9040.920898", "-0.000008 0.000000 0.000000");
  82. SpawnObject("bldr_hbarrier_big", "6282.397461 21.561537 9041.064453", "0.000002 -0.000000 -0.000000");
  83. SpawnObject("bldr_hbarrier_big", "6291.153320 21.561537 9041.166992", "0.000000 -0.000000 -0.000000");
  84. SpawnObject("bldr_hbarrier_big", "6299.928223 21.561537 9041.667969", "0.000000 -0.000000 -0.000000");
  85. SpawnObject("bldr_hbarrier_big", "6308.722656 21.912901 9043.640625", "-26.938005 0.000000 0.000000");
  86. SpawnObject("bldr_hbarrier_big", "6309.056641 22.313852 9075.514648", "-98.999977 0.000000 -0.000000");
  87. SpawnObject("bldr_hbarrier_big", "6311.491699 22.256893 9066.794922", "-105.328285 0.000000 -0.000000");
  88. SpawnObject("bldr_hbarrier_big", "6313.578613 21.820284 9058.493164", "80.999985 -0.000000 -0.000000");
  89. SpawnObject("bldr_hbarrier_big", "6313.987305 21.833496 9049.569336", "-84.721085 0.000000 -0.000000");
  90. SpawnObject("Land_Mil_Barracks1", "6296.698242 23.200768 9068.442383", "179.326889 0.000000 -0.000000");
  91. SpawnObject("Land_Mil_Barracks4", "6297.799805 22.248055 9056.009766", "179.781006 0.000000 0.000000");
  92. SpawnObject("Land_Mil_Barracks2", "6280.520996 22.228298 9060.294922", "-89.999992 0.000000 0.000000");
  93. SpawnObject("Land_Mil_Fortified_Nest_Watchtower", "6267.571289 22.429617 9046.764648", "-5.399975 0.000000 0.000000");
  94. SpawnObject("bldr_hbarrier_big", "6271.077637 21.647242 9054.224609", "-89.999977 0.000000 0.000000");
  95. SpawnObject("bldr_hbarrier_big", "6270.740234 21.651587 9063.049805", "-90.000000 0.000000 0.000000");
  96.  
  97. /*
  98. [Namalsk] CE init (offline)
  99. */
  100. CreateHive();
  101. GetHive().InitOffline();
  102.  
  103. /*
  104. [Namalsk] Weather init
  105. Warning: DO NOT ALTER following values as they are interconnected with other Namalsk-specific systems!
  106. To ensure correct functionality, it is necessary to include weaher init AFTER the hive init.
  107. */
  108. Weather weather = GetGame().GetWeather();
  109. weather.MissionWeather( true );
  110. weather.GetOvercast().SetLimits( 0.10, 0.30 );
  111. weather.GetRain().SetLimits( 0.0, 0.0 );
  112. weather.GetFog().SetLimits( 0.0, 0.0 );
  113. weather.GetOvercast().SetForecastChangeLimits( 0.1, 0.3 );
  114. weather.GetOvercast().SetForecastTimeLimits( 1600, 2100 );
  115. weather.GetOvercast().Set( Math.RandomFloatInclusive( 0.1, 0.2 ), 0, 0 ); // ignored if storage is present
  116. weather.GetRain().Set( 0, 0, 0 ); // ignored if storage is present
  117. weather.GetFog().Set( 0, 0, 0 ); // ignored if storage is present
  118. weather.SetWindMaximumSpeed( 30 );
  119. weather.SetWindFunctionParams( 0.1, 1.0, 42 );
  120. weather.SetStorm( 0, 1, 1 );
  121. weather.SetRainThresholds( 0.0, 1.0, 0 );
  122.  
  123.  
  124. /*
  125. [Namalsk] Mission time init
  126. after CE init to determine if storage mission type is outside of the required time-frame
  127. currently recommended time-frame is:
  128. 12/1 -> 12/31
  129. keep in mind that gameplay features are tied to the mission date (stored in the storage) and that it SHOULD remain this period!
  130. while using:
  131. day accelerated 6 times (serverTimeAcceleration=6), resulting in an average 78 min of day-time (RL)
  132. night accelerated 24 times (serverNightTimeAcceleration=4), resulting in an average of 26 min of night-time (RL)
  133. */
  134. int year, month, day, hour, minute;
  135. GetGame().GetWorld().GetDate( year, month, day, hour, minute );
  136.  
  137. if ( month < 12 )
  138. {
  139. year = 2011;
  140. month = 12;
  141. day = 1;
  142.  
  143. GetGame().GetWorld().SetDate( year, month, day, hour, minute );
  144. }
  145. };
  146.  
  147. class CustomMission: MissionServer
  148. {
  149. override void OnInit()
  150. {
  151. super.OnInit();
  152.  
  153. // this piece of code is recommended otherwise event system is switched on automatically and runs from default values
  154. // comment this whole block if NOT using Namalsk Survival
  155. if ( m_EventManagerServer )
  156. {
  157. // enable/disable event system, min time between events, max time between events
  158. m_EventManagerServer.OnInitServer( true, 600, 800 );
  159. // Register possible events along with their probability (0..1)
  160. // any custom events MUST inherit from EventBase, otherwise they will fail to load!
  161. m_EventManagerServer.RegisterEvent( Aurora, 1.0 );
  162. m_EventManagerServer.RegisterEvent( Blizzard, 0.5 );
  163. m_EventManagerServer.RegisterEvent( ExtremeCold, 0.4 );
  164. m_EventManagerServer.RegisterEvent( Snowfall, 0.8 );
  165. m_EventManagerServer.RegisterEvent( EVRStorm, 0.25 );
  166. }
  167. }
  168.  
  169. void SetRandomHealth(EntityAI itemEnt)
  170. {
  171. if (itemEnt)
  172. {
  173. float rndHlt = Math.RandomFloat( 0.50, 0.85 );
  174. itemEnt.SetHealth01( "", "", rndHlt );
  175. }
  176. }
  177.  
  178. override void StartingEquipSetup( PlayerBase player, bool clothesChosen )
  179. {
  180. EntityAI itemClothing;
  181. EntityAI itemEnt;
  182. ItemBase itemBs;
  183. float rand;
  184.  
  185. // top
  186. itemClothing = player.FindAttachmentBySlotName( "Body" );
  187. if ( itemClothing )
  188. {
  189. SetRandomHealth( itemClothing );
  190.  
  191. itemEnt = itemClothing.GetInventory().CreateInInventory( "Rag" );
  192. if ( Class.CastTo( itemBs, itemEnt ) )
  193. itemBs.SetQuantity( 4 );
  194. player.SetQuickBarEntityShortcut( itemEnt, 0 );
  195.  
  196. SetRandomHealth( itemEnt );
  197.  
  198. itemEnt = itemClothing.GetInventory().CreateInInventory( "RoadFlare" );
  199. SetRandomHealth( itemEnt );
  200. itemEnt = itemClothing.GetInventory().CreateInInventory( "RoadFlare" );
  201. SetRandomHealth( itemEnt );
  202. player.SetQuickBarEntityShortcut( itemEnt, 1 );
  203. }
  204.  
  205. // pants
  206. itemClothing = player.FindAttachmentBySlotName( "Legs" );
  207. if ( itemClothing )
  208. {
  209. SetRandomHealth( itemClothing );
  210.  
  211. itemEnt = itemClothing.GetInventory().CreateInInventory( "Heatpack" );
  212. SetRandomHealth( itemEnt );
  213.  
  214. int throwDice = Math.RandomInt( 0, 2 );
  215. if ( throwDice == 0 )
  216. itemEnt = itemClothing.GetInventory().CreateInInventory( "dzn_tool_watch" );
  217. else
  218. itemEnt = itemClothing.GetInventory().CreateInInventory( "dzn_tool_watch2" );
  219. player.SetQuickBarEntityShortcut( itemEnt, 2 );
  220. }
  221.  
  222. // shoes
  223. itemClothing = player.FindAttachmentBySlotName( "Feet" );
  224. if ( itemClothing )
  225. {
  226. SetRandomHealth( itemClothing );
  227. }
  228.  
  229. // bump fresh spawn water and energy values (to compensate for the frozen food and harder-to-get wells)
  230. player.GetStatWater().Set( 900 );
  231. player.GetStatEnergy().Set( 1100 );
  232. }
  233. };
  234.  
  235. Mission CreateCustomMission(string path)
  236. {
  237. return new CustomMission();
  238. };
  239.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement