Home Editors Depot Missions Depot FAQ COMREF OFPEC Tags Forum

FAQ: Groups Index


How to manipulate groups with script

There are various things you can do to groups using script, most involving their behaviour.
Take a look at the following commands in the COMREF:


Explanation of waypoints

Waypoints (WP) are what make units and groups move and are one of the most powerful tools within the mission editor. Some (e.g. Move, Cycle, Hold) can be put anywhere, others (e.g. Destroy, Get in) work best when placed on an object or vehicle.

  • Move - unit or group will move to this point.
    A note on MOVE (and most other WPs, if not all) WP: If you put the WP on certain buildings (on the map: lighter boxes and select churches) there will be a new box that states what position that unit goes to inside the building. it will be under the "Behaviour" box on the "Insert/Edit Waypoint" menu. It is listed as "Position In House" with a drop box next to it. Most positions are next to windows. But use common sense. A tank can't roll upstairs and hide just inside a window, and a UH-60 can't even begin to squeeze through the front door. So it is for personnel-based units.
  • Destroy - unit or group will move to this point and destroy whatever the waypoint is placed upon. Do not expect units to obey this waypoint if they are incapable of destroying the target (rifleman vs. tank). The waypoint will not be complete until the target is destroyed or if the unit refuses the order.
  • Get in - if placed over a vehicle with extra room, the unit will attempt to board it. If synchronized with a vehicle's waypoint, the vehicle will stop and wait to be boarded. Seek & Destroy - unit or group will move to this point and begin searching for enemies.
  • Join - When synched with another unit's waypoint, this individual will become part of that unit's group.
  • Join & Lead - Same as above, but the individual becomes that group's leader.
  • Get out - unit or group controlling vehicle will disembark.
  • Cycle - very useful waypoint; orders the unit to consider the nearest waypoint its next waypoint, creating a waypoint loop. Good for patrols.
  • Load - vehicle will wait for units to board in cargo.
  • Unload - vehicle will wait for units in cargo to leave vehicle.
  • Transport Unload - vehicle will wait for units which began in vehicle to leave cargo.
  • Hold - unit or group will stay at this position. Only a 'switch' trigger or scripting can move the group from this point.
  • Sentry - The unit will hold position until any member spots an enemy. At that point, the unit will proceed to their new waypoint. If the unit is not set to hold fire, they may engage the enemy on the way.
  • This waypoint works in conjunction with the 'Guarded by' trigger type. The size, axis, activation etc. of the 'Guarded By' trigger has no influence whatsoever on the trigger.

    Basic use
    Place down one or more 'Guarded By' triggers in, for instance, chokepoints or bases. Then place down one or several groups with a single Guard waypoint. The units will unerringly move to the 'Guarded By' triggers, positioning themselves exactly on top of them. They will act according to their normal rules of engagement (Fire at all, engage at will, etc). When a group either starts fleeing or is destroyed, any other groups standing by with a Guard waypoint will move in to take their place. So you can for instance have a single 'Guarded By' trigger in a base, with three or four groups standing by in the forest some distance off; as soon as the group guarding the base gets killed or chased off, ONE of the other groups will start to move in; once that one is destroyed or chased off, another group will start moving etc. thus creating a natural and dynamic system of "counter attack" without the need for extensive scripting.

    Advanced use
    When placing down the 'Guarded By' triggers, it's very important to keep track of the order they are placed. The first trigger created is the most important, the second the second most important etc. If you delete the first one, the second one will become #1 and so forth. So if you're using many, keep track of which you put down first (give them names, for instance). Guard groups move in the following pattern:
    • No triggers - all Guard groups stay at their Guard waypoint.
    • 1 trigger - the Guard group closest to the trigger secures it, the rest stay at their Guard waypoints and wait until the group at the trigger is either killed or considered fleeing, at which point the closest group sets off to guard. The fleeing Guard group generally flees to his original Guard waypoint, where it will stand by until a trigger is free again.
    • 2 or more triggers - the Guard groups closest to each trigger move in to secure it. If the Guard at Trigger #1 is fleeing or destroyed, whichever group is closest will move in to take its place including the guard on Trigger #2 (in which case, another group will move in if available to fill his slot). Basically, the Guards will try their damndest to have a group hovering over each and every trigger at all times, starting from the first one placed and ending with the last.
    I don't know if there's a maximum of 'Guarded By' triggers (I doubt it), but it worked with quite a lot. The most important thing to remember is simply that each trigger has its own importance, and that the one they'll abandon last is #1.
    (Thanks to Wolfrug for this information)
  • Talk - Used in combination with the "effects" button on the bottom of the waypoints screen. If you set the sounds:voice section to a voice, the unit leader will say the given phrase. This waypoint is not a destination, and goes to the next waypoint when the phrase is completely spoken.
  • Scripted - executes the script that is in the "script" box on the bottom of the waypoints screen. You can not use individual script commands, you must refer to an external script file. This waypoint is not a destination, and it is considered complete when the external script reaches its EXIT command.
  • Support - A very useful waypoint; any unit given this waypoint will remain here until another unit calls for support. At this time, the waiting unit will proceed to the location where support was called for. Only medics, ambulances, fuel and ammo supply vehicles can use this waypoint. You can tell medics to board vehicles prior to this WP, and they will drive to the support call.
(Thanks to Northgarden and Frank Sousley for additional information)

How to manipulate waypoints with script

Look at the COMREF for command setWPPos.