Jump to content
Sign in to follow this  
bier aig tartar

Have a problem with the store of weapons and magazines

Recommended Posts

Have a problem like that the objects are stored and weapons, magazines.? the Obejekte be saved but not weapons and magazines. What is wrong with this script and who could help me to improve it.

anyObjects.ini standeth in the following.

[Count]

Count="2"

[obj0]

classname="Land_Mil_WallBig_4m_F"

pos="[1780.17,5489.07,5.51338]"

dir="[[0.194919,-0.980819,2.11758e-022],[0,0,1]]"

supplyleft="0"

weapons="[[],[]]"

magazines="[[],[]]"

[obj1]

classname="Land_Mil_WallBig_4m_F"

pos="[1835.82,5604.84,5.52389]"

dir="[[0,1,0],[0,0,1]]"

supplyleft="0"

weapons="[[],[]]"

magazines="[[],[]]"

Here is the script.

sleep 60;

while {true} do {

PersistentDB_ObjCount = 0;

{

_var = _x getVariable "objectLocked";

if(!isNil "_var" && (alive _x)) then {

_classname = typeOf _x;

// addition to check if the classname matches the building parts

if(_classname in objectList) then {

_pos = getPosASL _x;

_dir = [vectorDir _x] + [vectorUp _x];

_supplyleft = 0;

if(_x isKindOf "Land_Sacks_goods_F") then {

_supplyleft = _x getVariable "food";

if(isNil "_supplyleft") then

{

_supplyleft = 20;

};

};

if(_x isKindOf "Land_BarrelWater_F") then {

_supplyleft = _x getVariable "water";

if(isNil "_supplyleft") then

{

_supplyleft = 20;

};

};

_weapons = getWeaponCargo _x;

_magazines = getMagazineCargo _x;

_objSaveName = format["obj%1", PersistentDB_ObjCount];

["Objects" call PDB_databaseNameCompiler, _objSaveName, "classname", _classname] call iniDB_write;

["Objects" call PDB_databaseNameCompiler, _objSaveName, "pos", _pos] call iniDB_write;

["Objects" call PDB_databaseNameCompiler, _objSaveName, "dir", _dir] call iniDB_write;

["Objects" call PDB_databaseNameCompiler, _objSaveName, "supplyleft", _supplyleft] call iniDB_write;

["Objects" call PDB_databaseNameCompiler, _objSaveName, "weapons", _weapons] call iniDB_write;

["Objects" call PDB_databaseNameCompiler, _objSaveName, "magazines", _magazines] call iniDB_write;

PersistentDB_ObjCount = PersistentDB_ObjCount + 1;

};

};

} forEach allMissionObjects "All";

["Objects" call PDB_databaseNameCompiler, "Count", "Count", PersistentDB_ObjCount] call iniDB_write;

diag_log format["GoT Wasteland - baseSaving saved %1 parts to iniDB", PersistentDB_ObjCount];

sleep 120;

};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×