fireAtTarget: Difference between revisions
Jump to navigation
Jump to search
m (note updated) |
m (note formate) |
||
Line 19: | Line 19: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= < | |x1= <code>_handle = this [[fireAtTarget]] [groundtarget1,"HellfireLauncher"];</code> |= Example 1 | ||
|x2= < | |x2= <code>_handle = Igla_AA_pod_TK_EP1 [[fireAtTarget]] [_helicopter,[[currentWeapon]] Igla_AA_pod_TK_EP1];</code> |= Example 2 | ||
|x3= < | |x3= <code>_handle = Igla_AA_pod_TK_EP1 [[fireAtTarget]] [helicopter];</code> |= Example 3 | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 36: | Line 36: | ||
<dd class="notedate">Posted on Apr 8, 2014 - 16:50 | <dd class="notedate">Posted on Apr 8, 2014 - 16:50 | ||
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | <dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | ||
(A3 1.14) Source vehicle is only limited to manned vehicle while any other types won’t be able to active [[fireAtTarget]] handle, e.g. | |||
<code> | <code> | ||
_handle = _InfantryUnit fireAtTarget [_Infnatrytarget,(weapons _Infantryunit select 0)]; | _handle = _InfantryUnit [[fireAtTarget]] [_Infnatrytarget,([[weapons]] _Infantryunit [[select]] 0)]; | ||
//false & no bullet shoot | //false & no bullet shoot | ||
</code> | </code> | ||
Target has no limitation and can be any object | Target has no limitation and can be any object: | ||
<code> | <code> | ||
_handle = (vehicle _veh) fireAtTarget [ObjNull,(weapons (vehicle _veh) select 0)]; | _handle = ([[vehicle]] _veh) [[fireAtTarget]] [ObjNull,([[weapons]] ([[vehicle]] _veh) [[select]] 0)]; | ||
//true & a bullet shoot | //true & a bullet shoot | ||
</code> | </code> | ||
Handle returns false if weapon class name is inaccurate, e.g. | Handle returns false if weapon class name is inaccurate, e.g. | ||
<code> | <code> | ||
_Handle = (vehicle _veh) fireAtTarget [ObjNull,”UnknownWeapon”]; | _Handle = ([[vehicle]] _veh) [[fireAtTarget]] [ObjNull,”UnknownWeapon”]; | ||
//false & no bullet shoot. | //false & no bullet shoot. | ||
</code> | </code> | ||
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: | ||
<code> | <code> | ||
_weapon = weapons (vehicle _veh) select 0; | _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 | ||
</code> | </code> | ||
Line 81: | Line 81: | ||
| Any object | | Any object | ||
| Normal shoot, won’t aim at target automatically | | Normal shoot, won’t aim at target automatically | ||
| _veh doWatch _target; | | _veh [[doWatch]] _target; | ||
waitUntil {_veh aimedAtTarget [_target] > 0}; | [[waitUntil]] {_veh [[aimedAtTarget]] [_target] > 0}; | ||
_veh fireAtTarget [_target]; | _veh [[fireAtTarget]] [_target]; | ||
|- | |- | ||
Line 91: | Line 91: | ||
| Normal shoot, can change fire mode | | Normal shoot, can change fire mode | ||
| //E.g. unit won't shoot until he is facing the target. | | //E.g. unit won't shoot until he is facing the target. | ||
_unit | _unit [[doWatch]] _tar; | ||
[[waitUntil]] { | |||
_dir = direction _unit; | _dir = [[direction]] _unit; | ||
_relative = [_unit,_tar] call BIS_fnc_relativeDirTo; | _relative = [_unit,_tar] [[call]] [[BIS_fnc_relativeDirTo]]; | ||
if (_dir == _relative) | [[if]] (_dir == _relative) [[exitWith]] { | ||
_unit | _unit [[forceWeaponFire]] [ [[currentWeapon]] _unit,"single"]; | ||
}; | }; | ||
false | [[false]] | ||
}; | }; | ||
Revision as of 15:18, 1 August 2014
Description
- Description:
- Remotely forces a unit to fire the given weapon.
- Groups:
- Uncategorised
Syntax
- Syntax:
- Script = sourceVehicle fireAtTarget [targetVehicle,weaponClassName]
- Parameters:
- sourceVehicle: Object - source vehicle to fire from
- targetVehicle: Object - target vehicle to fire at
- WeaponClassName: String - weapon classname, optional parameter
- Return Value:
- Script - script handle, which can be used to determine (via scriptDone) when the called script has finished.
Examples
- Example 1:
_handle = this fireAtTarget [groundtarget1,"HellfireLauncher"];
- Example 2:
_handle = Igla_AA_pod_TK_EP1 fireAtTarget [_helicopter,currentWeapon Igla_AA_pod_TK_EP1];
- Example 3:
_handle = Igla_AA_pod_TK_EP1 fireAtTarget [helicopter];
Additional Information
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
- Posted on Sep 16, 2010 - 08:17
- Dwarden
- Most likely only for missiles and for interaction with player only.
- Posted on Apr 8, 2014 - 16:50
- ffur2007slx2_5
-
(A3 1.14) Source vehicle is only limited to manned vehicle while any other types won’t be able to active fireAtTarget handle, e.g.
_handle = _InfantryUnit fireAtTarget [_Infnatrytarget,(weapons _Infantryunit select 0)]; //false & no bullet shoot
Target has no limitation and can be any object:_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._Handle = (vehicle _veh) fireAtTarget [ObjNull,”UnknownWeapon”]; //false & no bullet shoot.
Handle still returns true even though the vehicle is unavailable to shoot any bullet:_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 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 _veh doWatch _target; waitUntil {_veh aimedAtTarget [_target] > 0}; _veh fireAtTarget [_target];
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
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.51
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Command Group: Uncategorised
- ArmA 2 OA: New Scripting Commands List
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters