Jump to content
  • 0

How do you replace medbox0 in the loottables?


NyxGrimlock

Question

Hi all,

Since the last patch for Arma2:OA, med boxes are broken and i want to replace them with us ordnance boxes in hospitals etc. I have custom loot tables and noticed in some of the comments you can change this. But no actual specifics on how to do so. Anyone know how to do this?

Regards,

Grimlock

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

open your custom loot files, do a search for "medobox0" and change it to the us ordnance box.  You can do the same thing for infistar if you have it.

Use notepad ++

I personally reverted back myself just because of off the crazy things they changed.

but either way should work

Link to comment
Share on other sites

  • 0

 

On 05/04/2016 at 3:38 AM, theduke said:

open your custom loot files, do a search for "medobox0" and change it to the us ordnance box.  You can do the same thing for infistar if you have it.

Use notepad ++

I personally reverted back myself just because of off the crazy things they changed.

but either way should work

I tried doing it the way that theduke says here, and it kinda works, but then medical loot doesnt spawn in the box, 50 satchel charges, 20 landmines and some hand grenades do.

I havent found a fix for this yet.

Link to comment
Share on other sites

  • 0
15 hours ago, Voltan said:

 

I tried doing it the way that theduke says here, and it kinda works, but then medical loot doesnt spawn in the box, 50 satchel charges, 20 landmines and some hand grenades do.

I havent found a fix for this yet.

Yeah I had this problem too, I wanted to know if there was a way of dictating what was in the box in the loot class and then get it too spawn in like said medbox. I would of thought this could be possible as infastar and ai scripts manage it

Link to comment
Share on other sites

  • 0

If you are talking about spawning boxes from infistar/or whatever admin menu you have, go to ah.sqf and look for the class-names that include 'medb0x' and change them to 'USOrdnanceBox'. [Should fix your problem.]

 

 

Sorry in advanced if the classnames are wrong, haven't worked on Arma 2 in awhile. 

Link to comment
Share on other sites

  • 0
18 hours ago, Oblicure said:

If you are talking about spawning boxes from infistar/or whatever admin menu you have, go to ah.sqf and look for the class-names that include 'medb0x' and change them to 'USOrdnanceBox'. [Should fix your problem.]

 

 

Sorry in advanced if the classnames are wrong, haven't worked on Arma 2 in awhile. 

 

No i think he means the problem of medboxes spawn normally in medical places being empty and to fix it you have to revert your game to legacy, and he is trying to change the medbox to a different box so medical stuff spawns in it rather than military stuff

Link to comment
Share on other sites

  • 0
1 hour ago, Pro_Speedy said:

 

No i think he means the problem of medboxes spawn normally in medical places being empty and to fix it you have to revert your game to legacy, and he is trying to change the medbox to a different box so medical stuff spawns in it rather than military stuff

What he said XD

Link to comment
Share on other sites

  • 0

one way to do it would be what I did:

so you dont need to change the loot configfile classnames.

in spawn_loot.sqf search for case object.

Spoiler

   case "object":
    {
        if (_iItem == "MedBox0") then {
            _iItem = "AmmoBoxSmall_556";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\MedBoxSetup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        if (_iItem == "FoodBox0") then {
            _iItem = "AmmoBoxSmall_556";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\FoodBoxSetup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        if (_iItem == "AmmoBoxSmall_556") then {
            _iItem = "AmmoBoxSmall_556";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\556AmmoBoxSetup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        if (_iItem == "AmmoBoxSmall_762") then {
            _iItem = "AmmoBoxSmall_762";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\762AmmoBoxSetup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        if (_iItem == "FoodBox1") then {
            _iItem = "AmmoBoxSmall_762";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\ConBox1Setup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        if (_iItem == "FoodBox2") then {
            _iItem = "AmmoBoxSmall_762";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "custom\boxsetup\ConBox2Setup.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
        if ((count _iPos) > 2) then {
            _item setPosATL _iPos;
        };};};};};};};
    };

 

you can change the _iItem classname to whatever box you want.

here is an example for the 556AmmoBoxSetup.sqf:

Spoiler

private ["_box","_magazines","_count"];
        
_box = _this select 0;

clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearBackpackCargoGlobal _box;

_magazines = ["30Rnd_556x45_Stanag",
             "20Rnd_556x45_Stanag",
             "30Rnd_556x45_StanagSD",
             "30Rnd_556x45_G36",
             "30Rnd_556x45_G36SD",
             "100Rnd_556x45_BetaCMag",
             "20Rnd_762x51_DMR",
             "5Rnd_762x51_M24"];

_count = 8;

for "_x" from 1 to _count do {
    _scount = count _magazines;
    _sSelect = floor(random _sCount);
    _item = _magazines select _sSelect;
    _box addMagazineCargoGlobal [_item,1];
};

