Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2021
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void main() {
  2.  
  3.     Hive ce = CreateHive();
  4.     if (ce)
  5.         ce.InitOffline();
  6.  
  7.     Weather weather = g_Game.GetWeather();
  8.  
  9.     weather.GetOvercast().SetLimits(0.0, 0.0);
  10.     weather.GetRain().SetLimits(0.0, 0.0);
  11.     weather.GetFog().SetLimits(0.0, 0.0);
  12.  
  13.     weather.GetOvercast().SetForecastChangeLimits(0.0, 0.0);
  14.     weather.GetRain().SetForecastChangeLimits(0.0, 0.0);
  15.     weather.GetFog().SetForecastChangeLimits(0.0, 0.0);
  16.  
  17.     weather.GetOvercast().SetForecastTimeLimits(0, 0);
  18.     weather.GetRain().SetForecastTimeLimits(0,0);
  19.     weather.GetFog().SetForecastTimeLimits(0,0);
  20.  
  21.     weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
  22.     weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
  23.     weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
  24.  
  25.     weather.SetWindMaximumSpeed(0);
  26.     weather.SetWindFunctionParams(0, 0, 0);
  27. }
  28.  
  29. class CustomMission : MissionServer {
  30.     /*
  31.      *  Config:
  32.      *      This area is the only area in which users should change any information/variables.
  33.      *      If you do not understand what something is being used for please read the comments above every function.
  34.     */
  35.  
  36.     //Bag Name
  37.     string bag_name = "SmershBag";
  38.  
  39.     /*
  40.      * Name: Assault Class
  41.      * Primary Weapon: M4A1
  42.      * Weapon Attachments: CQB Buttstock, ACOG Scope, RIS Handguard
  43.      * Sidearm Weapon: IJ70
  44.      * Sidearm Attachments: Suppressor
  45.     */
  46.     autoptr TStringArray Assault_Clothing = {"BandanaMask_CamoPattern", "BallisticHelmet_Green", "USMCJacket_Woodland", "USMCPants_Woodland"};
  47.     string Assault_Gun = "M4A1";
  48.     string Assault_SideArm = "MakarovIJ70";
  49.     autoptr TStringArray Assault_SideArm_Attachments = {"MakarovPBSuppressor"};
  50.     autoptr TStringArray Assault_Attachments = {"M4_CQBBttstck_Black", "ACOGOptic", "M4_RISHndgrd_Black"};
  51.     autoptr TStringArray Assault_Mags = {"MAG_STANAG_30Rnd", "MAG_IJ70_8RND"}
  52.  
  53.     /*
  54.      * Name: Submachine Gun Class
  55.      * Primary Weapon: MP5K
  56.      * Weapon Attachments: Rail Handguard, Buttstock, M69 Optic
  57.      * Sidearm Weapon: IJ70
  58.      * Sidearm Attachments: Suppressor
  59.     */
  60.     autoptr TStringArray Submachine_Clothing = {"M65Jacket_Black", "SlacksPants_Black", "RocketAviators", "BalaclavaMask_Blackskull"};
  61.     string SubMachineGun_Gun = "MP5K";
  62.     string SubMachineGun_Sidearm = "MakarovIJ70";
  63.     autoptr TStringArray SubMachineGun_SideArm_Attachments = {"MakarovPBSuppressor"};
  64.     autoptr TStringArray SubmachineGun_Attachments = {"MP5_PRailHndgrd", "MP5k_StockBttstck", "M68Optic"};
  65.     autoptr TStringArray SubmachineGun_Mags = {"MAG_MP5_15Rnd", "MAG_IJ70_8RND"};
  66.  
  67.     /*
  68.      * Name: Sniper Class
  69.      * Primary Weapon: Mosin
  70.      * Weapon Attachments: PU Scope
  71.      * Sidearm Weapon: IJ70
  72.      * Sidearm Attachments: Suppressor
  73.     */
  74.     autoptr TStringArray Sniper_Clothing = {"BalaclavaMask_Black", "BallisticHelmet_Black", "TShirt_Black", "Jeans_Black", "UKAssVest_Black"};
  75.     string Sniper_Gun = "SVD";
  76.     string Sniper_Sidearm = "MakarovIJ70";
  77.     autoptr TStringArray Sniper_SideArm_Attachments = {"MakarovPBSuppressor"};
  78.     autoptr TStringArray Sniper_Attachments = {"PSO11Optic"};
  79.     autoptr TStringArray Sniper_Mags = {"Mag_SVD_10Rnd", "MAG_IJ70_8RND"};
  80.  
  81.     /*
  82.       * Name: Medic Class
  83.       * Primary Weapon: None
  84.       * Weapon Attachments: None
  85.       * Sidearm Weapon: IJ70
  86.       * Sidearm Attachments: Suppressor
  87.       * Medical Kit: Bandage, Morphine, Saline, Painkillers
  88.      */
  89.     autoptr TStringArray Medic_Clothing = {"BallisticHelmet_Green", "GasMask", "ParamedicJacket_Green", "ParamedicPants_Green"};
  90.     string Medic_Gun = "MakarovIJ70";
  91.     autoptr TStringArray Medic_Attachments = {"MakarovPBSuppressor"};
  92.     string Medical_Supply_Case = "FIRSTAIDKIT";
  93.     autoptr TStringArray Medical_Supplies = {"BANDAGEDRESSING", "MORPHINE", "SALINEBAGIV", "PAINKILLERTABLETS"};
  94.     autoptr TStringArray Medic_Mags = {"MAG_IJ70_8RND"};
  95.  
  96.     //  General Items which everyone will receive on spawn; regardless of class.
  97.     autoptr TStringArray Utilities = {"TacticalBaconCan", "Canteen", "CanOpener"};
  98.     autoptr TStringArray Uniform = {"SmershVest", "TacticalGloves_Green", "CombatBoots_Black"};
  99.  
  100.     // Melee Weapons
  101.     autoptr TStringArray oneHanders = {"Machete", "HuntingKnife", "KitchenKnife"};
  102.  
  103.     /*
  104.      * End of Config:
  105.      *   Do not change anything below unless you understand what you are doing....
  106.     */
  107.  
  108.     autoptr TStringArray batteryCompatible = {"UniversalLight", "ReflexOptic", "M68Optic", "M4_T3NRDSOptic"};
  109.  
  110.     /*
  111.      * @function addMags
  112.      * @discussion Adds mags to players inventory
  113.      *
  114.      * @param    player: Instance Of Player
  115.      * @param    magArray: Collection mag names
  116.      * @param    count: Number of each mag which needs to be given.
  117.      * @param    toQuickBar: Should be added to the quick bar, or not.
  118.      */
  119.     int magCount = 2;
  120.     void addMags(PlayerBase player, TStringArray magArray, int count, bool toQuickBar) {
  121.         if (count < 1 || magArray.Count() < 1)
  122.             return;
  123.  
  124.         for(int x = 0; x < magArray.Count(); x++) {
  125.             for (int i = 0; i < count; i++) {
  126.                 EntityAI mag = player.GetInventory().CreateInInventory(magArray.Get(x));
  127.                 if (toQuickBar)
  128.                     if(x != 1) {
  129.                         player.SetQuickBarEntityShortcut(mag, x + i + 2, true);
  130.                     }else{
  131.                         player.SetQuickBarEntityShortcut(mag, x + i + 3, true);
  132.                     }
  133.             }
  134.         }
  135.     }
  136.  
  137.     /*
  138.      * @function dress_player
  139.      * @abstract Gives player class related clothing.
  140.      * @discussion This function puts choosen class clothing on the player.
  141.      *
  142.      * @param    player: Instance Of Player
  143.      * @param    class_clothes: Collection of class clothing names
  144.      * @param    general_items: Collection of general items which will also be given to the player
  145.      */
  146.     void dress_player(PlayerBase player, TStringArray class_clothes, TStringArray general_items){
  147.         for(int i = 0; i < class_clothes.Count(); i++)
  148.             player.GetInventory().CreateAttachment(class_clothes.Get(i));
  149.  
  150.         for(int x = 0; x < general_items.Count(); x++)
  151.             player.GetInventory().CreateAttachment(general_items.Get(x));
  152.     }
  153.    
  154.     /*
  155.      *  @function   arm_player
  156.      *  @abstract   Arms player with weapon, and adds attachments to weapon.
  157.      *  @discussion This function creates a weapon, goes through all the attachments and attaches them,
  158.      *                while checking if it needs a battery.
  159.      *  @param      player: Instance of Player
  160.      *  @param      weapon_name: Name of weapon to be given
  161.      *  @param      gunAttachments: Collection of attachment names to be added to weapon
  162.      *  @result     EntityAI: weapon
  163.      */
  164.     EntityAI arm_player(PlayerBase player, string weapon_name, TStringArray gunAttachments){
  165.         EntityAI weapon = player.GetHumanInventory().CreateInHands(weapon_name);
  166.         for(int i = 0; i < gunAttachments.Count(); i++){
  167.             EntityAI attachment = weapon.GetInventory().CreateAttachment(gunAttachments.Get(i));
  168.             for (int x = 0; x < batteryCompatible.Count(); x++){
  169.                 if(batteryCompatible.Get(x).Contains(gunAttachments.Get(i)))
  170.                     attachment.GetInventory().CreateAttachment("Battery9V");
  171.             }
  172.         }
  173.         return weapon;
  174.     }
  175.  
  176.     EntityAI arm_player_secondary(PlayerBase player, string weapon_name, TStringArray secondaryAttachments){
  177.         EntityAI weapon = player.GetInventory().CreateInInventory(weapon_name);
  178.         for(int i = 0; i < secondaryAttachments.Count(); i++){
  179.             EntityAI attachment = weapon.GetInventory().CreateAttachment(secondaryAttachments.Get(i));
  180.             for (int x = 0; x < batteryCompatible.Count(); x++){
  181.                 if(batteryCompatible.Get(x).Contains(secondaryAttachments.Get(i)))
  182.                     attachment.GetInventory().CreateAttachment("Battery9V");
  183.             }
  184.         }
  185.         return weapon;
  186.     }
  187.  
  188.     /*
  189.      *  @function   give_utilities
  190.      *  @discussion Added a backpack to the players back and fills it with provided items.
  191.      *
  192.      *  @param      player: Instance of Player
  193.      *  @param      util: Collection of utility items names to be added to the backpack
  194.      *  @param      backpack: Backpack item name which items will be stored, and will be added to players back.
  195.      */
  196.     void give_utilities(PlayerBase player, TStringArray util, string backpack){
  197.         EntityAI backpackEnt = player.GetInventory().CreateAttachment(backpack);
  198.         for (int i = 0; i < util.Count(); i++)
  199.             backpackEnt.GetInventory().CreateInInventory(util.Get(i));
  200.     }
  201.  
  202.     /*
  203.     *  @function   give_medical
  204.     *  @discussion Puts a bag into players inventory and adds items into the bag.
  205.     *                  This is NOT the same as give_utilities, one adds bag to inventory, one adds bag to player.
  206.     *  @param      player: Instance of Player
  207.     *  @param      bag_name: Name of the bag which will be added to the players inventory and filled with items.
  208.     *  @param      supplies: Collection of items which will be added to the bag.
  209.     */
  210.     void give_medical(PlayerBase player, string bag_name, TStringArray supplies) {
  211.         EntityAI medickit = player.GetInventory().CreateInInventory(bag_name);
  212.  
  213.         for (int i = 0; i < supplies.Count(); i++)
  214.             medickit.GetInventory().CreateInInventory(supplies.Get(i));
  215.     }
  216.  
  217.     override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName){
  218.         Entity playerEnt;
  219.         playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
  220.         Class.CastTo(m_player, playerEnt);
  221.  
  222.         GetGame().SelectPlayer(identity, m_player);
  223.  
  224.         return m_player;
  225.     }
  226.  
  227.     override void StartingEquipSetup(PlayerBase player, bool clothesChosen) {
  228.         player.RemoveAllItems();
  229.  
  230.         EntityAI primary;
  231.         EntityAI secondary;
  232.  
  233.         switch (Math.RandomInt(0, 4)) {
  234.             case 0: // Assault
  235.                 dress_player(player, Assault_Clothing, Uniform);
  236.                 primary = arm_player(player, Assault_Gun, Assault_Attachments);
  237.                 secondary = arm_player_secondary(player, Assault_SideArm, Assault_SideArm_Attachments);
  238.                 give_utilities(player, Utilities, bag_name);
  239.                 addMags(player, Assault_Mags, magCount, true);
  240.                 break;
  241.             case 1: // Sniper
  242.                 dress_player(player, Sniper_Clothing, Uniform);
  243.                 primary = arm_player(player, Sniper_Gun, Sniper_Attachments);
  244.                 secondary = arm_player_secondary(player, Sniper_Sidearm, Sniper_SideArm_Attachments);
  245.                 give_utilities(player, Utilities, bag_name);
  246.                 addMags(player, Sniper_Mags, magCount, true);
  247.                 break;
  248.             case 2: // Submachine Gun
  249.                 dress_player(player, Submachine_Clothing, Uniform);
  250.                 primary = arm_player(player, SubMachineGun_Gun, SubmachineGun_Attachments);
  251.                 secondary = arm_player_secondary(player, SubMachineGun_Sidearm, SubMachineGun_SideArm_Attachments);
  252.                 give_utilities(player, Utilities, bag_name);
  253.                 addMags(player, SubmachineGun_Mags, magCount, true);
  254.                 break;
  255.             case 3: // Medic
  256.                 dress_player(player, Medic_Clothing, Uniform);
  257.                 primary = arm_player(player, Medic_Gun, Medic_Attachments);
  258.                 give_utilities(player, Utilities, bag_name);
  259.                 addMags(player, Medic_Mags, magCount, true);
  260.                 give_medical(player, Medical_Supply_Case, Medical_Supplies);
  261.                 break;
  262.         }
  263.         player.GetInventory().CreateInInventory(oneHanders.GetRandomElement());
  264.         player.SetQuickBarEntityShortcut(primary, 0, true);
  265.  
  266.         if(secondary != null){
  267.             player.SetQuickBarEntityShortcut(secondary, 1, true);
  268.         }
  269.     }
  270. };
  271.  
  272. Mission CreateCustomMission(string path) {
  273.     return new CustomMission();
  274. }
Advertisement
RAW Paste Data Copied
Advertisement