BIS fnc fire: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (fixed game version)
m (template:command argument fix)
Line 16: Line 16:
<br><br>The function can be used to fire pretty much any muzzle on unit or vehicle from anywhere. Available weapons could usually be found with [[weapons]], [[weaponsTurret]] and [[allTurrets]] commands. See examples below for possible use.
<br><br>The function can be used to fire pretty much any muzzle on unit or vehicle from anywhere. Available weapons could usually be found with [[weapons]], [[weaponsTurret]] and [[allTurrets]] commands. See examples below for possible use.


<br><br>Known issues: unit will not fire its weapon from FFV position. This is due to [[forceWeaponFire]] command ignoring units in FFV.|= Description
<br><br>Known issues: unit will not fire its weapon from FFV position. This is due to [[forceWeaponFire]] command ignoring units in FFV.|DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [entity, muzzle, turret] call [[BIS_fnc_fire]] |= Syntax
| [entity, muzzle, turret] call [[BIS_fnc_fire]] |SYNTAX=
|p1= entity: [[Object]] - unit or vehicle|= Parameter 1
|p1= entity: [[Object]] - unit or vehicle|= Parameter 1
|p2= muzzle: [[String]] -  muzzle name of the muzzle to fire|= Parameter 2
|p2= muzzle: [[String]] -  muzzle name of the muzzle to fire|= Parameter 2
Line 28: Line 28:
* non-existing muzzle
* non-existing muzzle
* the muzzle is on weapon that is not selected
* the muzzle is on weapon that is not selected
* the weapon has no unit operating it |= Return value
* the weapon has no unit operating it |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 55: Line 55:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[fire]], [[fireAtTarget]], [[forceWeaponFire]]|= See also
| [[fire]], [[fireAtTarget]], [[forceWeaponFire]]|SEEALSO=


}}
}}

Revision as of 12:28, 7 April 2019


Hover & click on the images for description

Description

Description:
Makes a unit or a vehicle fire given muzzle. Make sure that there is some ammo to fire, and, in case of a unit, the weapon with given muzzle is already selected. The function is global, so please do not put it in unit or vehicle init.

The function can be used to fire pretty much any muzzle on unit or vehicle from anywhere. Available weapons could usually be found with weapons, weaponsTurret and allTurrets commands. See examples below for possible use.

Known issues: unit will not fire its weapon from FFV position. This is due to forceWeaponFire command ignoring units in FFV.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[entity, muzzle, turret] call BIS_fnc_fire
Parameters:
entity: Object - unit or vehicle
muzzle: String - muzzle name of the muzzle to fire
turret (Optional): Array - turret path of the turret with given muzzle (vehicles only)
Return Value:
Boolean - in SP and on hosted server in MP or Nothing on client in MP. When boolean, true if all checks have passed and muzzle should have fired, false if there was a problem, for example:
  • no ammo
  • non-existing muzzle
  • the muzzle is on weapon that is not selected
  • the weapon has no unit operating it

Examples

Example 1:
marshall = "B_APC_Wheeled_01_cannon_F" createVehicle position player; createVehicleCrew marshall; [marshall, "HE"] call BIS_fnc_fire; // fires HE muzzle of the main cannon [marshall, "AP"] call BIS_fnc_fire; // fires AP muzzle of the main cannon [marshall, "autocannon_40mm_CTWS"] call BIS_fnc_fire; // fires HE muzzle, because it is default [marshall, "LMG_M200_body"] call BIS_fnc_fire; // fires machine gun [marshall, "SmokeLauncher"] call BIS_fnc_fire; // fires smoke launcher [marshall, "TruckHorn"] call BIS_fnc_fire; // beeps the horn
Example 2:
[bob, "SmokeShellMuzzle"] call BIS_fnc_fire; // bob throws smoke grenade, if he has one [bob, "HandGrenadeMuzzle"] call BIS_fnc_fire; // bob throws hand grenade, if he has one
Example 3:
blackfoot = "B_Heli_Attack_01_dynamicLoadout_F" createVehicle position player; createVehicleCrew blackfoot; [blackfoot, "missiles_DAGR"] call BIS_fnc_fire; // fires missiles [blackfoot, "missiles_ASRAAM"] call BIS_fnc_fire; // fires missiles [blackfoot, "gatling_20mm"] call BIS_fnc_fire; // fires machine gun [blackfoot, "CMFlareLauncher"] call BIS_fnc_fire; // fires chaff
Example 4:
[vehicle mortargunner, "mortar_82mm"] call BIS_fnc_fire; // mortargunner fires mortar

Additional Information

See also:
firefireAtTargetforceWeaponFire

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section