Start editor
Create player unit as well as Independent "Explosive Specialist"
Preview
Start debug console and define this function:
KK_fnc_placeClaymoreAI = {
_this playActionNow "PutDown";
_this selectWeapon "DirectionalMineRemoteMuzzle";
_this fire [
"DirectionalMineRemoteMuzzle",
"DirectionalMineRemoteMuzzle",
"ClaymoreDirectionalMine_Remote_Mag"
];
};
Now walk towards Explosive Specialist and point at him. You see option to look in his backpack. Open it, you will see he has 2 Claymores.
Execute this piece of code:
[] spawn {
sleep 1;
cursorTarget call KK_fnc_placeClaymoreAI;
};
You hear beep and Explosive Specialist places 1 Claymore.
Repeat, he places another one
Repeat, no beep, no claymore, he ran out of them. So far so good.
Restart preview
Redefine the function (now with inventory check)
KK_fnc_placeClaymoreAI = {
if ("ClaymoreDirectionalMine_Remote_Mag" in magazines _this) then {
_this playActionNow "PutDown";
_this selectWeapon "DirectionalMineRemoteMuzzle";
_this fire [
"DirectionalMineRemoteMuzzle",
"DirectionalMineRemoteMuzzle",
"ClaymoreDirectionalMine_Remote_Mag"
];
};
};
Note the change (if condition)
Point at the Explosive specialist and execute:
[] spawn {
sleep 1;
cursorTarget call KK_fnc_placeClaymoreAI;
};
He places Claymore. Look in his backpack, no more claymores!!! ??? Execute script again - nope, nothing.
The following all lead to all Claymored disappearing after just 1 run
"ClaymoreDirectionalMine_Remote_Mag" in magazines _this
magazines find "ClaymoreDirectionalMine_Remote_Mag" >= 0
"ClaymoreDirectionalMine_Remote_Mag" in itemsWithMagazines _this
itemsWithMagazines find "ClaymoreDirectionalMine_Remote_Mag" >= 0
{_x == "ClaymoreDirectionalMine_Remote_Mag"} count magazines > 0
etc..
if (true) then {.... however works fine, so this is not the statement, it is the content of it.
As I said very very weird behaviour.