ok thank you very mutch wolfrug
for a script for detect all ammo types in arma gear its ok the script working very well ecepted a dosent count ammo in magazine but its one minor bug and limit of arma.
for a second script i have one error and d'ont understand all things i have add my all binocular item in list of script.
itemcontrol.sqf
// Creates a script!
Bag_SwitchBinocUse =
{
// Script -> _Addweapon is taken from the Use script (see below)
_addweapon = _this select 0;
// Declare variables.
_weap = "";
_itemName = "";
// Checks which binocular is currently occupying the slot, just add all your pieces here! Basically, change _weap = to whatever you're looking for, and _itemname = to the global variable that represents the item in question.
for "_i" from 0 to (count weapons Bag_Inventory_Caller) do
{
if ((weapons Bag_Inventory_Caller (select _i)) == "Binocular") then
{_weap = "Binocular"; _itemName = Bag_Binoculars};
if ((weapons Bag_Inventory_Caller (select _i)) == "LaserDesignator") then
{_weap = "Laserdesignator"; _itemName = Bag_Laserdesignator};
if ((weapons Bag_Inventory_Caller (select _i)) == "gaz_mask") then
{_weap = "gaz_mask"; _itemName = Bag_gaz_mask};
if ((weapons Bag_Inventory_Caller (select _i)) == "firstaid_kit") then
{_weap = "firstaid_kit"; _itemName = Bag_firstaid_kit};
if ((weapons Bag_Inventory_Caller (select _i)) == "lantern") then
{_weap = "lantern"; _itemName = Bag_lantern};
if ((weapons Bag_Inventory_Caller (select _i)) == "head_lamp") then
{_weap = "head_lamp"; _itemName = Bag_head_lamp};
};
// Adds the _itemname (which is an item which should be created in an init file somewhere as a global variable) to the inventory of the caller.
if (_itemName !="") then {[Bag_Inventory_caller, _itemName] call Bag_EasyAdd};
// Removes the weapon found using the code above.
if (_weap !="Binocular") then {Bag_Inventory_Caller removeWeapon _weap};
// Adds the item in question!
Bag_Inventory_Caller addweapon _addweapon;
};
// The new items! Note the new code inside the []'s of the default USE action --> this code is run whenever the item is succesfully used (e.g., consumed). THIS is where you write down the cfg name of the item you want to add whenever this item is used, e.g. "Binocular", "Laserdesignator" etc.
Bag_LaserDesignator=
[
["Laser Designator Case"],
["Laser Designator in your inventory."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Laserdesignator" >> "picture")],
[{[{["LaserDesignator"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
Bag_Binoculars=
[
["Binoculars"],
["Binoculars in your inventory."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Binocular" >> "picture")],
[{[{["Binocular"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
Bag_Gaz_mask=
[
["gaz mask"],
["The gas mask protects the wearer gas biochemical.write on gas mask box manufactured by umbrella corporation."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Gaz_mask" >> "picture")],
[{[{["Gaz_mask"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
Bag_firstaid_kit=
[
["first aid kit"],
["A tough-looking first aid kit that should get you back on your feet if you should get wounded in the line of duty. It contains among other things bandages, sterile dressing, stainless steel scissors, antiseptic cream, stainless splinter forceps and safety pins."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "firstaid_kit" >> "picture")],
[{[{["firstaid_kit"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
Bag_lantern=
[
["Old lantern"],
["The old lantern has hot and enlightens into the dark."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "lantern" >> "picture")],
[{[{["lantern"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
Bag_head_lamp=
[
["head lamp"],
["The Head lamp has one accessories for see into the dark manufactured by umbrella corporation."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "head_lamp" >> "picture")],
[{[{["head_lamp"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 100]
];
I do not know whats add in
_weap = "";
_itemName = "";
and in
if (_itemName !="") then {[Bag_Inventory_caller, _itemName] call Bag_EasyAdd};
i think a error has for this misunderstanding ^^
in itemtemplate.sqf
Item0=
[
["Empty Template"],
["Description field"],
["Item Data 1"],
["Item Data 2"],
["Item Data 3"],
[""],
[{[] spawn Bag_Inventory_Use_Default}],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, 1, 1]
];
Item1 =
[
["Your ammo"],
["An ammo bag, usually contains some of the soldier's ammo. Doesn't contain any clips with more than one round though."],
["Size : 0"],
["Value : 0"],
["Ammo bag"],
["\bagpack\ItemPics\ammobag.paa"],
[{[Player] execvm "\bagpack\ItemActions\magcontrol.sqf"}, "Open"],
[{ctrlSetText [500, "Cannot be moved from your inventory."]}],
[{ctrlSetText [500, "Cannot be moved from your inventory."]}],
[1, 0, 0]
];
Item2 =
[
["Your Gear"],
["An weapon bag, usually contains some of the soldier's weapons and items."],
["Size : 0"],
["Value : 0"],
["Gear bag"],
["\bagpack\ItemPics\gear.paa"],
[{[player] execvm "\bagpack\ItemActions\itemControl.sqf"}, "Open"],
[{ctrlSetText [500, "Cannot be moved from your inventory."]}],
[{ctrlSetText [500, "Cannot be moved from your inventory."]}],
[1, 0, 0]
];