HasterPaster

Spawn with custom gear

Jun 12th, 2021 (edited)
743
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void main()
  2. {
  3.     //INIT WEATHER BEFORE ECONOMY INIT------------------------
  4.     Weather weather = g_Game.GetWeather();
  5.  
  6.     weather.MissionWeather(false);    // false = use weather controller from Weather.c
  7.  
  8.     weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
  9.     weather.GetRain().Set( 0, 0, 1);
  10.     weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);
  11.  
  12.     //INIT ECONOMY--------------------------------------
  13.     Hive ce = CreateHive();
  14.     if ( ce )
  15.         ce.InitOffline();
  16.  
  17.     //DATE RESET AFTER ECONOMY INIT-------------------------
  18.     int year, month, day, hour, minute;
  19.     int reset_month = 9, reset_day = 20;
  20.     GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  21.  
  22.     if ((month == reset_month) && (day < reset_day))
  23.     {
  24.         GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  25.     }
  26.     else
  27.     {
  28.         if ((month == reset_month + 1) && (day > reset_day))
  29.         {
  30.             GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  31.         }
  32.         else
  33.         {
  34.             if ((month < reset_month) || (month > reset_month + 1))
  35.             {
  36.                 GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
  37.             }
  38.         }
  39.     }
  40. }
  41.  
  42. class CustomMission: MissionServer
  43. {
  44.     void SetRandomHealth(EntityAI itemEnt)
  45.     {
  46.         if ( itemEnt )
  47.         {
  48.             float rndHlt = Math.RandomFloat( 0.45, 0.65 );
  49.             itemEnt.SetHealth01( "", "", rndHlt );
  50.         }
  51.     }
  52.  
  53.     override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
  54.     {
  55.         Entity playerEnt;
  56.         playerEnt = GetGame().CreatePlayer( identity, characterName, pos, 0, "NONE" );
  57.         Class.CastTo( m_player, playerEnt );
  58.  
  59.         GetGame().SelectPlayer( identity, m_player );
  60.  
  61.         return m_player;
  62.     }
  63.  
  64.     override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
  65.     {
  66.         player.RemoveAllItems();
  67.  
  68.         // Jacket
  69.         private EntityAI clothesJacket;
  70.         clothesJacket = player.GetInventory().CreateInInventory("HikingJacket_Black");
  71.         clothesJacket.GetInventory().CreateInInventory("SteakKnife");
  72.         clothesJacket.GetInventory().CreateInInventory("TunaCan");
  73.         clothesJacket.GetInventory().CreateInInventory("WaterBottle");
  74.         clothesJacket.GetInventory().CreateInInventory("Rag");
  75.  
  76.         // Pants
  77.         private EntityAI clothesPants;
  78.         clothesPants = player.GetInventory().CreateInInventory("Jeans_Blue");
  79.        
  80.         // Boots
  81.         private EntityAI clothesBoots;
  82.         clothesBoots = player.GetInventory().CreateInInventory("WorkingBoots_Brown");
  83.     }
  84. };
  85.  
  86. Mission CreateCustomMission(string path)
  87. {
  88.     return new CustomMission();
  89. }
RAW Paste Data