---
name: "fireAtTarget"
type: command
status: ok
groups: ["Unit Control", "Weapons"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/fireAtTarget
revid: 369417
updated: 2024-09-03T18:48:49Z
---

# fireAtTarget

*Command · Unit Control, Weapons · Arma 3 v0.50 · introduced in Arma 2: Operation Arrowhead v1.50*

## Description

Remotely forces a unit to fire the given weapon. See also [BIS_fnc_fire](../functions/BIS_fnc_fire.md).

## Syntax

```sqf
sourceVehicle fireAtTarget [targetVehicle, weaponMuzzleName]
```

**Parameters:**

- `sourceVehicle`: [Object](../topics/Object.md) - source vehicle to fire from
- `targetVehicle`: [Object](../topics/Object.md) - target vehicle to fire at
- `weaponMuzzleName`: [String](../topics/String.md) - (Optional) weapon muzzle classname, optional parameter

**Returns:** [Boolean](../topics/Boolean.md) - [true](../commands/true.md) if fired, [false](../commands/false.md) if not

## Examples

### Example 1

```sqf
_handle = this fireAtTarget [groundtarget1, "HellfireLauncher"];
```

### Example 2

```sqf
_handle = Igla_AA_pod_TK_EP1 fireAtTarget [_helicopter, currentWeapon Igla_AA_pod_TK_EP1];
```

### Example 3

```sqf
_handle = Igla_AA_pod_TK_EP1 fireAtTarget [helicopter];
```

## See also

[fire](../commands/fire.md) · [doFire](../commands/doFire.md) · [commandFire](../commands/commandFire.md) · [canFire](../commands/canFire.md) · [forceWeaponFire](../commands/forceWeaponFire.md) · [commandArtilleryFire](../commands/commandArtilleryFire.md) · [commandSuppressiveFire](../commands/commandSuppressiveFire.md) · [doArtilleryFire](../commands/doArtilleryFire.md) · [doSuppressiveFire](../commands/doSuppressiveFire.md) · [isManualFire](../commands/isManualFire.md) · [aimedAtTarget](../commands/aimedAtTarget.md) · [BIS_fnc_fire](../functions/BIS_fnc_fire.md)

## Community notes

**Dwarden** — 2010-09-16

Most likely only for missiles and for interaction with player only.

---

**ffur2007slx2_5** — 2014-04-08

(Arma 3 1.14) Source vehicle is only limited to manned vehicle while any other types won’t be able to active [fireAtTarget](../commands/fireAtTarget.md) handle, e.g.

```sqf
_handle = _infantryUnit fireAtTarget [_infantryTarget, weapons _infantryUnit select 0];
// false & no bullet shoot
```

Target has no limitation and can be any object:

```sqf
_handle = (vehicle _veh) fireAtTarget [objNull, weapons (vehicle _veh) select 0];
// true & a bullet shoot
```

Handle returns false if weapon class name is inaccurate, e.g.

```sqf
_handle = (vehicle _veh) fireAtTarget [ObjNull, "UnknownWeapon"];
// false & no bullet shoot
```

Handle still returns true even though the vehicle is unavailable to shoot any bullet:

```sqf
_weapon = weapons (vehicle _veh) select 0;
(vehicle _veh) setAmmo [_weapon, 0];
_handle = (vehicle _veh) fireAtTarget [objNull, _weapon];
// true & no bullet shoot
```

#### Difference

| command | Source | Target | Behavior | Workaround templets |
|---|---|---|---|---|
| [fire](../commands/fire.md) | Either unit or manned vehicle | N/A | Fired aiming at air for infantry rifle | Together with [selectWeapon](../commands/selectWeapon.md),<br>suggested to work with "throw","put" weapon type<br>for infantry, or vehicle entity indeed. |
| [fireAtTarget](../commands/fireAtTarget.md) | Manned vehicle only | Any object | Normal shoot, won’t aim at target automatically | ```sqf<br>_veh doWatch _target;<br>waitUntil { _veh aimedAtTarget [_target] > 0 };<br>_veh fireAtTarget [_target];<br>``` |
| [forceWeaponFire](../commands/forceWeaponFire.md) | Either unit or manned aircraft (weapon operator) | N/A | Normal shoot, can change fire mode | ```sqf<br>// e.g. unit won't shoot until he is facing the target<br>_unit doWatch _tar;<br>waitUntil {<br>    _dir = direction _unit;<br>    _relative = [_unit,_tar] call BIS_fnc_relativeDirTo;<br>    if (_dir == _relative) exitWith {<br>        _unit forceWeaponFire [currentWeapon _unit, "single"];<br>    };<br>    false<br>};<br>``` |
| [doFire](../commands/doFire.md) | Unit only | Either unit or vehicle | automatic aiming and shooting | No special example. |
| [commandFire](../commands/commandFire.md) | Unit only | Either unit or vehicle | automatic aiming and shooting | No special example. |
| [action \["UseWeapon"](../topics/Actions.md#useweapon)] | Either unit or manned vehicle | N/A | unexpected behavior | N/A |

<sub>Source: [BI Community Wiki — fireAtTarget](https://community.bistudio.com/wiki/fireAtTarget) (revision 369417).</sub>
