Skip to main content

WEATHER


void main()
{
    //INIT WEATHER BEFORE ECONOMY INIT------------------------
    Weather weather = g_Game.GetWeather();

    weather.MissionWeather(false);    // false = use weather controller from Weather.c

    weather.GetOvercast().Set( Math.RandomFloatInclusive(0.4, 0.6), 1, 0);
    weather.GetRain().Set( 0, 0, 1);
    weather.GetFog().Set( Math.RandomFloatInclusive(0.05, 0.1), 1, 0);

    //INIT ECONOMY---------------------------------------------------------------------
    Hive ce = CreateHive();
    if ( ce )
        ce.InitOffline();

    //DATE RESET AFTER ECONOMY INIT----------------------------------------------------
    int year;
    int month;
    int day;
    int hour;
    int minute;

    GetGame().GetWorld().GetDate(year, month, day, hour, minute);
   
     if (((hour > 22) || (hour < 6)))             //-------------- No Complete Night
    {
        hour = 12;            // resets to midday rather than 9am startup time
       
        GetGame().GetWorld().SetDate(year, month, day, hour, minute);
    }

    if (((month <= 12) && (day < 20)) || ((month >= 12) && (day > 31)))
    {
        month = 12;
        day = 21;
       
        GetGame().GetWorld().SetDate(year, month, day, hour, minute);
    }
   
    //----------------ARRAYS FOR SPAWNBOX----------------------------------------------
    TStringArray aliceBags = {"AliceBag_Green" , "AliceBag_Black" , "AliceBag_Camo" };
    TStringArray taloonBags = {"TaloonBag_Blue" , "TaloonBag_Green" , "TaloonBag_Orange" };
    TStringArray barrels = {"Barrel_Blue" , "Barrel_Red" , "Barrel_Green" };
   
    vector location1 = { 6790.33, 0, 13281.6 };
    vector location2 = { 6786.33, 0, 13281.6 };
    vector location3 = { 6782.33, 0, 13281.6 };
   
    spawnBox( 3 , aliceBags , 2 , location1 , 1 );     // 2 bags planks/hatchets North
    spawnBox( 2 , aliceBags , 3 , location2 , 1 );    
    spawnItem( 16 , 5 , location3 , 1 );    
   
    /*------------------------------------------- Random Stuff ----------------------
    vector random1Location = {6795.25, 0, 13325.1};
    EntityAI random1 = EntityAI.Cast(GetGame().CreateObject( "Pliers", random1Location, false, true ));

    vector random2Location = {6796.26, 0, 13325.2};
    EntityAI random2 = EntityAI.Cast(GetGame().CreateObject( "Pliers", random2Location, false, true ));
   
    vector random3Location = {6796.27, 0, 13325.3};
    EntityAI random3 = EntityAI.Cast(GetGame().CreateObject( "Pliers", random3Location, false, true ));
   
    vector random4Location = {6795.28, 0, 13325.4};
    EntityAI random4 = EntityAI.Cast(GetGame().CreateObject( "Shovel", random4Location, false, true ));

    vector random5Location = {6796.29, 0, 13325.5};
    EntityAI random5 = EntityAI.Cast(GetGame().CreateObject( "Shovel", random5Location, false, true ));
   
    vector random6Location = {6797.30, 0, 13325.6};
    EntityAI random6 = EntityAI.Cast(GetGame().CreateObject( "Shovel", random6Location, false, true ));
   
    vector random7Location = {6795.31, 0, 13325.7};
    EntityAI random7 = EntityAI.Cast(GetGame().CreateObject( "WoodenPlank", random7Location, false, true ));

    vector random8Location = {6796.32, 0, 13325.8};
    EntityAI random8 = EntityAI.Cast(GetGame().CreateObject( "WoodenPlank", random8Location, false, true ));
   
    vector random9Location = {6797.33, 0, 13325.9};
    EntityAI random9 = EntityAI.Cast(GetGame().CreateObject( "WoodenPlank", random9Location, false, true ));
   
    vector random10Location = {6795.34, 0, 13325.10};
    EntityAI random10 = EntityAI.Cast(GetGame().CreateObject( "WoodenPlank", random10Location, false, true ));     */
   

    /*------------------------------------------ Military Tents ---------------------
   
    vector tent1Location = {6795.96, 0, 13325.5};
    EntityAI tent1 = EntityAI.Cast(GetGame().CreateObject( "LargeTent", tent1Location, false, true ));

    vector tent2Location = {6796.96, 0, 13325.5};
    EntityAI tent2 = EntityAI.Cast(GetGame().CreateObject( "LargeTent", tent2Location, false, true ));
   
    vector tent3Location = {6797.97, 0, 13325.5};
    EntityAI tent3 = EntityAI.Cast(GetGame().CreateObject( "LargeTent", tent3Location, false, true ));    */
   

    /*------------------------------------------- Car Tents -------------------------
   
    vector carTent1Location = {6795.98, 0, 13325.5};
    EntityAI carTent1 = EntityAI.Cast(GetGame().CreateObject( "CarTent", carTent1Location, false, true ));

    vector carTent2Location = {6796.99, 0, 13325.5};
    EntityAI carTent2 = EntityAI.Cast(GetGame().CreateObject( "CarTent", carTent2Location, false, true ));
   
    vector carTent3Location = {6798.00, 0, 13325.5};
    EntityAI carTent3 = EntityAI.Cast(GetGame().CreateObject( "CarTent", carTent3Location, false, true ));

    vector carTent4Location = {6798.01, 0, 13325.5};
    EntityAI carTent4 = EntityAI.Cast(GetGame().CreateObject( "CarTent", carTent4Location, false, true ));    */
   
}

