OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: CharlieReddog on 06 Jun 2008, 20:02:10

Title: Get an AI to throw a smoke grenade
Post by: CharlieReddog on 06 Jun 2008, 20:02:10
I've created a smallish ambush mission, but what I'm finding is it's a little too easy to wipe out the enemy. What I'd like is on the firing of a particular trigger (Already set up), the leader of the ambushed squad to throw a smoke grenade. The location being what it is, the direction of the smoke probably doesn't matter, because as soon as it pops it's going to obscure much of the ambush position.

I've tried the following, but nothing seems to work. I have of course equipped the leader (m1) with the
Code: [Select]
this addmagazine "smokeshellred".

Code: [Select]
m1 fire ["smokeshellredmuzzle","smokeshellredmuzzle","smokeshellred"] (this is in Mr Murray's manual.
Code: [Select]
m1 fire ["throw","smokeshellredmuzzle","smokeshellred"]
Code: [Select]
m1 action ["smokeshellredmuzzle","smokeshellredmuzzle","smokeshellred"]
None of the above seem to work. Of course the loon in question has other weapons, do I need to order him to switch weapons or something? ???
Title: Re: Get an AI to throw a smoke grenade
Post by: Planck on 07 Jun 2008, 11:55:24
Ummm, try:

m1 fire ["throw","smokeshellred","smokeshellred"];

I can't try it myself for reasons of hardware failure.   :dry:


Planck
Title: Re: Get an AI to throw a smoke grenade
Post by: CharlieReddog on 07 Jun 2008, 12:28:46
Tried and nope, that's not it. This is annoying! thanks for the help though.
Title: Re: Get an AI to throw a smoke grenade
Post by: Pirin on 08 Jun 2008, 07:12:39
The Domination mission has AI that pops smoke almost every time they are fired at.  Might want to pick that apart to see how they did it.
Title: Re: Get an AI to throw a smoke grenade
Post by: h- on 08 Jun 2008, 12:31:00
This works for me:
Code: [Select]
m1 fire ["SmokeShellRedMuzzle"]
Title: Re: Get an AI to throw a smoke grenade
Post by: Rommel92 on 08 Jun 2008, 15:54:21
The Domination mission has AI that pops smoke almost every time they are fired at.  Might want to pick that apart to see how they did it.

As far as I know, thats a simple createVehicle (camCreate?) or something similiar, no Smoke grenade is "thrown" as such.
Title: Re: Get an AI to throw a smoke grenade
Post by: CharlieReddog on 08 Jun 2008, 18:43:24
I don't get it then. I have set up a radio trigger with m1 fire ["smokeshellred"] as h- suggests, but it doesn't work. What am I doing wrong?
Title: Re: Get an AI to throw a smoke grenade
Post by: Xeno on 08 Jun 2008, 23:58:42
no Smoke grenade is "thrown" as such.

Starting with version 3.0 a smoke grenade is "thrown" as such. The script is even checking each unit in the group for a smokeshell and the unit that has one actually throws it.

Part of the x_dosmoke.sqf script:
Code: [Select]
_one_shell_muzzle = (switch (_one_shell) do {case "SmokeShell": {"SmokeShellMuzzle"};case "SmokeShellRed": {"SmokeShellGreenMuzzle"};case "SmokeShellRed": {"SmokeShellRedMuzzle"};});
_shell_unit selectWeapon _one_shell_muzzle;
sleep 0.121;
if (_shell_unit == _leader) then {
_shell_unit doTarget _killer;
sleep 0.234;
_shell_unit fire _one_shell_muzzle;
} else {
_shell_unit commandTarget _killer;
sleep 0.234;
_shell_unit fire _one_shell_muzzle;
};

And I guess the error that you make is that you don't use the muzzle name.

Xeno
Title: Re: Get an AI to throw a smoke grenade
Post by: CharlieReddog on 10 Jun 2008, 22:24:16
I've edited this for my test mission as follows. I've even made M1 a squad leader which should have the redsmoke shell anyway so nolonger adding a magazine.

Code: [Select]
_shell_unit=M1;
_one_shell_muzzle = "SmokeShellRedMuzzle";
_Killer=P1;
_shell_unit selectWeapon _one_shell_muzzle;
sleep 0.121;
if (_shell_unit == _leader) then {
_shell_unit doTarget _killer;
sleep 0.234;
_shell_unit fire _one_shell_muzzle;
} else {
_shell_unit commandTarget _killer;
sleep 0.234;
_shell_unit fire _one_shell_muzzle;
};

And it still doesn't work. Will someone please just give me the code!!! PLEASE! :dunno:
Title: Re: Get an AI to throw a smoke grenade
Post by: Planck on 11 Jun 2008, 06:21:01
Well according to the comref it takes it as (muzzle, mode, magazine) or (muzzle, mode).

So try it using the appropriate muzzle:

m1 fire ["smokeshellredmuzzle","smokeshellred","smokeshellred"];

or

m1 fire ["smokeshellredmuzzle","smokeshellred"];


Planck
Title: Re: Get an AI to throw a smoke grenade
Post by: Xeno on 13 Jun 2008, 10:13:41
And it still doesn't work. Will someone please just give me the code!!! PLEASE! :dunno:

Code: [Select]
_shell_unit=M1;
_shell_unit addMagazine "SmokeShellRed";
_one_shell_muzzle = "SmokeShellRedMuzzle";
_Killer=P1;
_shell_unit selectWeapon _one_shell_muzzle;
sleep 0.121;

_shell_unit commandTarget _killer;
sleep 0.234;
_shell_unit fire _one_shell_muzzle;

Works fine here. Though the unit needs to have a SmokeShellRed, otherwise it won't work.

Xeno