gigiwwa

init.c

Jan 20th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. //Vanilla Banov Init.c
  2. // Thank you for using my map
  3. void main()
  4. {
  5. //INIT WEATHER BEFORE ECONOMY INIT------------------------
  6. //Banov Init
  7. Weather weather = g_Game.GetWeather();
  8.  
  9. weather.MissionWeather(false); // false = use weather controller from Weather.c
  10.  
  11. weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  12. weather.GetRain().Set( 0, 0, 1);
  13. weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  14.  
  15. //INIT ECONOMY--------------------------------------
  16. Hive ce = CreateHive();
  17. if ( ce )
  18. ce.InitOffline();
  19.  
  20. //Loot spawn Creator
  21. //GetCEApi().ExportProxyData(vector.Zero, 100000); //Loot
  22. //GetCEApi().ExportClusterData(); //Fruit
  23.  
  24. //DATE RESET AFTER ECONOMY INIT-------------------------
  25. int year, month, day, hour, minute;
  26. int reset_month = 9, reset_day = 20;
  27. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  28.  
  29. if ((month == reset_month) && (day < reset_day))
  30. {
  31. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  32. }
  33. else
  34. {
  35. if ((month == reset_month + 1) && (day > reset_day))
  36. {
  37. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  38. }
  39. else
  40. {
  41. if ((month < reset_month) || (month > reset_month + 1))
  42. {
  43. GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  44. }
  45. }
  46. }
  47. }
  48.  
  49. class CustomMission: MissionServer
  50. {
  51. void SetRandomHealth(EntityAI itemEnt)
  52. {
  53. if ( itemEnt )
  54. {
  55. float rndHlt = Math.RandomFloat( 0.55, 1.00 );
  56. itemEnt.SetHealth01( "", "", rndHlt );
  57. }
  58. }
  59.  
  60. override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  61. {
  62. Entity playerEnt;
  63. playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  64. Class.CastTo(m_player, playerEnt);
  65.  
  66. GetGame().SelectPlayer(identity, m_player);
  67.  
  68. return m_player;
  69. }
  70.  
  71. override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  72. {
  73. EntityAI itemTop;
  74. EntityAI itemEnt;
  75. ItemBase itemBs;
  76. float rand;
  77.  
  78. itemTop = player.FindAttachmentBySlotName("Body");
  79.  
  80. itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
  81.  
  82.  
  83. }
  84. };
  85.  
  86. Mission CreateCustomMission(string path)
  87. {
  88. return new CustomMission();
  89. }
Advertisement
Add Comment
Please, Sign In to add comment