Gem-Editor/Tips & Tricks/Scripting patrols

Let's find out how an "endless walk" or patruille is done ...


 * All you need:


 * At least one unit (a soldier, animal or a crewed vehicle)
 * 3 Waypoints: two of them at the two psitions what the unit should walk and a 3rd at another walk-point or at the same position as one the others
 * The trigger-command actor to waypoit in the category folder other
 * Additionally one or more actor -commands


 * Preparation guide


 * Go to mission editor and mark the controle-field auto-link with a tick by clicking the box
 * Place a waypoint as a patruille point at a reachable position on the map. Do not unselect it!
 * Place a 2nd waypoint as another patruille point at a reachable position on the map. Do not unselect it!
 * Now, a yellow line between the two waypoints should be visible for you
 * Place the 3rd waypoint on the map: (Do not unselect it after!)
 * on a reachable position on the yellow line to give the soldier only 2 points he should patruille
 * on another reachable position on the map to let the soldier patruille this point as well
 * Press the [⁭⁭↑] (shift) -key and hold it while clicking on the first waypoint (it must be the 1st!). Now click on the link -button to connect them.
 * Unselect the waypoint(s) by selecting nothing and go to trigger-menu
 * Now create a new trigger or use an existing one. Add a command. Open the folder other and select the actor to waypoint -command and double-click on it.
 * After the command-properties-window is opened, enter the fields with the folowing values:
 * Selector : Double-click and enter the unit-id (eg. by mid, tag, ...)
 * Waypoint : The number of the waypoint where the patruille-walk should begin
 * All the other options : leave by default

Untill now, the only command a unit gets when it arrives at a waypoint is to go ahead to the next one. But what about giving a unit the command like: "When it arrives at waypoint, it has to become deleted.?
 * How to give a command to a unit when it arrives a waypoint?


 * Select the waypoint where the command should be ordered
 * Under the waypoint-properties at the right you find a box commands like in the trigger -menu, and it works nearly the same with only a few small differences:
 * The selector must be "[W]" (the waypoint, selected as default)
 * Use only command(s) which can be done by the unit who reaches the waypoint (not eg. music or gameover)
 * If you need to set conditions, use the if -item in the generic -folder
 * The commands actor to waypoint or sqaud to waypoint are not very smart in this case because you can set a translation/link (explained above) instead