void spawnBox( int c, TStringArray items, int rr, vector loc, int card){
   
    /* ----------------- SPAWNBOX -----------------------------------------------------
    ----------------- Created by [NDC] ------------------------------------------------
   
    Creates a container filled with objects of choice at X location and copies the
    object 1m N, S, E or West X times.
   
    Use as :
       
        spawnBox( Count ,
                    Array of Containers (size 3, otherwise must be changed below)
                        Case reference ,
                            Location as XYZ value(middle value can be 0, will be reassigned) ,
                                Cardinal Direction (1 for N, 2 for S... E... W)
                                );
   
    Spawn Items: 1 Engine Oil, 2 Planks/Hatchets, 3 Wire/Nails
            6 M4, 7 SVD
           
    ---------------------------------------------------------------------------------*/
   
    vector BoxXZPos = loc;             //-------------- Create Location
    float posY = GetGame().SurfaceY(BoxXZPos[0], BoxXZPos[2]);
    vector BoxPos = { BoxXZPos[0], posY, BoxXZPos[2] };
   
    float r;
    for(int i = 0; i < c; i++){
       
        r = Math.RandomFloatInclusive(0.0, 1.0);
        int j;
       
        switch ( r ){              //------------- Randomise container
            case r < 0.33 :
            j = 2; break;
            case r < 0.66 :
            j = 1; break;
            default :
            j = 0; }
       
        EntityAI container = EntityAI.Cast(GetGame().CreateObject( items[j] , BoxPos, false, true ));
        EntityAI weapon;
       
        switch ( rr )            //------------- Create cases
        {
            case rr == 1:
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                container.GetInventory().CreateInInventory("EngineOil");
                break;
            case rr == 2:
                container.GetInventory().CreateInInventory("WoodenPlank");
                container.GetInventory().CreateInInventory("WoodenPlank");
                container.GetInventory().CreateInInventory("WoodenPlank");
                container.GetInventory().CreateInInventory("Hatchet");
                container.GetInventory().CreateInInventory("Hatchet");
                container.GetInventory().CreateInInventory("Hatchet");
                break;
            case rr == 3:
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("MetalWire");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                container.GetInventory().CreateInInventory("NailBox");
                break;
            case rr == 6:
                weapon = container.GetInventory().CreateInInventory("M4A1");
                    weapon.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
                    weapon.GetInventory().CreateAttachment("M4_MPBttstck_Black");
                    weapon.GetInventory().CreateAttachment("ACOGOptic");
                    container.GetInventory().CreateAttachment("Mag_STANAG_30Rnd");
                weapon = container.GetInventory().CreateInInventory("M4A1");
                    weapon.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
                    weapon.GetInventory().CreateAttachment("M4_MPBttstck_Black");
                    weapon.GetInventory().CreateAttachment("ACOGOptic");
                    container.GetInventory().CreateAttachment("Mag_STANAG_30Rnd");
                weapon = container.GetInventory().CreateInInventory("M4A1");
                    weapon.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
                    weapon.GetInventory().CreateAttachment("M4_MPBttstck_Black");
                    weapon.GetInventory().CreateAttachment("ACOGOptic");
                    container.GetInventory().CreateAttachment("Mag_STANAG_30Rnd");
                break;
            case rr == 7:
                weapon = container.GetInventory().CreateInInventory("SVD");
                    weapon.GetInventory().CreateAttachment("PSO1Optic");
                    container.GetInventory().CreateAttachment("Mag_SVD_10Rnd");
                weapon = container.GetInventory().CreateInInventory("SVD");
                    weapon.GetInventory().CreateAttachment("PSO1Optic");
                    container.GetInventory().CreateAttachment("Mag_SVD_10Rnd");
                break;
            default:
                container.GetInventory().CreateInInventory("NailBox");
        }
       
        switch ( card ){            // Correct for Cardinal Direction
            case card == 1 :
            BoxPos[2] = BoxPos[2] + 1.0; break;
            case card == 2 :
            BoxPos[2] = BoxPos[2] - 1.0; break;
            case card == 3 :
            BoxPos[0] = BoxPos[0] + 1.0; break;
            case card == 4 :
            BoxPos[0] = BoxPos[0] - 1.0; break;
            default :
            BoxPos[2] = BoxPos[2] + 1.0; break;                // North if defaulted
       
        }
   
    }

}

