fireAtTarget: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\{\{Note([^<]*)<code>([^<]*)<\/code>" to "{{Note$1<sqf>$2</sqf>") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 49: | Line 49: | ||
</sqf> | </sqf> | ||
Target has no limitation and can be any object: | Target has no limitation and can be any object: | ||
< | <sqf>_handle = (vehicle _veh) fireAtTarget [ObjNull,(weapons (vehicle _veh) select 0)]; | ||
// true & a bullet shoot | // true & a bullet shoot | ||
</ | </sqf> | ||
Handle returns false if weapon class name is inaccurate, e.g. | Handle returns false if weapon class name is inaccurate, e.g. | ||
< | <sqf>_Handle = (vehicle _veh) fireAtTarget [ObjNull,”UnknownWeapon”]; | ||
// false & no bullet shoot | // false & no bullet shoot | ||
</ | </sqf> | ||
Handle still returns true even though the vehicle is unavailable to shoot any bullet: | 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]; | (vehicle _veh) setAmmo [_weapon,0]; | ||
_Handle = (vehicle _veh) fireAtTarget [ObjNull,_weapon]; | _Handle = (vehicle _veh) fireAtTarget [ObjNull,_weapon]; | ||
// true & no bullet shoot</ | // true & no bullet shoot</sqf> | ||
=== difference === | === difference === | ||
{{{!}} class="wikitable sortable" | {{{!}} class="wikitable sortable" | ||
Line 85: | Line 85: | ||
{{!}} Normal shoot, won’t aim at target automatically | {{!}} Normal shoot, won’t aim at target automatically | ||
{{!}} | {{!}} | ||
< | <sqf> | ||
_veh doWatch _target; | |||
waitUntil { _veh aimedAtTarget [_target] > 0 }; | waitUntil { _veh aimedAtTarget [_target] > 0 }; | ||
_veh fireAtTarget [_target];</ | _veh fireAtTarget [_target]; | ||
</sqf> | |||
{{!}}- | {{!}}- | ||
Line 95: | Line 97: | ||
{{!}} Normal shoot, can change fire mode | {{!}} Normal shoot, can change fire mode | ||
{{!}} | {{!}} | ||
< | <sqf> | ||
// e.g. unit won't shoot until he is facing the target | |||
_unit doWatch _tar; | _unit doWatch _tar; | ||
waitUntil { | waitUntil { | ||
Line 105: | Line 108: | ||
false | false | ||
}; | }; | ||
</ | </sqf> | ||
{{!}}- | {{!}}- | ||
{{!}} [[doFire]] | {{!}} [[doFire]] |
Revision as of 15:33, 13 May 2022
Description
- Description:
- Remotely forces a unit to fire the given weapon. See also BIS_fnc_fire.
- Groups:
- Unit ControlWeapons
Syntax
- Syntax:
- sourceVehicle fireAtTarget [targetVehicle, weaponMuzzleName]
- Parameters:
- sourceVehicle: Object - source vehicle to fire from
- targetVehicle: Object - target vehicle to fire at
- weaponMuzzleName: String - (Optional) weapon muzzle classname, optional parameter
- Return Value:
- Boolean - true if fired, false if not
Examples
- Example 1:
- Example 2:
- Example 3:
Additional Information
- See also:
- fire doFire commandFire canFire forceWeaponFire commandArtilleryFire commandSuppressiveFire doArtilleryFire doSuppressiveFire isManualFire aimedAtTarget BIS_fnc_fire
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
- Posted on Sep 16, 2010 - 08:17 (UTC)
- Most likely only for missiles and for interaction with player only.
- Posted on Apr 08, 2014 - 16:50 (UTC)
-
(Arma 3 1.14) Source vehicle is only limited to manned vehicle while any other types won’t be able to active fireAtTarget handle, e.g.
Target has no limitation and can be any object:Handle returns false if weapon class name is inaccurate, e.g. Handle still returns true even though the vehicle is unavailable to shoot any bullet:difference
command Source Target Behavior Workaround templets fire Either unit or manned vehicle N/A Fired aiming at air for infantry rifle Together with selectWeapon, suggested to work with "throw","put" weapon type for infantry, or vehicle entity indeed.
fireAtTarget Manned vehicle only Any object Normal shoot, won’t aim at target automatically forceWeaponFire Either unit or manned aircraft (weapon operator) N/A Normal shoot, can change fire mode // e.g. unit won't shoot until he is facing the target _unit doWatch _tar; waitUntil { _dir = direction _unit; _relative = [_unit,_tar] call BIS_fnc_relativeDirTo; if (_dir == _relative) exitWith { _unit forceWeaponFire [currentWeapon _unit, "single"]; }; false };doFire Unit only Either unit or vehicle automatic aiming and shooting No special example. commandFire Unit only Either unit or vehicle automatic aiming and shooting No special example. action ["UseWeapon"] Either unit or manned vehicle N/A unexpected behavior N/A
Categories:
- Pages with SQF errors
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.50
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Unit Control
- Command Group: Weapons