setMarkerPolyline: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|game([0-9]) ?= (.+) \|version([0-9]) ?= (.+) " to "|game$1= $2 |version$3= $4 ")
m (Text replacement - "{{Feature|informative|'''Multiplayer optimisation:''' Global marker commands always broadcast the ''entire'' marker state over the network. As such, the number of network messages exchanged when creating or editing a marker can be reduced by performing all but the last operation using local marker commands, then using a global marker command for the last change (and subsequent global broadcast of all changes applied to the marker).}}" to "{{Feature|informative| '''Multipla...)
 
(8 intermediate revisions by 4 users not shown)
Line 9: Line 9:


|descr= Sets a polyline marker's path.
|descr= Sets a polyline marker's path.
{{Feature|Informative|'''Multiplayer optimisation:''' Global marker commands always broadcast the ''entire'' marker state over the network. As such, the number of network messages exchanged when creating or editing a marker can be reduced by performing all but the last operation using local marker commands, then using a global marker command for the last change (and subsequent global broadcast of all changes applied to the marker).}}
{{Feature|informative|
'''Multiplayer optimisation:''' Global marker commands always broadcast the ''entire'' marker state over the network.
As such, the number of network messages exchanged when creating or editing a marker can be reduced by performing all but the last operation using local marker commands, then using a global marker command for the last change (and subsequent global broadcast of all changes applied to the marker).
}}


|s1= marker [[setMarkerPolyline]] path
|s1= marker [[setMarkerPolyline]] path
Line 15: Line 18:
|p1= marker: [[String]]
|p1= marker: [[String]]


|p2= path: [[Array]] - <tt>[x1, y1, x2, y2, ... xn, yn]</tt>{{Feature|important|Be aware that this command expects an array with a minimum array size of 4 and that the array count always needs to be dividable by 2 and return a whole number.</br>
|p2= path: [[Array]] of pairs [[Number]], [[Number]] - {{hl|[x1, y1, x2, y2, ... xn, yn]}}
Code: {{ic|count '''path''' >{{=}} 4 && count '''path''' [[mod]] 2 [[==]] 0; {{cc|[[true]] → valid path}}}}}}
{{Feature|important|
Be aware that this command expects an array with a minimum array size of 4 and that the array count always needs to be dividable by 2 and return a whole number. Code:
<sqf>count path >= 4 && count path mod 2 == 0; // true → valid path</sqf>
}}


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


|x1= Changes <tt>"marker_1"</tt> into a polyline and draws a sine curve on your position<code>"marker_1" [[setMarkerShape]] "polyline";
|x1= Changes {{hl|"marker_1"}} into a polyline and draws a sine curve on [[player]]'s position:
[[private]] _return = [] ;
<sqf>
// createMarker ["marker_1", [0,0,0]];
"marker_1" setMarkerShape "polyline";
private _return = [] ;


[[for]] "_i" [[from]] 0 [[to]] 100 [[step]] 0.1 do {
for "_i" from 0 to 100 step 0.1 do
_return [[pushBack]] (_i + [[getPos]] [[player]]#0);
{
_return [[pushBack]] ((sin (_i*10))*10 + [[getPos]] [[player]]#1);
_return pushBack (_i + getPosASL player # 0);
_return pushBack ((sin (_i * 10)) * 10 + getPosASL player # 1);
} ;
} ;


"marker_1" [[setMarkerPolyline]] _return;</code>
"marker_1" setMarkerPolyline _return;
</sqf>


|seealso= [[markerPolyline]] [[setMarkerPolylineLocal]]
|seealso= [[markerPolyline]] [[setMarkerPolylineLocal]]
}}
}}

Latest revision as of 21:28, 28 October 2024

Hover & click on the images for description

Description

Description:
Sets a polyline marker's path.
Multiplayer optimisation: Global marker commands always broadcast the entire marker state over the network. As such, the number of network messages exchanged when creating or editing a marker can be reduced by performing all but the last operation using local marker commands, then using a global marker command for the last change (and subsequent global broadcast of all changes applied to the marker).
Groups:
Markers

Syntax

Syntax:
marker setMarkerPolyline path
Parameters:
marker: String
path: Array of pairs Number, Number - [x1, y1, x2, y2, ... xn, yn]
Be aware that this command expects an array with a minimum array size of 4 and that the array count always needs to be dividable by 2 and return a whole number. Code:
count path >= 4 && count path mod 2 == 0; // true → valid path
Return Value:
Nothing

Examples

Example 1:
Changes "marker_1" into a polyline and draws a sine curve on player's position:
// createMarker ["marker_1", [0,0,0]]; "marker_1" setMarkerShape "polyline"; private _return = [] ; for "_i" from 0 to 100 step 0.1 do { _return pushBack (_i + getPosASL player # 0); _return pushBack ((sin (_i * 10)) * 10 + getPosASL player # 1); } ; "marker_1" setMarkerPolyline _return;

Additional Information

See also:
markerPolyline setMarkerPolylineLocal

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