Kannst es auch mal hiermit versuchen, da kannst du selber festlegen mit welchen Classnames oder Gegenstandskategorien das Script die Kiste befüllen soll.
PHP-Code:
/* Author: Tajin File: fillbytype.sqf Version: 0.2 Desc: Fills a box/vehicle with Items of the desired SuperClass Syntax: [this,[ #parameters# ] execVM "fillbytype.sqf"; Replace #parameters# with any of the following: Classname only: (this fills in the default number [10] of any type of Pistol) "Pistol" Classname and amount: (this fills in 5 silenced Rook40 Pistols) ["hgun_Rook40_snds_F",5] Classname, amount and Configfile: (this fills in 5 of every type of Backpack) ["Bag_Base",5,"CfgVehicles"] Multiple selections are also possible: ["Pistol",5],["Bag_Base",5,"CfgVehicles"] # The script also adds 10 magazines of every available Magazinetype per Weapon # */
private ["_cfg","_box","_desired","_inherit","_list","_i","_sel","_arr","_dd","_d","_desire","_dcount","_class","_type","_scope","_object","_mags","_x","_kindof","_icon","_dconfig"];
if(!isServer) exitWith {}; _box = _this select 0; _desired = [];
FNC_kindOf = { _inherit = inheritsFrom _this; _list = [configName _this]; while { (configName _inherit) != "" } do { _list set[count _list,configName _inherit]; _inherit = inheritsFrom( _inherit ); }; _list };
switch(typeName (_this select 1)) do { case "ARRAY": { _desired = _this select 1; for "_i" from 0 to (count _desired)-1 do { _sel = _desired select _i; if ( (typeName _sel) == "STRING" ) then { _arr = [_sel,10]; _desired set[_i,_arr]; }; }; break; }; case "STRING": { _desired = [[_this select 1,10]]; break; }; };
clearWeaponCargoGlobal _box; clearMagazineCargoGlobal _box; clearItemCargoGlobal _box; clearBackpackCargoGlobal _box;
diag_log format["Starting: %1", _desired]; for "_d" from 0 to (count _desired)-1 do { _dd = _desired select _d; _desire = _dd select 0; _dcount = _dd select 1; if (count _dd > 2) then { _dconfig = _dd select 2; } else { _dconfig = "CfgWeapons"; }; _cfg = configFile >> _dconfig; for "_i" from 0 to (count _cfg)-1 do { _class = _cfg select _i; if (isClass _class) then { _type = getNumber(_class >> "type"); _scope = getNumber(_class >> "scope"); _icon = getText(_class >> "picture"); if(_scope == 2 && _type != 65536 && _icon != "\A3\Weapons_F\Data\clear_empty.paa") then { _kindof = _class call FNC_kindOf; if ( _desire in _kindof ) then { _object = configName _class; switch (true) do { case ("Bag_Base" in _kindof): { _box addBackpackCargo [_object, _dcount]; }; case ("ItemCore" in _kindof): { _box addItemCargoGlobal [_object, _dcount]; }; default { _box addWeaponCargoGlobal [_object, _dcount]; }; }; diag_log format["%1 added (%2)", _object, _icon]; _mags = getArray(_class >> "magazines"); { _box addMagazineCargoGlobal [_x,_dcount * 10]; diag_log format["Magazines %1 added", _x]; } forEach _mags; }; }; }; }; }; diag_log "finished";
Für Uniformen (5 von jeder Sorte) wäre das z.b:
[this,[ ["Uniform_Base",5] ] execVM "fillbytype.sqf";
( Classnames und deren Hierarchie findest du hier: http://browser.six-projects.net/cfg_...67&commit=Save )
|