Jump to content
Sign in to follow this  
MulleDK19

For the devs: Make AIs throw grenades in ARMA 3?

Recommended Posts

The ARMA 2 way doesn't seem to work in ARMA 3.

I've tried at least a dozen different things trying to make AIs throw a smoke grenade.

_unit fire ["SmokeShellMuzzle","SmokeShellMuzzle","SmokeShell"];
_unit fire ["Throw","SmokeShellMuzzle","SmokeShell"];
_unit fire ["SmokeShellMuzzle","SmokeShellMuzzle","SmokeShellGreen"];
_unit fire ["Throw","SmokeShellMuzzle","SmokeShellGreen"];
_unit fire ["SmokeShellMuzzle","SmokeShellGreenMuzzle","SmokeShellGreen"];
_unit fire ["Throw","SmokeShellGreenMuzzle","SmokeShellGreen"];

And a bunch of different combinations with forceWeaponFire and the "UseWeapon" action.

Edited by MulleDK19
code block

Share this post


Link to post
Share on other sites

unit action ["useWeapon", unit, unit, 9]; //weapon index 7 is hand grenade

got my AI to throw his smokegrenade using UseWeapon, so maybe combine that with switchmagazine and you can choose your smoke round.

UseMagazine also seems to let you define what round you are throwing, but its not clear if you have to use the index method shown or can substitute a class name...i dont have a minute to test that yet...

--edit:

Got it, you can use:

https://community.bistudio.com/wiki/magazinesDetail

and

UseMagazine

theres probably an easier way?

Edited by dr_strangepete

Share this post


Link to post
Share on other sites
unit action ["useWeapon", unit, unit, 9]; //weapon index 7 is hand grenade

got my AI to throw his smokegrenade using UseWeapon, so maybe combine that with switchmagazine and you can choose your smoke round.

UseMagazine also seems to let you define what round you are throwing, but its not clear if you have to use the index method shown or can substitute a class name...i dont have a minute to test that yet...

--edit:

Got it, you can use:

https://community.bistudio.com/wiki/magazinesDetail

and

UseMagazine

theres probably an easier way?

Yup, that works, thanks!

Though, it seems kinda stupid to me that magazinesDetail returns an array of strings. Why was it not made to return an array of arrays?

It hurts my head just thinking about having to parse the strings in SQF just to get the ids.

Not to mention the fact that the command returns the display name, not the class name. Hmpf.

I'm gonna make myself a throwGrenade function. Something a la [player, "SmokeShellGreen"] call MTP_fnc_throwGrenade;

Edited by MulleDK19

Share this post


Link to post
Share on other sites

there may infact be a command that gives the answer you want, i just can't find it at the moment, the new commands aren't well documented or integrated into the wiki...this would be a great time for Killzone_Kid to pop-in.......anytime now....hrm.....

Share this post


Link to post
Share on other sites

Already made my function. It works wonderfully.

simply

[ai, "SmokeShell"] call MTP_fnc_throwGrenade;

and the AI throws.

Now I just need to spend a few more minutes to make it throw sub types if the unit doesn't have the specified type.

Share this post


Link to post
Share on other sites

Gday guys,

im going to ask the noobest of noob questions here, but is it at all possible to hold my hand through implementing the function you guys just worked out in like 10 minutes.

ive been struggling with this for a week using what appears to be the old arma2 way of having the ai toss a smoke granade......

player fire ["smokeshellmuzzle","smokeshellmuzzle","smokeshell"];

but i just could never get it to work. If you guys have got it happening can you please, as i asked before, walk me through how to get it to happen.

Ill be so happy ill pour you all bourbons... and drink them for you if i must.

Cheers In Advance

Duane

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
Sign in to follow this  

×