setMissileTargetPos: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game=
|game1= arma3
|version1= 1.92


|1.92|Game Version =(number surrounded by NO SPACES)
|gr1= Object Manipulation


|arg= |Multiplayer Arguments =("local" or "global")
|gr2= Weapons


|eff= |Multiplayer Effects =("local" or "global")
|descr= Sets a guided munition target position.
The munition must have {{hl|manualControl}} config entry to use this command.
The target position has to be inside the missile's configured targeting cone for the command to work.


|exec= |Multiplayer Execution =("server" or empty)
|s1= munition [[setMissileTargetPos]] position
____________________________________________________________________________________________


| Sets a guided munition target position. The munition must have {{Inline code|manualControl}} config to use this command. The target position has to be inside configured missile targeting cone for command to work.|Description=
|p1= munition: [[Object]]
____________________________________________________________________________________________


| munition [[setMissileTargetPos]] position |Syntax=
|p2= position: [[Array]] format [[Position#PositionATL|PositionATL]]


|p1= munition: [[Object]]
|r1= [[Nothing]]


|p2= position: [[PositionAGL]]
|x1= <sqf>missile1 setMissileTargetPos unitAimPosition tank1;</sqf>


| [[Nothing]] |Return Value=
|x2= <sqf>
____________________________________________________________________________________________
private _missile = createVehicle ["M_Scalpel_AT", player modelToWorld [0,0,100], [], 0, "CAN_COLLIDE"];
_missile setMissileTargetPos (player modelToWorld [0,100,0]);
</sqf>


|x1= <code>missile1 [[setMissileTargetPos]] [[unitAimPosition]] tank1;</code> |Example 1=
|seealso= [[missileTargetPos]] [[setMissileTarget]] [[missileTarget]] [[missileState]]
}}


|x2= <code>_missile = [[createVehicle]] ["M_Scalpel_AT",([[player]] [[modelToWorld]] [0,0,100]),[],0,"CAN_COLLIDE"];
{{Note
_missile [[setMissileTargetPos]] ([[player]] [[modelToWorld]] [0,100,0]);</code> |Example 2=
|user= Benargee
____________________________________________________________________________________________
|timestamp= 20200413060400
|text= To get list of compatible missiles with <syntaxhighlight lang="cpp" inline>manualControl = 1</syntaxhighlight>, use the below script and paste the clipboard results to a text editor.
<sqf>
private _cfgCount = count (configfile >> "CfgAmmo");
private _pasteStr = "";


|mp= - |Multiplayer Behaviour=
for "_x" from 0 to (_cfgCount - 1) do {
_cfg = (configFile >> "CfgAmmo") select _x;
_ammoClassName = configName _cfg;
private _manCtrl = getNumber (configFile >> "CfgAmmo" >> _ammoClassName >> "manualControl");
if (_manCtrl > 0) then {
_pasteStr = _pasteStr + _ammoClassName + endl;
};
};


| [[missileTargetPos]] [[setMissileTarget]] [[missileTarget]] |See Also=
copyToClipboard _pasteStr;
</sqf>
}}
}}


<dl class="command_description">
{{Note
<!-- BEGIN Note Section -->
|user= Lou Montana
<!-- For example:
|timestamp= 20220812220600
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
|text= Tested with a player-controlled AH-99 firing DAGR, a civilian helicopter named {{hl|heli}} above water/land, and the following code:
<dt class="note">'''[[User:User Name|User Name]]'''</dt>
<sqf>
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
if (!isNil "EH") then
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
{
-->
vehicle player removeEventHandler ["Fired", EH];
<!-- END Note Section -->
};
</dl>
EH = vehicle player addEventHandler ["Fired", {
 
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_missile", "_gunner"];
<h3 style="display:none">Bottom Section</h3>
_missile setMissileTargetPos getPosATL heli; // changing here getPosATL / getPosASL / getPos
<!-- Appropriate categories go here -->
systemChat str [_missile, missileTarget _missile, missileTargetPos _missile];
 
}];
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
</sqf>
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
}}

Latest revision as of 23:48, 30 June 2024

Hover & click on the images for description

Description

Description:
Sets a guided munition target position. The munition must have manualControl config entry to use this command. The target position has to be inside the missile's configured targeting cone for the command to work.
Groups:
Object ManipulationWeapons

Syntax

Syntax:
munition setMissileTargetPos position
Parameters:
munition: Object
position: Array format PositionATL
Return Value:
Nothing

Examples

Example 1:
missile1 setMissileTargetPos unitAimPosition tank1;
Example 2:
private _missile = createVehicle ["M_Scalpel_AT", player modelToWorld [0,0,100], [], 0, "CAN_COLLIDE"]; _missile setMissileTargetPos (player modelToWorld [0,100,0]);

Additional Information

See also:
missileTargetPos setMissileTarget missileTarget missileState

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
Benargee - c
Posted on Apr 13, 2020 - 06:04 (UTC)
To get list of compatible missiles with manualControl = 1, use the below script and paste the clipboard results to a text editor.
private _cfgCount = count (configfile >> "CfgAmmo"); private _pasteStr = ""; for "_x" from 0 to (_cfgCount - 1) do { _cfg = (configFile >> "CfgAmmo") select _x; _ammoClassName = configName _cfg; private _manCtrl = getNumber (configFile >> "CfgAmmo" >> _ammoClassName >> "manualControl"); if (_manCtrl > 0) then { _pasteStr = _pasteStr + _ammoClassName + endl; }; }; copyToClipboard _pasteStr;
Lou Montana - c
Posted on Aug 12, 2022 - 22:06 (UTC)
Tested with a player-controlled AH-99 firing DAGR, a civilian helicopter named heli above water/land, and the following code:
if (!isNil "EH") then { vehicle player removeEventHandler ["Fired", EH]; }; EH = vehicle player addEventHandler ["Fired", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_missile", "_gunner"]; _missile setMissileTargetPos getPosATL heli; // changing here getPosATL / getPosASL / getPos systemChat str [_missile, missileTarget _missile, missileTargetPos _missile]; }];