addWaypoint: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Update for 1.90)
(Add Optional information)
 
(93 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= ofpe
|version1= 1.00


|1.00|= Game version
|game2= arma1
|version2= 1.00


|arg= global |= Arguments in MP
|game3= arma2
|version3= 1.00


|eff= global |= Effects in MP
|game4= arma2oa
____________________________________________________________________________________________
|version4= 1.50


| Adds (or inserts when index is given) a new waypoint to a group.
|game5= tkoh
|version5= 1.00
 
|game6= arma3
|version6= 0.50
 
|arg= global
 
|eff= global
 
|gr1= Waypoints
 
|descr= Adds (or inserts when index is given) a new waypoint to a group.


The waypoint is placed randomly within a circle with the given center and radius.
The waypoint is placed randomly within a circle with the given center and radius.


The function returns a waypoint with format [group, index].<br><br>
{{Feature|informative|For older titles and prior to {{arma3}} v1.90, use [[setWaypointPosition]] if you need exact waypoint placement.}}
{{Informative | Prior to Arma 3 v1.90, if you need exact waypoint placement, use [[setWaypointPosition]]}} |= Description
____________________________________________________________________________________________


| groupName '''addWaypoint''' [center, radius, index, name]|= Syntax
|s1= groupName [[addWaypoint]] [center, radius, index, name]
|p1=  groupName: [[Group]] |= Parameter 1


|p2= center: [[PositionAGL]] or [[Object]] |= Parameter 2
|p1= groupName: [[Group]]


|p3= radius: [[Number]] - random waypoint placement within ''radius'' from ''center'' {{Feature arma3| Since Arma 3 v1.90, -1 may be used for exact waypoint placement}}|= Parameter 3
|p2= center: [[Array]] format [[Position#PositionAGL|PositionAGL]] ([[Position#PositionASL|PositionASL]] if ''radius'' is negative!) or [[Object]]


|p4= index (optional): [[Number]] - can be used to insert a waypoint in between existing waypoints |= Parameter 4
|p3= radius: [[Number]] - random waypoint placement within ''radius'' from ''center''; {{GVI|arma3|1.90|size= 0.75}} -1 can be used for exact waypoint placement


|p5= name (optional): [[String]] - [[waypointName]] |= Parameter 5
|p4= index: [[Number]] - (Optional, default -1) can be used to insert a waypoint in between existing waypoints; if it is invalid, the waypoint will be added at the end


| [[Array]] - format [[Waypoint]] - <nowiki>[</nowiki>[[Group]], ''index''] |= Return value
|p5= name: [[String]] - (Optional, default "") [[waypointName]]
____________________________________________________________________________________________
 
|x1= <code>_wp <nowiki>=</nowiki>_grp [[addWaypoint]] <nowiki>[</nowiki>[[position]] [[player]], 0];</code> |= Example 1
____________________________________________________________________________________________


| [[waypoints]], [[createGuardedPoint]], [[deleteWaypoint]], [[copyWaypoints]], [[move]], [[setCurrentWaypoint]], [[setWaypointBehaviour]], [[setWaypointCombatMode]], [[setWaypointCompletionRadius]], [[setWaypointDescription]], [[setWaypointFormation]], [[setWaypointHousePosition]], [[setWaypointPosition]], [[setWaypointScript]], [[setWaypointSpeed]], [[setWaypointStatements]], [[setWaypointTimeout]], [[setWaypointType]], [[setWaypointVisible]], [[waypointAttachVehicle]], [[waypointAttachedVehicle]], [[setWaypointLoiterRadius]], [[waypointLoiterRadius]], [[setWaypointLoiterType]], [[currentWaypoint]], [[waypointName]], [[waypointSpeed]], [[setWPPos]]
|r1= [[Array]] format [[Waypoint]]
|= See also


}}
|x1= <sqf>_wp = _grp addWaypoint [position player, 0];</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>
<dl class="command_description">
_wp = _grp addWaypoint [position player, 0]; // imprecise, placed like [[setVehiclePosition]]'s "NONE" placement
<!-- Note Section BEGIN -->
_wp setWaypointPosition [getPosASL player, -1]; // from {{ofpe}} to {{arma3}} v1.88
<dd class="notedate">Posted on November 26, 2009
<dt class="note">'''[[User:tijmenjoppe|tijmenjoppe]]'''
<dd class="note">In game versions prior to Arma 3 v1.22:
If you add a waypoint to your group and then want them to start moving to that waypoint, make sure to call [[setWaypointType]] "MOVE" on your waypoint.


<dd class="notedate">Posted on 18:23, 28 April 2011 (CEST)
private _wp = _grp addWaypoint [getPosASL player, -1]; // {{arma3}} v1.90+: precise placement
<dt class="note">'''[[User:Besselinksjm|besselinksjm]]'''
</sqf>
<dd class="note">
In VBS2 1.30, the randomization of addWaypoint doesn't seem to work correctly all of the time.<br>
The alternative syntax of addWaypoint with a specified index doesn't seem to work correctly.
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[waypoints]] [[createGuardedPoint]] [[deleteWaypoint]] [[copyWaypoints]] [[move]] [[setCurrentWaypoint]] [[setWaypointBehaviour]] [[setWaypointCombatMode]] [[setWaypointCompletionRadius]] [[setWaypointDescription]] [[setWaypointHousePosition]] [[setWaypointPosition]] [[currentWaypoint]] [[waypointName]] [[waypointSpeed]] [[setWPPos]]
}}


