Jump to content
beno_83au

Action "DropWeapon" not working with AI now.

Recommended Posts

This used to work (last time I used it was a couple of months ago) but now it doesn't:

_unit action [
	"DropWeapon",
	("GroundWeaponHolder" createVehicle (position _unit)),
	(primaryWeapon _unit)
]; 

_unit will perform the action/drop weapon anim, but the weapon remains in his hands. Obviously, I could just use removeWeapon, but this is more for the aesthetics of it as the player is likely to have eyes on _unit.

 

Has this broken/changed or anything since Eden?

 

edit: Scratch that, I must have changed some things that I forgot about. It used to be a handgun hat was dropped, not primary, so I'll probably just go back to that. But what would stop this working with primary weapons?

Share this post


Link to post
Share on other sites

I think you have to create the weaponHolder before the action, so:

 

_wh = "GroundWeaponHolder" createVehicle (position _unit);

_unit action [ "DropWeapon", _wh, (primaryWeapon _unit) ]; 

 

Should work.

Share this post


Link to post
Share on other sites

Thanks, but I thought the same thing so I tried it on a primaryWeapon and it didn't help.

Share this post


Link to post
Share on other sites

Just tested in the console with global variables and player unit and worked like a charm.

Share this post


Link to post
Share on other sites

Just tested in the console with global variables and player unit and worked like a charm.

 

Alright, well, it's not working for me when using a primary weapon, but works fine with a handgun (even when I too tried it through the console with global variables):

//Equipped with a primary weapon, didn't work:

_holder = "GroundWeaponHolder" createVehicle (position _unit);
_unit action [
	"DropWeapon",
	_holder,
	(primaryWeapon _unit)
];

//Equipped with a handgun, worked:

_holder = "GroundWeaponHolder" createVehicle (position _unit);
_unit action [
	"DropWeapon",
	_holder,
	(handgunWeapon _unit)
];

With a handgun, even when creating the weapon holder within the action command it still works. I don't know what we'd be doing different from each other. I'm rolling the AI with a pistol anyway but I still would like to work out why I can't get it to happen with a primary. I assume it's me, it's usually the OP/me in these cases  :(

Share this post


Link to post
Share on other sites

Neither of the above worked for me.

 

I also tried this, instead of "groundweaponholder" I used "weapon_empty" which seems to work up to a point (riffle), if then try and use it for the handgun the gun just vanishes.

 

All seems a little broken too me.

Share this post


Link to post
Share on other sites

Neither of the above worked for me.

 

All seems a little broken too me.

Hey mate, thanks for the input. At least it's something to keep in the back of my head when I'm trying to do this again in the near future.

Share this post


Link to post
Share on other sites
On 03/02/2017 at 11:27 AM, killzone_kid said:

Here is terrible hack that should work no matter what: https://community.bistudio.com/wiki/Arma_3_Actions#PutWeapon

Ok, so based on what is there now:

_wh = "GroundWeaponHolder_Scripted" createVehicle position player;
player action ["PutWeapon", _wh, currentWeapon player]

This wouldn't work to have an AI drop his handgun (using currentWeapon or handgunWeapon). However, did the example you linked change between now and when you posted this? I know I was looking at a different example that I changed around a bit and got things working anyway. Here's what I have:

e.g. nul = [unit1,handgunWeapon unit1] execVM.....

params ["_unit","_weapon","_groundWeaponHolder"];

_groundWeaponHolder = "GroundWeaponHolder" createVehicle [0,0,0];
_groundWeaponHolder addItemCargo ["None", 1];
_groundWeaponHolder setPos (position _unit);

_unit action ["PutWeapon",_groundWeaponHolder,_weapon];

waitUntil {_weapon in (weaponCargo _groundWeaponHolder)};
clearItemCargo _groundWeaponHolder;

This works, looks a little bit unnatural with launchers but it's not a bad way to go and looks ok with pistols. Without the inclusion of "addItemCargo ["None",1]" my script doesn't work, as I think the holder is deleting due to having nothing in it, and I assume that's why the current example didn't work (although I didn't test it with that line added in).

 

Either way, thanks KK.

Edited by beno_83au
Spelling
  • Like 1

Share this post


Link to post
Share on other sites
Just now, killzone_kid said:


It works if you are on DEV

Ahhh k, i was only on stable, thanks for the clarification. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×