BIS fnc unpackStaticWeapon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|PARAMETER1= |p3=" to "|PARAMETER2= |p3=")
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|Comments=
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |Game name=
|gr1= Weapons


|1.00|Game version=
|descr= This function will move given support team to the given weapon position.
____________________________________________________________________________________________
The weapon crew will unpack carried weapon and start watching given target position.
Requires three personnel in the team: Team Leader, Gunner and Asst. Gunner.
This function is MP compatible.<br>
When the weapon is unpacked, the [[Arma 3: Scripted Event Handlers#Events|"StaticWeaponUnpacked"]] scripted EH is called.


| This function will move given support team to the given weapon position. The weapon crew will unpack carried weapon and start watching given target position. Requires three personnel in the team: Team Leader, Gunner and Asst. Gunner. This function is MP compatible.
{{Feature|informative|
<br><br>
If a unit flees, all bets are off and the function will exit leaving units on their own.<br><!--
When weapon is unpacked, scripted EH "StaticWeaponUnpacked" is called with the following params:
-->To guarantee weapon disassembly, make sure the group has maximum courage: <sqf inline>_group allowFleeing 0;</sqf>.
* [group, leader, gunner, assistant, weapon]
}}
<br>
'''NOTE''': If a unit flees, all bets are off and the function will exit leaving units on their own. To guarantee weapon assembly, make sure the group has maximum courage <tt>_group [[allowFleeing]] 0</tt>|DESCRIPTION=
____________________________________________________________________________________________


| [group, weaponPos, targetPos, leaderPos] call [[BIS_fnc_unpackStaticWeapon]]; |SYNTAX=
|s1= [group, weaponPos, targetPos, leaderPos] call [[BIS_fnc_unpackStaticWeapon]]


|p1= group: [[Group]] or [[Object]] - the support team group or a unit from this group |PARAMETER1=
|p1= group: [[Group]] or [[Object]] - the support team group or a unit from this group
|p2= weaponPos: [[Array]], [[String]] or [[Object]] - weapon placement position, object position or marker |PARAMETER2=


|p3= targetPos: [[Array]], [[String]] or [[Object]] - target position, object position to watch or marker |PARAMETER1=
|p2= weaponPos: [[Array]], [[String]] or [[Object]] - weapon placement position, object position or marker
|p4= leaderPos (Optional):  [[Array]], [[String]] or [[Object]] - position, object or marker group leader should move to|PARAMETER1=
| [[Nothing]]|RETURNVALUE=
____________________________________________________________________________________________


|x1= <code>[leader1, "weapon_mrk", "target_mrk"] [[call]] [[BIS_fnc_unpackStaticWeapon]];</code> |=
|p3= targetPos: [[Array]], [[String]] or [[Object]] - target position, object position to watch or marker
|x2= <code>group1 [[allowFleeing]] 0;
[group1, "weapon_mrk", tank1, "leader_mrk"] [[call]] [[BIS_fnc_unpackStaticWeapon]];</code> |=
____________________________________________________________________________________________


| [[BIS_fnc_packStaticWeapon]], [[BIS_fnc_addScriptedEventHandler]]|SEEALSO=
|p4= leaderPos:  [[Array]], [[String]] or [[Object]] - (Optional) position, object or marker group leader should move to


}}
|r1= [[Nothing]]


