Page MenuHomeFeedback Tracker

Action UseWeapon does not work correctly
New, WishlistPublic

Description

If you use this command, 'unitOne action ["UseWeapon", <target vehicle>, <target unit>, <weapon index>]' the soldier fire, but he does also a strange pick up-animation...

Details

Legacy ID
3359294526
Severity
None
Resolution
Open
Reproducibility
Always
Category
Editor

Event Timeline

papyrabbit08 edited Additional Information. (Show Details)
papyrabbit08 set Category to Editor.
papyrabbit08 set Reproducibility to Always.
papyrabbit08 set Severity to None.
papyrabbit08 set Resolution to Open.
papyrabbit08 set Legacy ID to 3359294526.May 7 2016, 4:44 PM
Bohemia added a subscriber: AD2001.Sep 15 2013, 5:44 PM

Cannot confirm

player action ["useWeapon", player,player,0]

makes player to go into pick up animation while firing his primary weapon.

Really? I've tried all the index number, he only pick up something in the air, but never fire. But I only tried it with another AI, never with the player.
Edit: Ok, it work with the player, even if the pick up animation might be a bug (I think). It still doesn't work for other AI (habitual use)
Edit2: Ok, the AI fires if he's himself the target, but then the animation is still not normal...

I can confirm, I'm trying to get a soldier to use a specific weapon, and I get weapon firing (grenades) and every time a pickup animation which shouldn't be there I believe.

Use gamelogic to perform action on player, not player.

_logic = (createGroup west) createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic action ["useWeapon", player, player, 0]

I tried to use this command to make ai use NLAW, but it doesn't work (even with game logics). I hope this or other way will be created or fixed to have more control over Ai with AT/AA weapons.

@joostSidy did you pass the correct index for the launcher? Also did you try without game logic, would it do pick up animation and fire?

@joostSidy just tested works no problem

  • spawn {

_bob = createGroup west createUnit ["B_soldier_AT_F", position player, [], 0, "none"];
_bob removeWeapon primaryWeapon _bob;
_bob removeWeapon handgunWeapon _bob;
_bob selectWeapon secondaryWeapon _bob;
waitUntil {
animationState _bob == "aidlpercmstpsraswlnrdnon_g01" ||
animationState _bob == "aidlpercmstpsraswlnrdnon_g02"
};
_logic = (createGroup west) createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic action ["useWeapon", _bob, _bob, 0];
deleteVehicle _logic;
};

I did try with and without game logic. The correct index is tricky, so I created a script which tries the command with iteration of index 0-50 with a pause to give the unit some time to go through animations. Unfortunately it didn't work.

At the moment it seems impossible to get a grip on AI use of launchers. I expect actions like useWeapon, switchWeapon or the command selectWeapon to work with launchers, but they don't work.

Control over AT AI is necessary if you want to engage vehicles and soldiers with a squad of infantry. If using only regular ai (scripting nothing), the AT soldiers wait too long or fire the wrong weapon, resulting in the squad getting massacred by enemy vehicle weapons.

Some other methods like specific targeting or selective open/hold fire commands also don't work in this scenario (I've been working for hours on this problem) so I'm thinking about creating a ticket to address this specific problem. The relevant actions/commands are present, but they don't work as expected.

For my specific case I got an acceptable result by temporarily ungrouping the AT soldiers from the main group and then giving them specific commands, but I find this a kind of 'heavy' and possibly AI interfering solution.

Thanks Killzone for a piece of nice code.

Three points:

  • I consider removing weapons also kind of 'heavy coding' and I don't like the look of weapons evaporating when I'm working together with these type of soldiers.
  • It also defeats the purpose of select/use weapon options, this is more like, use the only thing that's left command, still sounds a bit broken.
  • Even though I'm complaining, I like your creative solution :-) BUT it doesn't work at the moment: I tried it with an enemy vehicle nearby and it looks good, but that's also his normal behavior. If you remove immediate target, it won't equip the launcher. Is this the same for you?

AIs are temperamental. I used remove weapons to make sure my AI used launcher because I needed simple working example. No doubt there are other ways to persuade AIs do what you need them to do. However in the past few days I have created 3 tickets all AI related because AI just won't do what it supposed to do no matter what. So at this point I can only wish you good luck :)