Page MenuHomeFeedback Tracker

Scripted AI Claymore placing - really weird behaviour!
Acknowledged, WishlistPublic

Description

Using command "fire" on AI to place Claymore works just fine until you want to check if claymore is in the inventory before placing it, then it all breaks. After 1 claymore placement all Claymores disappear from Inventory.

Details

Legacy ID
567024517
Severity
None
Resolution
Open
Reproducibility
Always
Category
Inventory
Steps To Reproduce

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.

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Inventory.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Open.
Killzone_Kid set Legacy ID to 567024517.May 7 2016, 6:43 PM
Bohemia added a subscriber: AD2001.Jun 4 2014, 11:02 PM

Bump. For some reason this ticket disappeared from the front page even though made only yesterday.