void spawnItem( int c2, int rr2, vector loc2, int card2){
   
    /* ---------------- SPAWNITEM -----------------------------------------------------
    ---------------- Created by [NDC] -------------------------------------------------
   
    Creates an object of choice at X location and copies the object 1m N, S, E or West
    X times.
   
    Use as :
       
        spawnBox( Count ,
                    Case reference ,
                        Location as XYZ value(middle value can be 0, will be reassigned) ,
                            Cardinal Direction (1 for N, 2 for S... E... W)
                            );
   
    Spawn Items: 1 Car Tent, 2 Mil Tent, 3 Planks, 4 Shovel, 5 Logs
            8 M4, 9 SVD
                               
    ---------------------------------------------------------------------------------*/
   
    vector XZPos = loc2;             //-------------- Create Location
    float posY = GetGame().SurfaceY(XZPos[0], XZPos[2]);
    vector BoxPos2 = { XZPos[0], posY, XZPos[2] };
   
    for(int i = 0; i < c2; i++){

        EntityAI item2;
        EntityAI weapon2;
       
        switch ( rr2 )            //------------- to add spawns, add cases
        {
            case rr2 == 1:
                item2 = EntityAI.Cast(GetGame().CreateObject( "CarTent" , BoxPos2, false, true ));
                break;
            case rr2 == 2:
                item2 = EntityAI.Cast(GetGame().CreateObject( "LargeTent" , BoxPos2, false, true ));
                break;
            case rr2 == 3:
                item2 = EntityAI.Cast(GetGame().CreateObject( "WoodenPlank" , BoxPos2, false, true ));
                break;
            case rr2 == 4:
                item2 = EntityAI.Cast(GetGame().CreateObject( "Shovel" , BoxPos2, false, true ));
                break;
            case rr2 == 5:
                item2 = EntityAI.Cast(GetGame().CreateObject( "WoodenLog" , BoxPos2, false, true ));
                break;
            case rr2 == 8:
                weapon2 = EntityAI.Cast(GetGame().CreateObject( "M4A1" , BoxPos2, false, true ));
                    weapon2.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
                    weapon2.GetInventory().CreateAttachment("M4_MPBttstck_Black");
                    weapon2.GetInventory().CreateAttachment("ACOGOptic");
                    EntityAI.Cast(GetGame().CreateObject( "Mag_STANAG_30Rnd" , BoxPos2, false, true ));
                break;
            case rr2 == 9:
                weapon2 = EntityAI.Cast(GetGame().CreateObject( "SVD" , BoxPos2, false, true ));
                    weapon2.GetInventory().CreateAttachment("PSO1Optic");
                    EntityAI.Cast(GetGame().CreateObject( "Mag_SVD_10Rnd" , BoxPos2, false, true ));
                break;
            default:
                EntityAI.Cast(GetGame().CreateObject( "NailBox" , BoxPos2, false, true ));
        }
       
        switch ( card2 ){            // Correct for Cardinal Direction
            case card2 == 1 :
            BoxPos2[2] = BoxPos2[2] + 1.0; break;
            case card2 == 2 :
            BoxPos2[2] = BoxPos2[2] - 1.0; break;
            case card2 == 3 :
            BoxPos2[0] = BoxPos2[0] + 1.0; break;
            case card2 == 4 :
            BoxPos2[0] = BoxPos2[0] - 1.0; break;
            default :
            BoxPos2[2] = BoxPos2[2] + 1.0; break;                // North if defaulted
       
        }
   
    }

}