[[Category:Scripting Commands|ADDWAYPOINT]]
{{Note
[[Category:Scripting Commands OFP Elite |ADDWAYPOINT]]
|user= Tijmenjoppe
[[Category:Scripting Commands ArmA|ADDWAYPOINT]]
|timestamp= 20091126180700
[[Category:Command_Group:_Waypoints|{{uc:{{PAGENAME}}}}]]
|text= In game versions prior to {{arma3}} v1.22:
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
If you add a waypoint to your group and then want them to start moving to that waypoint, make sure to call [[setWaypointType]] "MOVE" on your waypoint.
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Giova
<dd class="notedate">Posted on June 21, 2014 - 20:38 (UTC)</dd>
|timestamp= 20140621223800
<dt class="note">'''[[User:Giova|Giova]]'''</dt>
|text= if you want to create a waypoint of type "MOVE" and set it as actual waypoint, you can use the [[move]] command that does everything for you with only one line of code !<br>
<dd class="note">
Be aware that [[move]] command intercepts multiple waypoints and it will not line up in waypoints queue.
if you want to create a waypoint of type "MOVE" and set it as actual waypoint, you can use the [[move]] command that does everything for you with only one line of code !<br>Be aware that [[move]] command   intercepts multiple waypoints and it will not line up in waypoints queue. In other word it is a quick solution if you want your group to get only one waypoint, but for several waypoints you'll have to use addwaypoint and all setwaypointXXXXXX commands around.<br>see [[move]] command.
In other word it is a quick solution if you want your group to get only one waypoint, but for several waypoints you'll have to use addwaypoint and all setwaypointXXXXXX commands around.<br>see [[move]] command.
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= OdinViking
<dd class="notedate">Posted on August 4, 2014 - 23:49 (UTC)</dd>
|timestamp= 20140805014900
<dt class="note">[[User:ThorViking|ThorViking]]</dt>
|text= The waypoint may not be created exactly at the center position even if radius is zero. The position will be moved away if there are e.g. rocks at the center position or if it is placed at the edge of water on a shore.
<dd class="note">
}}
The waypoint may not be created exactly at the center position even if radius is zero. The position will be moved away if there are e.g. rocks at the center position or if it is placed at the edge of water on a shore.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 13:09, 1 April 2024

Hover & click on the images for description

Description

Description:
Adds (or inserts when index is given) a new waypoint to a group. The waypoint is placed randomly within a circle with the given center and radius.
For older titles and prior to Arma 3 v1.90, use setWaypointPosition if you need exact waypoint placement.
Groups:
Waypoints

Syntax

Syntax:
groupName addWaypoint [center, radius, index, name]
Parameters:
groupName: Group
center: Array format PositionAGL (PositionASL if radius is negative!) or Object
radius: Number - random waypoint placement within radius from center; Arma 3 logo black.png1.90 -1 can be used for exact waypoint placement
index: Number - (Optional, default -1) can be used to insert a waypoint in between existing waypoints; if it is invalid, the waypoint will be added at the end
name: String - (Optional, default "") waypointName
Return Value:
Array format Waypoint

Examples

Example 1:
_wp = _grp addWaypoint [position player, 0];
Example 2:
_wp = _grp addWaypoint [position player, 0]; // imprecise, placed like setVehiclePosition's "NONE" placement _wp setWaypointPosition [getPosASL player, -1]; // from Operation Flashpoint: Elite to Arma 3 v1.88 private _wp = _grp addWaypoint [getPosASL player, -1]; // Arma 3 v1.90+: precise placement

Additional Information

See also:
waypoints createGuardedPoint deleteWaypoint copyWaypoints move setCurrentWaypoint setWaypointBehaviour setWaypointCombatMode setWaypointCompletionRadius setWaypointDescription setWaypointHousePosition setWaypointPosition currentWaypoint waypointName waypointSpeed setWPPos

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
Tijmenjoppe - c
Posted on Nov 26, 2009 - 18:07 (UTC)
In game versions prior to Arma 3 v1.22: If you add a waypoint to your group and then want them to start moving to that waypoint, make sure to call setWaypointType "MOVE" on your waypoint.
Giova - c
Posted on Jun 21, 2014 - 22:38 (UTC)
if you want to create a waypoint of type "MOVE" and set it as actual waypoint, you can use the move command that does everything for you with only one line of code !
Be aware that move command intercepts multiple waypoints and it will not line up in waypoints queue. In other word it is a quick solution if you want your group to get only one waypoint, but for several waypoints you'll have to use addwaypoint and all setwaypointXXXXXX commands around.
see move command.
OdinViking - c
Posted on Aug 05, 2014 - 01:49 (UTC)
The waypoint may not be created exactly at the center position even if radius is zero. The position will be moved away if there are e.g. rocks at the center position or if it is placed at the edge of water on a shore.