Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weaponsItemsCargo does not return first aid kits or medikits if ace is loaded #8778

Closed
lawkaita opened this issue Jan 15, 2022 · 5 comments · Fixed by #10401 · May be fixed by #9593
Closed

weaponsItemsCargo does not return first aid kits or medikits if ace is loaded #8778

lawkaita opened this issue Jan 15, 2022 · 5 comments · Fixed by #10401 · May be fixed by #9593
Labels
Milestone

Comments

@lawkaita
Copy link

lawkaita commented Jan 15, 2022

Mods (complete and add to the following information):

  • Arma 3: 2.06 stable
  • CBA: 3.15.6 stable
  • ACE3: 3.14.1 stable

Description:
weaponsItemsCargo does not return medikits or first aid kits if ace is loaded

Steps to reproduce:

Start mission editor, place down a unit, start the game, then in the debug console execute

box = "Box_NATO_Ammo_F" createVehicle (getPos player);
clearMagazineCargo box;
box addWeaponCargo ["FirstAidKit", 1];
box addWeaponCargo ["Medikit", 1];
weaponsItemsCargo box;

The last command will return [].

Expected behavior:
With no mods loaded or only CBA loaded, the last command willl return

[["FirstAidKit","","","",[],[],""],["Medikit","","","",[],[],""]]

Where did the issue occur?
Editor (Singleplayer)

Additional context:
This bug causes CBA_fnc_removeWeaponCargo to delete medikits and first aid kits, since it gets the cargo data with weaponsItemsCargo _container and then does clearWeaponCargoGlobal _container.

@severgun
Copy link
Contributor

This is because of that
https://github.com/acemod/ACE3/blob/master/addons/medical_engine/CfgWeapons.hpp
and here type = 0;
https://github.com/acemod/ACE3/blob/master/addons/medical_treatment/CfgWeapons.hpp
Comment say that this is to hide them from arsenal. In BI arsenal scope = 1; can be used for that, but not in ACE one.

Also to be honest, I don't understand why in vanilla medkit returned as weapon item. This is not a scope, bipod, laser or loaded mag. Maybe CBA function should be fixed somehow?

@LinkIsGrim
Copy link
Contributor

Couldn't scopeArsenal = 0 be used to hide them instead? Also, it's not like the items are hidden in the ACE Arsenal. There's not much reason to hide them in the BIS Arsenal.

@lawkaita
Copy link
Author

For some reason getWeaponCargo will still list the medikits and first aid kits, so anyone trying to use CBA_fnc_removeWeaponCargo can use that as a temporary workaround.

@Dystopian
Copy link
Contributor

type = 0 solution can also break mission config. In editor double-click any vehicle with FAK/Medikit in inventory (e.g. Quadbike), then press OK and then save mission. The object gets mission config like this:

class CustomAttributes {
	class Attribute0 {
		property="ammoBox";
		expression="[_this,_value] call bis_fnc_initAmmoBox;";
		class Value {
			class data {
				singleType="STRING";
				value="[[[[""FirstAidKit""],[4]],[[],[]],[[],[]],[[],[]]],false]";
			};
		};
	};
};

The value attribute has 4 array elements here: [ [["FirstAidKit"],[4]], [[],[]], [[],[]], [[],[]] ] - weapons, magazines, items and backpacks. And FAK is weapon here.

If load such mission with ACE medical and take such FAK from vehicle it won't be converted to ACE medicals.

If load mission without ACE Medical:

  • load cursorObject == 0 while Quadbike has 4 "FAKs" in inventory;
  • you can take such FAK but it won't be combined with normal FAK in player inventory (looks like you have 2 kinds of FAKs). getUnitLoadout player will return FAK as weapon: [[],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",1],[["FirstAidKit","","","",[],[],""],1]]],[],[],"","",[],["","","","","",""]] (["FirstAidKit",1] is normal FAK, the other one is weapon);
  • you can't treat yourself with such FAK.

Source:
\a3\3den\UI\Attributes\AmmoBox.sqf in attributeSave case checks weapon type: getnumber (configfile >> "cfgweapons" >> _class >> "type") in [4096,131072]. If it's true it becomes an item and goes to value array #2 else to value array #0.

On mission start bis_fnc_initAmmoBox does clearweaponcargoglobal _entity; clearitemcargoglobal _entity; first. Then it does addweaponcargoglobal of items in value array #0 and additemcargoglobal of items in value array #2. addWeaponCargoGlobal silently ignores item type and adds it as weapon.

@LinkIsGrim LinkIsGrim mentioned this issue Aug 7, 2023
3 tasks
@m1kesk
Copy link

m1kesk commented Oct 25, 2023

[cursorObject, ["FirstAidKit", "Medikit", "MineDetector", "ToolKit"], false, true] call BIS_fnc_addVirtualItemCargo;

Function does return all objects, but "FirstAidKit" and "Medikit" are missing in cargo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment