ANY DayZ Map: Cargo Check for Tents, Vehicles, Safes etc.

titan3515

New Member
Cargo Check for Tents & Vehicles
By: titan3515
Unpack your mission.pbo with PBOview (or another PBO unpacker)​
(If you have already overridden your fn_selfactions and compiles sqfs, you can skip the first few steps)​
---Already Overridden Skipp-able Steps Start---​
Copy the compiles.sqf from "dayz_code\init" into your mission.pbo.
In the init.sqf in the mission.pbo replace:
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
with this:​
Code:
call compile preprocessFileLineNumbers "compiles.sqf";

You can use the compiles.sqf to override majority of the files in "dayz_code\compile" folder.​
We are going to use it to override the function "fn_selfAction.sqf" so:​
Copy the fn_selfAction.sqf in "dayz_code\compile" to your mission.pbo
Open the compiles.sqf and find:

Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self

Replace it with:

Code:
fnc_usec_selfActions =        compile preprocessFileLineNumbers "fn_selfActions.sqf";    //Checks which actions for self


---Already Overridden Skipp-able Steps End---​

And then find this inside compiles.sqf:

Code:
eh_zombieInit =    {
    private["_unit","_pos"];
    //_unit =    _this select 0;
    //_pos =        getPosATL _unit;
    //_id = [_pos,_unit] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
};

Right underneath the last line above, insert:​

Code:
vehicle_gear_count = {
    private["_counter"];
    _counter = 0;
    {
        _counter = _counter + _x;
    } forEach _this;
    _counter
};

Now open the fn_SelfActions.sqf in the mission.pbo and find:​
Code:
//flip vehicle
if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
    if (s_player_flipveh  < 0) then {
        s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
    };
} else {
    player removeAction s_player_flipveh;
    s_player_flipveh = -1;
};


Right before the top line above, insert:

Code:
// Cargo Check - by DayZ Epoch
if((_isVehicle or _isTent or (cursorTarget isKindOf "VaultStorage")) and _isAlive and _canDo and !_isMan) then {
    if (s_player_checkGear < 0) then {
        s_player_checkGear = player addAction ["Cargo Check", "cargocheck.sqf",cursorTarget, 1, true, true, "", ""];
    };
} else {
    player removeAction s_player_checkGear;
    s_player_checkGear = -1;
};


Now find:

Code:
//Dog
player removeAction s_player_tamedog;
s_player_tamedog = -1;


And right above that line add:

Code:
//Cargo Check
player removeAction s_player_checkGear;
s_player_checkGear = -1;

This makes sure we don't have the option unless we are looking at vehicles!​
Last but CERTAINLY not least, download the attached cargocheck.sqf and place it into the root directory of your mission pbo!​
Not really sure who to give credit for this to. I kinda ripped the code out of DayZ Epoch. So....Thank You DayZ Epoch!



Couldnt figure out how to upload the cargocheck.sqf . Sorry, im still new at this, but heres the file right here:

Code:
// Cargo Check - by DayZ Epoch
 
private ["_vehicle","_class","_maxMagazines","_maxWeapons","_maxBackpacks","_magazineCount","_weaponsCount","_backpackCount"];
_vehicle = _this select 3;
 
_class = typeOf _vehicle;
 
// Get max magazines count
_maxMagazines =    getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxMagazines");
 
// Get max weapon count
_maxWeapons =    getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxWeapons");
 
// Get max backpack count
_maxBackpacks =    getNumber (configFile >> "CfgVehicles" >> _class >> "transportmaxbackpacks");
 
// Count and show magazines available space
_magazineCount_raw = getMagazineCargo _vehicle;
 
// Count and show weapons available space
_weaponsCount_raw = getWeaponCargo _vehicle;
 
// Count and show backpacks available space
_backpackCount_raw = getBackpackCargo _vehicle;
 
// Count and show magazines available space
_magazineCount = (_magazineCount_raw select 1) call vehicle_gear_count;
 
// Count and show weapons available space
_weaponsCount = (_weaponsCount_raw select 1) call vehicle_gear_count;
 
// Count and show weapons available space
_backpackCount = (_backpackCount_raw select 1) call vehicle_gear_count;
 
TitleText [format[("Magazine %1 / %2 - Weapons %3 / %4 - Backpacks %5 / %6"),_magazineCount,_maxMagazines,_weaponsCount,_maxWeapons,_backpackCount,_maxBackpacks], "PLAIN DOWN"];
 
Back
Top