calculatePath: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (example formatting)
(format additional info)
Line 13: Line 13:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Spawns an agent that will execute a AI path calculation and fire the PathCalculated eventhandler. |Description=
| Spawns an agent that will execute an AI path calculation and fire the <tt>"PathCalculated"</tt> [[addEventHandler | event handler]]. The vehicle type to simulate could be one of the following presets:
* <tt>"man"</tt> (will use "C_man_1")
* <tt>"car"</tt> (will use "C_Offroad_01_F")
* <tt>"tank"</tt> (will use "B_MBT_01_cannon_F")
* <tt>"wheeled_APC"</tt> (will use "B_APC_Tracked_01_rcws_F")
* <tt>"boat"</tt> (will use "C_Rubberboat")
* <tt>"plane"</tt> (will use "B_Plane_CAS_01_dynamicLoadout_F")
* <tt>"helicopter"</tt> (will use "B_Heli_Light_01_F")
If the given vehicle type is not one of the above presets, the exact given type is used.
<br><br>
{{Important | In order to guarantee that the event handler is added to the result of this command before the path is calculated, use [[isNil]] workaround:
  [[isNil]] { [[calculatePath]] ["man","safe",[2832.9,5927.79,0],[3107.46,6036.61,0]] [[addEventHandler]] ["PathCalculated", { [[hint]] [[str]] _this }] };
}} |Description=
____________________________________________________________________________________________
____________________________________________________________________________________________


| calculatePath [typeName, behaviour, startCoordinates, endCoordinates] |Syntax=
| [[calculatePath]] [type, behaviour, from, to] |Syntax=


|p1= typeName: [[String]] - Vehicle type to simulate. One of ("helicopter", "plane", "man", "car', "wheeled_APC", "tank", "boat") |Parameter 1=
|p1= [type, behaviour, from, to]: [[Array]] |Parameter 1=
|p2= type: [[String]] - Vehicle type to simulate (see description) |Parameter 2=


|p2= behavior: [[String]] - AI behaviour. one of ("CARELESS", "SAFE", "AWARE", "COMBAT" and "STEALTH") |Parameter 2=
|p3= behavior: [[String]] - AI [[behaviour]], one of ("CARELESS", "SAFE", "AWARE", "COMBAT" and "STEALTH") |Parameter 3=


|p3= startCoordinates: [[Array]] - Start position in [x,y,z] |Parameter 3=
|p4= from: [[Array]] - Start position in format [x,y,z] |Parameter 4=


|p4= endCoordinates: [[Array]] - End position in [x,y,z] |Parameter 4=
|p5= to: [[Array]] - End position in format [x,y,z] |Parameter 5=


| [[Object]] - Agent to add the PathCalculated eventhandler to. |Return Value=
| [[Object]] - An agent to add the <tt>"PathCalculated"</tt> [[addEventHandler | event handler]] to. |Return Value=
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 11:39, 2 July 2019

-wrong parameter ("arma3dev") defined!-[[:Category:Introduced with arma3dev version 1.93|1.93]]
Hover & click on the images for description

Description

Description:
Spawns an agent that will execute an AI path calculation and fire the "PathCalculated" event handler. The vehicle type to simulate could be one of the following presets:
  • "man" (will use "C_man_1")
  • "car" (will use "C_Offroad_01_F")
  • "tank" (will use "B_MBT_01_cannon_F")
  • "wheeled_APC" (will use "B_APC_Tracked_01_rcws_F")
  • "boat" (will use "C_Rubberboat")
  • "plane" (will use "B_Plane_CAS_01_dynamicLoadout_F")
  • "helicopter" (will use "B_Heli_Light_01_F")
If the given vehicle type is not one of the above presets, the exact given type is used.

In order to guarantee that the event handler is added to the result of this command before the path is calculated, use isNil workaround: isNil { calculatePath ["man","safe",[2832.9,5927.79,0],[3107.46,6036.61,0]] addEventHandler ["PathCalculated", { hint str _this }] };
Multiplayer:
-
Groups:
Uncategorised

Syntax

Syntax:
calculatePath [type, behaviour, from, to]
Parameters:
[type, behaviour, from, to]: Array
type: String - Vehicle type to simulate (see description)
behavior: String - AI behaviour, one of ("CARELESS", "SAFE", "AWARE", "COMBAT" and "STEALTH")
from: Array - Start position in format [x,y,z]
to: Array - End position in format [x,y,z]
Return Value:
Object - An agent to add the "PathCalculated" event handler to.

Examples

Example 1:
calculatePath ["car","safe",[2150.67,5778.19,0],[2184.11,5802.28,0]]
Example 2:
Draws the path from South West to North East of Agia Marina:(calculatePath ["man","safe",[2832.9,5927.79,0],[3107.46,6036.61,0]]) addEventHandler ["PathCalculated",{ { _mrk = createMarker ["marker" + str _forEachIndex, _x]; _mrk setMarkerType "mil_dot"; _mrk setMarkerText str _forEachIndex; } forEach (_this#1); }]

Additional Information

See also:
setDriveOnPath

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

[[Category:Introduced with arma3dev version 1.93]][[ Category: arma3dev: New Scripting Commands | CALCULATEPATH]][[ Category: arma3dev: Scripting Commands | CALCULATEPATH]]

Bottom Section