setMissileTargetPos: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame( +[0-9])?|Game [Vv]ersion( +[0-9])?|Game Version \(number surrounded by NO SPACES\)|Arguments in MP|MP[Aa]rg|Multiplayer Arguments( \("local" or "global"\))?|Effects|Execution|Effects...)
m (Fix code)
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command
{{RV|type=command


| arma3
|game1= arma3
 
|version1= 1.92
|1.92
 
|arg=
 
|eff=
 
|serverExec=


|gr1= Object Manipulation
|gr1= Object Manipulation
Line 15: Line 8:
|gr2= Weapons
|gr2= Weapons


| 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.
|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.


| munition [[setMissileTargetPos]] position
|s1= munition [[setMissileTargetPos]] position


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


|p2= position: [[PositionAGL]]  
|p2= position: [[Array]] format [[Position#PositionATL|PositionATL]]  


| [[Nothing]]
|r1= [[Nothing]]


|x1= <code>missile1 [[setMissileTargetPos]] [[unitAimPosition]] tank1;</code>
|x1= <sqf>missile1 setMissileTargetPos unitAimPosition tank1;</sqf>


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


| [[missileTargetPos]] [[setMissileTarget]] [[missileTarget]]
|seealso= [[missileTargetPos]] [[setMissileTarget]] [[missileTarget]]
}}
}}


<dl class="command_description">
{{Note
<!-- BEGIN Note Section -->
|user= Benargee
<!-- For example:
|timestamp= 20200413060400
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
|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.
<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.
private _cfgCount = count (configfile >> "CfgAmmo");
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
private _pasteStr = "";
-->
<!-- END Note Section -->
</dl>


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;
</sqf>
}}


{{GameCategory|arma3|Scripting Commands}}
{{Note
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
|user= Lou Montana
 
|timestamp= 20220812220600
<!-- CONTINUE Notes -->
|text= Tested with a player-controlled AH-99 firing DAGR, a civilian helicopter named {{hl|heli}} above water/land, and the following code:
<dl class="command_description">
<sqf>
<dd class="notedate">Posted on April 13, 2020 - 06:04 (UTC)</dd>
if (!isNil "EH") then
<dt class="note">[[User:benargee|benargee]]</dt>
{
<dd class="note">To get list of compatible missiles with {{Inline code|manualControl}} = 1, use the below script and paste the clipboard results to a text editor.
vehicle player removeEventHandler ["Fired", EH];
<code>cfgCount = [[count]] ([[configfile]] >> "CfgAmmo");
pasteStr = "";
 
[[for]] "_x" [[from]] 0 [[to]] (cfgCount - 1) [[do]] {
_cfg = (configfile >> "CfgAmmo") [[select]] _x;
_ammoClassName = [[configName]] _cfg;
manCtrl = [[getNumber]] (configfile >> "CfgAmmo" >> _ammoClassName >> "manualControl");
[[if]] (manCtrl > 0) [[then]] {
pasteStr = pasteStr + _ammoClassName + [[endl]];
};
};
};
 
EH = vehicle player addEventHandler ["Fired", {
[[copyToClipboard]] pasteStr;</code></dd>
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_missile", "_gunner"];
</dl>
_missile setMissileTargetPos getPosATL heli; // changing here getPosATL / getPosASL / getPos
<!-- DISCONTINUE Notes -->
systemChat str [_missile, missileTarget _missile, missileTargetPos _missile];
}];
</sqf>
}}

Latest revision as of 22:08, 12 August 2022

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

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]; }];