class CustomMission: MissionServer
{   
    void SetRandomHealth(EntityAI itemEnt)
    {
        if ( itemEnt )
        {
            int rndHlt = Math.RandomInt(55,100);
            itemEnt.SetHealth("","",rndHlt);
        }
    }

    override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
    {
        Entity playerEnt;
        playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
        Class.CastTo(m_player, playerEnt);
       
        GetGame().SelectPlayer(identity, m_player);
       
        return m_player;
    }
   
    override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
       
        player.RemoveAllItems();
       
        TStringArray topsArray = {"Shirt_BlueCheck","Shirt_RedCheck","Shirt_GreenCheck",
        "Shirt_WhiteCheck","Shirt_PlaneBlack","Sweater_Blue","Sweater_Gray","Sweater_Green",
        "Sweater_Red","Hoodie_Black","Hoodie_Blue","Hoodie_Brown","Hoodie_Green","Hoodie_Grey",
        "Hoodie_Blue","ChernarusSportShirt"};
       
        TStringArray pantsArray = {"Jeans_Black","Jeans_Blue","Jeans_BlueDark","Jeans_Brown",
        "Jeans_Green","Jeans_Grey","SlacksPants_Black","SlacksPants_Blue","SlacksPants_Beige",
        "SlacksPants_Brown","SlacksPants_LightGrey","SlacksPants_DarkGrey","SlacksPants_Khaki",
        "CanvasPants_Beige","CanvasPants_Blue","CanvasPants_Grey","CanvasPants_Red",
        "CanvasPantsMidi_Beige","CanvasPantsMidi_Blue","CanvasPantsMidi_Grey",
        "CanvasPantsMidi_Red","Breeches_Beetcheck","Breeches_Beige","Breeches_Blackcheck",
        "Breeches_Browncheck"};
       
        TStringArray hoboPantsArray = {"CanvasPants_Beige","CanvasPants_Blue",
        "CanvasPants_Grey","CanvasPants_Red","CanvasPantsMidi_Beige","CanvasPantsMidi_Blue",
        "CanvasPantsMidi_Grey","CanvasPantsMidi_Red","LeatherPants_Natural",
        "LeatherPants_Brown","LeatherPants_Black","LeatherPants_Beige"};
       
        TStringArray shoesArray = {"AthleticShoes_Black","AthleticShoes_Blue",
        "AthleticShoes_Brown","AthleticShoes_Green","AthleticShoes_Grey","HikingBootsLow_Beige",
        "HikingBootsLow_Black","HikingBootsLow_Blue","HikingBootsLow_Grey","HikingBoots_Black",
        "HikingBoots_Brown"};
       
        TStringArray constructionHelmets = {"ConstructionHelmet_Red","ConstructionHelmet_Yellow",
        "ConstructionHelmet_Orange","ConstructionHelmet_White","ConstructionHelmet_Lime",
        "ConstructionHelmet_Blue"};
       
        TStringArray medicalHats = {"MedicalScrubsHat_White","MedicalScrubsHat_Green",
        "MedicalScrubsHat_Blue"};
       
        TStringArray workingGloves = {"WorkingGloves_Yellow","WorkingGloves_Brown",
        "WorkingGloves_Black","WorkingGloves_Beige"};
       
        TStringArray medicalGloves = {"SurgicalGloves_Blue","SurgicalGloves_Green",
        "SurgicalGloves_LightBlue","SurgicalGloves_White"};
       
        TStringArray allGlasses = {"AviatorGlasses","AviatorGlasses","ThickFrameGlasses",
        "ThinFrameGlasses","SportGlasses_Orange","SportGlasses_Green","SportGlasses_Blue"};
       
        float rClass = Math.RandomFloatInclusive(0.0, 1.0);

        EntityAI item = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
        EntityAI pants;
        EntityAI shoes;
       
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;
        int c1;
       
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        switch ( rand ){
            case rand < 0.15 :
                c1 = 1; break;
            case rand < 0.4 :
                c1 = 2; break;
            case rand < 0.48 :
                c1 = 3; break;
            default :
                c1 = 0;
        }
       
