Sign in to follow this  
Followers 0
Zaross

Problems spawning Magazines on the ground

3 posts in this topic

Hey,

i got a problem with our crashside-script. It spawns Weapons, backpacks, items but no magazines. Any one knows why?

 

Spoiler

private ["_crashNum","_lootNum","_loot","_coords"];
// Number of Crashes
_crashNum = 5;

// Number of Loot Piles
_lootNum = 5;

_loot = [
    "srfile_mas_m24","srifle_mas_sr25_v","srifle_mas_hk417_v","Exile_weapon_SVDCamo","srifle_mas_m110","LMG_mas_M249_F","LMG_mas_m72_F","LMG_mas_rpk_F","LMG_MK200_F","arifle_MX_Holo_pointer_F","arifle_MXM_DMS_F",
    "arifle_AKM_F","arifle_mas_asval","arifle_mas_mp5sd_ds","arifle_mas_g3",

    "optic_LRPS_ghex_F","optic_DMS_ghex_F","muzzle_mas_snds_C","muzzle_mas_snds_C","optic_Hamr","muzzle_snds_m_khk_F","muzzle_snds_m_khk_F","muzzle_snds_m_khk_F",
   
    "EnergyPack","Repair_EPOCH","Defib_EPOCH","Heal_EPOCH","FAK","ItemWatch","CircuitParts","ItemScraps","jerrycan_epoch","VehicleRepair","CircuitParts","Exile_item_Codelock",
    "U_O_T_Sniper_F","U_I_GhillieSuit","U_B_CTRG_3","U_B_CTRG_Soldier_F","B_mas_m_Bergen_acr_c","B_mas_m_Bergen_us","Rangefinder","U_I_CombatUniform","V_PlateCarrier2_rgr","V_PlateCarrier2_blk","V_PlateCarrierH_CTRG","U_B_T_Soldier_SL_F","Exile_Headgear_GasMask",
    "meatballs_epoch","ItemSodaRbull","sardines_epoch","scam_epoch","sweetcorn_epoch","Towelette"
];

_spawnCenter = [6206.94,5920.05,0]; //Center of your map (usually in mission.sqm)
_min = 0; // minimum distance from the center position (Number) in meters
_max = 1000; // maximum distance from the center position (Number) in meters
_mindist = 10; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
//Low _mindist means helicrashes could spawn near towns or in forests.. higher the number it would be spawning in an open field etc
_water = 0; // water mode 0: cannot be in water , 1: can either be in water or not , 2: must be in water
_shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore

vSpawnCrashes = {
    for "_j" from 1 to _crashNum do {
        _posOfCrash = [_spawnCenter,_min,_max,_mindist,_water,20,_shoremode] call BIS_fnc_findSafePos; // find a random loc
        _helicopters = ["Land_UWreck_Heli_Attack_02_F","Land_Wreck_Heli_Attack_01_F"]; //Add Heli classnames here
        _element = _helicopters call BIS_fnc_SelectRandom;
        _vehHeli = _element createVehicle [0,0,0];
        _burnthefucker = "test_EmptyObjectForFireBig" createVehicle (position _vehHeli);  _burnthefucker attachto [_vehHeli, [0,0,-1]]; 
        _vehHeli setposATL [(_posOfCrash) select 0,(_posOfCrash) select 1,0];
        _vehHeli setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
               
        for "_i" from 1 to _lootNum do {
            _crate0 = createVehicle ["weaponHolderSimulated", _vehHeli modelToWorld [(random 10) - 3, (random 10) - 4, 0], [], 0, "CAN_COLLIDE"];
            _crate1 = createVehicle ["weaponHolderSimulated", _vehHeli modelToWorld [(random 10) - 3, (random 10) - 4, 0], [], 0, "CAN_COLLIDE"];
           
            _item = _loot call BIS_fnc_selectRandom;
            switch (true) do
            {
                case (isClass (configFile >> "CfgWeapons" >> _item)): {
                    _kindOf = [(configFile >> "CfgWeapons" >> _item),true] call BIS_fnc_returnParents;
                    if ("ItemCore" in _kindOf) then {
                        // Min 1, Max 2
                        _crate0 addItemCargoGlobal [_item,(floor(random(2)))+1];
                        _crate1 addItemCargoGlobal [_item,(floor(random(2)))+1];
                    } else {
                        // One Weapon, Three Mags
                        _crate0 addWeaponCargoGlobal [_item,1];
                        _crate1 addWeaponCargoGlobal [_item,1];
                       
                        _cAmmo = [] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines");
                        {
                            if (isClass(configFile >> "CfgPricing" >> _x)) exitWith {
                                _crate0 addMagazineCargoGlobal [_x,2];
                                _crate1 addMagazineCargoGlobal [_x,2];
                            };
                        } forEach _cAmmo;
                    };
                };
                case (isClass (configFile >> "cfgMagazines" >> _item)): {
                    // Min 1, Max 3
                    _crate0 addMagazineCargoGlobal [_item,(floor(random(3)))+1];
                    _crate1 addMagazineCargoGlobal [_item,(floor(random(3)))+1];
                };
                case ((getText(configFile >> "cfgVehicles" >> _item >>  "vehicleClass")) == "Backpacks"): {
                    // One Bag
                    _crate0 addBackpackCargoGlobal [_item,1];
                    _crate1 addBackpackCargoGlobal [_item,1];
                };
            };
            _crate0 setPos [(getPos _crate0 select 0) +5, (getPos _crate0 select 1), 0];
            _crate1 setPos [(getPos _crate1 select 0) -10, (getPos _crate1 select 1), 0];
            _crate0 setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
            _crate1 setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
            _cutter0 = "Land_ClutterCutter_medium_F" createVehicle (getpos _crate0);
            _cutter1 = "Land_ClutterCutter_medium_F" createVehicle (getpos _crate1);
            _cutter0 setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
            _cutter1 setVariable ["LAST_CHECK", (diag_tickTime + 14400)];

           
        };
    };
};

call vSpawnCrashes;

 

Edited by Zaross

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.