<h3 style="display:none">Notes</h3>
|x1= <sqf>[leader1, "weapon_mrk", "target_mrk"] call BIS_fnc_unpackStaticWeapon;</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x2= <sqf>
</dl>
group1 allowFleeing 0;
[group1, "weapon_mrk", tank1, "leader_mrk"] call BIS_fnc_unpackStaticWeapon;
</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[BIS_fnc_packStaticWeapon]] [[BIS_fnc_addScriptedEventHandler]]
[[Category:Function Group: Actions|{{uc:unpackStaticWeapon}}]]
}}
[[Category:Functions|{{uc:unpackStaticWeapon}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:unpackStaticWeapon}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Killzone_Kid
<dd class="notedate">Posted on January 6, 2017 - 23:10 (UTC)</dd>
|timestamp= 20170106231000
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|text= The following script will create a group consisting of a Team Leader, Gunner and Asst. Gunner and give the group 2 random MOVE waypoints. After the group reached the 1st waypoint, waypoint statement will execute [[BIS_fnc_unpackStaticWeapon]] and the group will stop and unpack static weapon, while leader is given random position to go to. After 7 seconds the [[BIS_fnc_packStaticWeapon]] is executed and the group packs and heads to 2nd waypoint.
<dd class="note">
<sqf>
The following script will create a group consisting of a Team Leader, Gunner and Asst. Gunner and give the group 2 random MOVE waypoints. After the group reached the 1st waypoint, waypoint statement will execute [[BIS_fnc_unpackStaticWeapon]] and the group will stop and unpack static weapon, while leader is given random position to go to. After 7 seconds the [[BIS_fnc_packStaticWeapon]] is executed and the group packs and heads to 2nd waypoint.
private _group = createGroup west;
<code>[[private]] _group = [[createGroup]] [[west]];
private _pos = player getRelPos [20, 0];
[[private]] _pos = [[player]] [[getRelPos]] [20, 0];
private _randomDir = random 360;
[[private]] _randomDir = [[random]] 360;
private _wp1 = _group addWaypoint [_pos getPos [20, _randomDir], 10];
[[private]] _wp1 = _group [[addWaypoint]] [_pos [[getPos]] [20, _randomDir], 10];
_wp1 setWaypointType "MOVE";
_wp1 [[setWaypointType]] "MOVE";
_wp1 setWaypointStatements ["true", "
_wp1 [[setWaypointStatements]] ["true", "
group this allowFleeing 0;
[[group]] this [[allowFleeing]] 0;
[group this, 'StaticWeaponUnpacked', {
<nowiki>[</nowiki>[[group]] this, 'StaticWeaponUnpacked', {
_this spawn
_this [[spawn]]
{
{
[[sleep]] 7;
sleep 7;
[_this [[select]] 0] [[call]] [[BIS_fnc_packStaticWeapon]];
[_this select 0] call BIS_fnc_packStaticWeapon;
};
};
}] [[call]] [[BIS_fnc_addScriptedEventHandler]];
}] call BIS_fnc_addScriptedEventHandler;
[
[
this,  
this,  
this,  
this,  
this [[getPos]] [1000, [[random]] 360],  
this getPos [1000, random 360],  
this [[getPos]] [10, 0]
this getPos [10, 0]
] [[call]] [[BIS_fnc_unpackStaticWeapon]];
] call BIS_fnc_unpackStaticWeapon;
"];
"];
[[private]] _wp2 = _group [[addWaypoint]] [_pos [[getPos]] [20, _randomDir - 180], 10];
private _wp2 = _group addWaypoint [_pos getPos [20, _randomDir - 180], 10];
_wp2 [[setWaypointType]] "MOVE";
_wp2 setWaypointType "MOVE";
[[private]] _leader = _group [[createUnit]] ["B_Soldier_TL_F", _pos, [], 0, "NONE"];
private _leader = _group createUnit ["B_Soldier_TL_F", _pos, [], 0, "NONE"];
[[private]] _gunner = _group [[createUnit]] ["B_Support_GMG_F", _pos, [], 0, "NONE"];
private _gunner = _group createUnit ["B_Support_GMG_F", _pos, [], 0, "NONE"];
[[private]] _assistant = _group [[createUnit]] ["B_Support_AMG_F", _pos, [], 0, "NONE"];
private _assistant = _group createUnit ["B_Support_AMG_F", _pos, [], 0, "NONE"];
[[units]] _group [[doFollow]] _leader;
units _group doFollow _leader;
</code>
</sqf>
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 00:24, 2 February 2024

Hover & click on the images for description

Description

Description:
This function will move given support team to the given weapon position. The weapon crew will unpack carried weapon and start watching given target position. Requires three personnel in the team: Team Leader, Gunner and Asst. Gunner. This function is MP compatible.
When the weapon is unpacked, the "StaticWeaponUnpacked" scripted EH is called.
If a unit flees, all bets are off and the function will exit leaving units on their own.
To guarantee weapon disassembly, make sure the group has maximum courage: _group allowFleeing 0;.
Execution:
call
Groups:
Weapons

Syntax

Syntax:
[group, weaponPos, targetPos, leaderPos] call BIS_fnc_unpackStaticWeapon
Parameters:
group: Group or Object - the support team group or a unit from this group
weaponPos: Array, String or Object - weapon placement position, object position or marker
targetPos: Array, String or Object - target position, object position to watch or marker
leaderPos: Array, String or Object - (Optional) position, object or marker group leader should move to
Return Value:
Nothing

Examples

Example 1:
[leader1, "weapon_mrk", "target_mrk"] call BIS_fnc_unpackStaticWeapon;
Example 2:
group1 allowFleeing 0; [group1, "weapon_mrk", tank1, "leader_mrk"] call BIS_fnc_unpackStaticWeapon;

Additional Information

See also:
BIS_fnc_packStaticWeapon BIS_fnc_addScriptedEventHandler

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
Killzone_Kid - c
Posted on Jan 06, 2017 - 23:10 (UTC)
The following script will create a group consisting of a Team Leader, Gunner and Asst. Gunner and give the group 2 random MOVE waypoints. After the group reached the 1st waypoint, waypoint statement will execute BIS_fnc_unpackStaticWeapon and the group will stop and unpack static weapon, while leader is given random position to go to. After 7 seconds the BIS_fnc_packStaticWeapon is executed and the group packs and heads to 2nd waypoint.
private _group = createGroup west; private _pos = player getRelPos [20, 0]; private _randomDir = random 360; private _wp1 = _group addWaypoint [_pos getPos [20, _randomDir], 10]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointStatements ["true", " group this allowFleeing 0; [group this, 'StaticWeaponUnpacked', { _this spawn { sleep 7; [_this select 0] call BIS_fnc_packStaticWeapon; }; }] call BIS_fnc_addScriptedEventHandler; [ this, this, this getPos [1000, random 360], this getPos [10, 0] ] call BIS_fnc_unpackStaticWeapon; "]; private _wp2 = _group addWaypoint [_pos getPos [20, _randomDir - 180], 10]; _wp2 setWaypointType "MOVE"; private _leader = _group createUnit ["B_Soldier_TL_F", _pos, [], 0, "NONE"]; private _gunner = _group createUnit ["B_Support_GMG_F", _pos, [], 0, "NONE"]; private _assistant = _group createUnit ["B_Support_AMG_F", _pos, [], 0, "NONE"]; units _group doFollow _leader;