        switch ( rClass ){
            case rClass < 0.9 :
                pants = player.GetHumanInventory().CreateInInventory(pantsArray.GetRandomElement());
                shoes = player.GetHumanInventory().CreateInInventory(shoesArray.GetRandomElement());
                SetRandomHealth(pants); SetRandomHealth(shoes);
                itemBs = ItemBase.Cast(pants); itemBs = ItemBase.Cast(shoes);
                break;
            default :
                pants = player.GetHumanInventory().CreateInInventory(hoboPantsArray.GetRandomElement());
                SetRandomHealth(pants);
                itemBs = ItemBase.Cast(pants);
        }
       
        itemTop = player.FindAttachmentBySlotName("Body");
       
        if ( c1 == 3 ) {
           
            player.RemoveAllItems();
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            switch ( rand ){
                case rand < 0.2 :
                    itemTop = player.GetHumanInventory().CreateInInventory("JumpsuitJacket_Green");
                    pants = player.GetHumanInventory().CreateInInventory("JumpsuitPants_Green");
                    break;
                case rand < 0.4 :
                    itemTop = player.GetHumanInventory().CreateInInventory("JumpsuitJacket_Red");
                    pants = player.GetHumanInventory().CreateInInventory("JumpsuitPants_Red");
                    break;
                case rand < 0.6 :
                    itemTop = player.GetHumanInventory().CreateInInventory("JumpsuitJacket_Blue");
                    pants = player.GetHumanInventory().CreateInInventory("JumpsuitPants_Blue");
                    break;
                default :
                    itemTop = player.GetHumanInventory().CreateInInventory("JumpsuitJacket_Gray");
                    pants = player.GetHumanInventory().CreateInInventory("JumpsuitPants_Grey");
            }
           
            shoes = player.GetHumanInventory().CreateInInventory(shoesArray.GetRandomElement());
            SetRandomHealth(itemTop); SetRandomHealth(pants); SetRandomHealth(shoes);
            itemBs = ItemBase.Cast(itemTop); itemBs = ItemBase.Cast(pants); itemBs = ItemBase.Cast(shoes);
           
        }
       
        itemTop = player.FindAttachmentBySlotName("Body");
       
        if ( itemTop )
        {
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            switch ( rand ){
                case rand < 0.25 :
                    itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola");
                    break;
                case rand < 0.5 :
                    itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite");
                    break;
                case rand < 0.75 :
                    itemEnt = player.GetInventory().CreateInInventory("SodaCan_Kvass");
                    break;
                default :
                    itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi");
            }
           
            SetRandomHealth(itemEnt);
       
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            switch ( rand ){
                case rand < 0.2 :
                    itemEnt = player.GetInventory().CreateInInventory("Chemlight_Red");
                    break;
                case rand < 0.4 :
                    itemEnt = player.GetInventory().CreateInInventory("Chemlight_Blue");
                    break;
                case rand < 0.6 :
                    itemEnt = player.GetInventory().CreateInInventory("Chemlight_White");
                    break;
                case rand < 0.8 :
                    itemEnt = player.GetInventory().CreateInInventory("Chemlight_Yellow");
                    break;
                default :
                    itemEnt = player.GetInventory().CreateInInventory("Chemlight_Green");
            }
           
            SetRandomHealth(itemEnt);
       
            itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
            SetRandomHealth(itemEnt);
           
            itemEnt = itemTop.GetInventory().CreateInInventory("PersonalRadio");
            SetRandomHealth(itemEnt);
           
            itemEnt = itemTop.GetInventory().CreateInInventory("Battery9V");
            SetRandomHealth(itemEnt);
           
            itemEnt = itemTop.GetInventory().CreateInInventory("Flashlight");
            SetRandomHealth(itemEnt);
           
            itemEnt = itemTop.GetInventory().CreateInInventory("Apple");
            SetRandomHealth(itemEnt);
           
            itemEnt = itemTop.GetInventory().CreateInInventory("Apple");
            SetRandomHealth(itemEnt);
       
        }
       
        ItemBase rags = player.GetInventory().CreateInInventory("Rag");
        rags.SetQuantity(2);
       