_box setVariable ["ObjectID","1",true];
_box setVariable ["permaLoot",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_box];

 

you can literally put in it anything you want.

Link to comment
Share on other sites

  • 0

EPOCH 1.0.5.1 ONLY

So thank you for those who posted here. I took your post and came up with this, IT WORKS

 

1  open your compile.sqf on mission side and find     spawn_loot  =  compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf"; 
and change it to   spawn_loot =    compile preprocessFileLineNumbers "dayz_code\compile\spawn_loot.sqf";
//------------------------------------------------------------------------
2  Make a file called spawn_loot.sqf and save it to a folder in your mission side pbo. I put mine in a folder called dayz_code\compile
paste the following into spawn_loot.sqf and save
//--------------------------start of spawn_loot.sqf----------------------------------------------
private ["_iPos","_tQty","_qty","_index","_weights","_cntWeights","_canType","_item","_magQty","_mags","_item2","_itemTypes","_max","_iItem","_iClass","_radius","_uniq","_iPosZ"];
_iItem = _this select 0;
_iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
_uniq = [];

_item = objNull;

_iPosZ = _iPos select 2;
if((isNil "_iPosZ") || {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
if (isNil "_iClass") exitWith {diag_log "_iClass isNil, exiting loot spawn!";};

switch (_iClass) do {
    default {
        _itemTypes = [];
        if (DZE_MissionLootTable) then {
            {
                _itemTypes set [count _itemTypes, _x select 0]
            } count getArray (missionConfigFile >> "cfgLoot" >> _iClass);
        } else {
            {
                _itemTypes set [count _itemTypes, _x select 0]
            } count getArray (configFile >> "cfgLoot" >> _iClass);
        };
        _qty = 0;
        _max = ceil(random 2) + 1;
        if (_iClass in ["trash","civilian","office","office2","food","generic","medical","hospital","military","militarypilot","policeman","hunter","worker"]) then {
            _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
            while {_qty < _max} do {
                _index = dayz_CLBase find _iClass;
                _weights = dayz_CLChances select _index;
                _cntWeights = count _weights;

                // diag_log ("dayz_CLChances: "+str(dayz_CLChances));

                _index = floor(random _cntWeights);
                _index = _weights select _index;

                //diag_log ("dayz_CLChances: "+str(_itemTypes));
                
                _canType = _itemTypes select _index;
                _tQty = round(random 1) + 1;
                if (_canType in _uniq) then {
                    if (({_x in _uniq} count magazines _item) == 0) then { _tQty = 1; } else { _tQty = 0;};
                    if (_tQty == 0) then {diag_log(format["%1 Prevent any duplicate member %2 from family %3",__FILE__, _canType, _uniq]);};
                };
                if (_tQty > 0) then {
                    if (!(_canType in _uniq)) then {
                        _item addMagazineCargoGlobal [_canType,1];
                        _uniq set [count _uniq, _canType];
                        _qty = _qty + 1;
                    };
                };
            };
            if ((_iItem != "") && (isClass(configFile >> "CfgWeapons" >> _iItem))) then {
                _item addWeaponCargoGlobal [_iItem,1];
            };
        }else{
            // diag_log format["DEBUG dayz_CLBase: %1", dayz_CLBase];
            _index = dayz_CLBase find _iClass;
            if (_index > 0) then {
                _weights = dayz_CLChances select _index;
                //diag_log format["DEBUG dayz_CLChances: %1", dayz_CLChances];
                _cntWeights = count _weights;
                _index = floor(random _cntWeights);
                _index = _weights select _index;
                _item2 = _itemTypes select _index;
                if ((_item2 != "") && (isClass(configFile >> "CfgWeapons" >> _item2))) then{
                    _item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
                    _item addWeaponCargoGlobal[_item2, 1];
                    if ((count _mags) > 0) then{
                        if (_mags select 0 == "20Rnd_556x45_Stanag") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
                        if (_mags select 0 == "30Rnd_556x45_G36") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
                        if (_mags select 0 == "30Rnd_556x45_G36SD") then{ _mags set[0, "30Rnd_556x45_StanagSD"] };
                        if (!(_item2 in MeleeWeapons)) then{
                            _magQty = round(random 10);
                            if (_magQty > 3) then{
                                _item addMagazineCargoGlobal[(_mags select 0), (round(random 1) + 1)];
                            };
                        };
                    };
                };
                if ((_item2 != "") && (isClass(configFile >> "CfgMagazines" >> _item2))) then{
                    _item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
                    _item addMagazineCargoGlobal[_item2, 1];
                };
                if ((_item2 != "") && (isClass(configFile >> "CfgVehicles" >> _item2))) then{
                    _item = createVehicle[_item2, _iPos, [], _radius, "CAN_COLLIDE"];
                };
            };
        };
        
    };
    case "single":
    {
        //Item is sigle, add 1 item from cfgloot
        _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
        _itemTypes = [];
        if (DZE_MissionLootTable) then{
            {
                _itemTypes set[count _itemTypes, _x select 0]
            } count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
        }
        else {
            {
                _itemTypes set[count _itemTypes, _x select 0]
            } count getArray(configFile >> "cfgLoot" >> _iItem);
        };
        _index = dayz_CLBase find _iItem;
        _weights = dayz_CLChances select _index;
        _cntWeights = count _weights;
            
        _index = floor(random _cntWeights);
        _index = _weights select _index;
        _canType = _itemTypes select _index;
        _item addMagazineCargoGlobal [_canType,1];
    };
    case "backpack":
    {
        //Item is single backpack
        _itemTypes = [];
        if (DZE_MissionLootTable) then {
            _itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
        } else {
            _itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
        };
        _index = dayz_CLBase find _iItem;
        _weights = dayz_CLChances select _index;
        _cntWeights = count _weights;
        _index = floor(random _cntWeights);
        _index = _weights select _index;
        _iItem = _itemTypes select _index;

        _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
    };
    case "cfglootweapon":
    {
        _itemTypes = [];
        if (DZE_MissionLootTable) then{
            {
                _itemTypes set[count _itemTypes, _x select 0]
            } count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
        }
        else {
            {
                _itemTypes set[count _itemTypes, _x select 0]
            } count getArray(configFile >> "cfgLoot" >> _iItem);
        };
        _index = dayz_CLBase find _iItem;
        _weights = dayz_CLChances select _index;
        _cntWeights = count _weights;
            
        _index = floor(random _cntWeights);
        _index = _weights select _index;
        _iItem = _itemTypes select _index;

        if (_iItem == "Chainsaw") then {
            _iItem = ["ChainSaw","ChainSawB","ChainSawG","ChainSawP","ChainSawR"] call BIS_fnc_selectRandom;
        };

        //Item is a weapon, add it && a random quantity of magazines
        _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
        _item addWeaponCargoGlobal [_iItem,1];
        _mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
        if ((count _mags) > 0) then
        {
            if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
            if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
            if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
            if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
            _item addMagazineCargoGlobal [(_mags select 0), (round(random 2))];
        };
        
    };
    case "weapon":
    {
        //Item is a weapon, add it && a random quantity of magazines
        _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
        _item addWeaponCargoGlobal [_iItem,1];
        _mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
        if ((count _mags) > 0) then
        {
            if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
            if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
            if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
            if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
            if (!(_iItem in MeleeWeapons)) then {
                _magQty = round(random 10);
                if (_magQty > 3) then {
                    _item addMagazineCargoGlobal [(_mags select 0), (round(random 1) + 1)];
                };
            };
        };
    };
    case "weaponnomags":
    {
        //Item is a weapon, && spawns no mags
        _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
        _item addWeaponCargoGlobal [_iItem,1];
    };
    case "magazine":
    {
        //Item is one magazine
        _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
        _item addMagazineCargoGlobal [_iItem,1];
    };
   case "object":
    {
        if (_iItem == "MedBox0") then {
            _iItem = "AmmoBoxSmall_556";
            _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
            if ((count _iPos) > 2) then {
                _item setPosATL _iPos;
                [_item] execVM "medical_box_fix\med_box_loot.sqf";
                //systemchat format ["spawn_loot debug: Box is %1", _item];
            };
        } else {
        _item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
        if ((count _iPos) > 2) then {
            _item setPosATL _iPos;
            };
        };
    };
};    
if (!isNull(_item)) then{
    if ((count _iPos) > 2) then{
        _item setPosATL _iPos;
    };
};

_item

//--------------------------end of spawn_loot.sqf----------------------------------------------

//--------------------------------------------------------------------------------------------------------

3   Now create a folder on your mission side pbo that is called medical_box_fix.
4   Create a file called med_box_loot.sqf and save it in the folder you just made
5   Copy and paste the following into med_box_loot.sqf and save
//--------------------------------------start of med_box_loot.sqf------------------------------
private ["_box","_magazines","_count"];
        
_box = _this select 0;

clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearBackpackCargoGlobal _box;

_magazines = ["ItemAntibiotic",
             "ItemBandage",
             "ItemBloodbag",
             "ItemEpinephrine",
             "ItemSodaRabbit",
             "ItemMorphine",
             "ItemPainkiller",
             "ItemHeatPack"];

_count = 8;

for "_x" from 1 to _count do {
    _scount = count _magazines;
    _sSelect = floor(random _sCount);
    _item = _magazines select _sSelect;
    _box addMagazineCargoGlobal [_item,1];
};

_box setVariable ["ObjectID","1",true];
_box setVariable ["permaLoot",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_box];
//--------------------------------------end of med_box_loot.sqf------------------------------

Link to comment
Share on other sites

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
  • Discord

×
×
  • Create New...