        switch ( rClass ){
            case rClass < 0.7 :
                itemEnt = pants.GetInventory().CreateInInventory("Cannabis");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("Paper");
                SetRandomHealth(itemEnt);
                break;
            case rClass < 0.75 :
                itemEnt = pants.GetInventory().CreateInInventory("Rope");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PainkillerTablets");
                SetRandomHealth(itemEnt);
                break;
            case rClass < 0.9 :
                itemEnt = pants.GetInventory().CreateInInventory("Vodka");
                SetRandomHealth(itemEnt);
                break;
            default :
                itemEnt = pants.GetInventory().CreateInInventory("AgaricusMushroom");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("AmanitaMushroom");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("MacrolepiotaMushroom");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("LactariusMushroom");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("PsilocybeMushroom");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("SambucusBerry");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("SambucusBerry");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("CaninaBerry");
                SetRandomHealth(itemEnt);
                itemEnt = pants.GetInventory().CreateInInventory("CaninaBerry");
                SetRandomHealth(itemEnt);
        }
       
        switch ( rand ){
            case rand < 0.33 :
                itemEnt = pants.GetInventory().CreateInInventory("CigarettePack_Merkur");
                break;
            case rand > 0.65 :
                itemEnt = pants.GetInventory().CreateInInventory("CigarettePack_Partyzanka");
                break;
                default :
                itemEnt = pants.GetInventory().CreateInInventory("CigarettePack_Chernamorka");
        }
           
        SetRandomHealth(itemEnt);
       
        itemEnt = pants.GetInventory().CreateInInventory("PetrolLighter");
        SetRandomHealth(itemEnt);
       
        if ( c1 == 1 ) {
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.35 )
                itemEnt = player.GetInventory().CreateInInventory(medicalHats.GetRandomElement());
           
            SetRandomHealth(itemEnt);
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.5 )
                itemEnt = player.GetInventory().CreateInInventory(medicalGloves.GetRandomElement());
           
            SetRandomHealth(itemEnt);
           
        } else if ( c1 == 2 ) {
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.4 )
                itemEnt = player.GetInventory().CreateInInventory(constructionHelmets.GetRandomElement());
           
            SetRandomHealth(itemEnt);
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.7 )
                itemEnt = player.GetInventory().CreateInInventory(workingGloves.GetRandomElement());
           
            SetRandomHealth(itemEnt);
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.4 )
                itemEnt = player.GetInventory().CreateInInventory("ReflexVest");
           
            SetRandomHealth(itemEnt); itemBs = ItemBase.Cast(itemEnt);
           
        } else if ( c1 == 3 ) {
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.7 )
                itemEnt = player.GetInventory().CreateInInventory(workingGloves.GetRandomElement());
           
            SetRandomHealth(itemEnt);
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.3 )
                itemEnt = pants.GetInventory().CreateInInventory("BrakeFluid");
            else if ( rand < 0.5 )
                itemEnt = pants.GetInventory().CreateInInventory("TireRepairKit");
            else if ( rand < 0.8 )
                itemEnt = pants.GetInventory().CreateInInventory("ButaneCanister");
            else
                itemEnt = pants.GetInventory().CreateInInventory("DuctTape");
           
            SetRandomHealth(itemEnt);
           
            itemEnt = pants.GetInventory().CreateInInventory("Wrench");
            SetRandomHealth(itemEnt);
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.4 )
                itemEnt = player.GetInventory().CreateInInventory("ReflexVest");
           
            SetRandomHealth(itemEnt); itemBs = ItemBase.Cast(itemEnt);
           
        } else if ( c1 == 0 ) {
           
            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.08 )
                itemEnt = player.GetInventory().CreateInInventory("GreatHelm");
            else if ( rand < 0.105 )
                itemEnt = player.GetInventory().CreateInInventory("BurlapSackCover");
           
            SetRandomHealth(itemEnt);
           
        }
       
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.015 )
            itemEnt = player.GetInventory().CreateInInventory("MouthCover");
           
        SetRandomHealth(itemEnt);
       
        rand = Math.RandomFloatInclusive(0.0, 1.0);
        if ( rand < 0.15 )
            itemEnt = player.GetInventory().CreateInInventory(allGlasses.GetRandomElement());
       
        SetRandomHealth(itemEnt);
        itemBs = ItemBase.Cast(itemEnt);
       
    }
};
 
Mission CreateCustomMission(string path)
{
    return new CustomMission();
}