• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks or on the Web, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, Slack, and browsed web pages. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.



Page history last edited by davros123 14 years, 3 months ago

Page Contents




Introduction to using vehicles

Introduction to vehicles - Part 1 from davros on Vimeo.

Introduction to vehicles - Part 2 from davros on Vimeo.



Make sure you also have a human AI graph as well as a vehicle AI graph as it appears the game uses both graphs to improve the movement of vehicles.

When you add the vehicle AI graph, (press Ctrl+2) when in the AI-graph layer, you can easily check that all your nodes are connected by looking from "below" the map, ie.



This is the code snippet used in the video....

  1. It activates the vehicle to appear in the game (which was set to "sequence spawn" in the editor).
  2. Orders the car to move to an x y z coordinate on the map.
  3. Starts the trigger which will activate when the vehicle enters the location and unload the vehicle passengers.
           <element type="ActivateVehicle" vehicle_id="panhard01" start_time=".5"/>
           <element type="OrderCar" vehicle_id="panhard01" order="move" position="11757 -3029 366" speed=".6" start_time="1"/>       
           <element type="StartTrigger" name="t_panhard01_unload" preserved="false"/>


        <trigger name="t_panhard01_unload" interval="2.0" preserved="false">
            <condition type="UnitInLocation" location="loc_panhard01_unload" vehicle_id="panhard01" equal="1"/>
            <event name="e_dropoff01"/>

        <event name="e_dropoff01">
            <element type="ExitPassengers" vehicle_id="panhard01" />



Add a Tank

Adding a tank is quite easy.  Just add the tank in the editor ("abrams"), set the vehicle ai path and add the following to your script (assuming you called your tank "tank_01").

<element type="ActivateVehicle" vehicle_id="tank_01" start_time=".5"/>

<element type="MakeAttachable" attach="true" detonate_event="blow_c4" vehicle_id="tank_01" start_time="6.0"/>

<element type="OrderTank" vehicle_id="tank_01" order="move" world_x="your x coordinate" world_y="your y coordinate" speed=".6" start_time="1"/>   


For example...

            <element type="ActivateVehicle" vehicle_id="tank_01" start_time=".5"/>
            <element type="MakeAttachable" attach="true" detonate_event="blow_c4" vehicle_id="tank_01" start_time="6.0"/>
            <element type="OrderTank" vehicle_id="tank_01" order="move" world_x="6561.522" world_y="-8062.5557" speed=".6" start_time="1"/>      


Note that you can also instruct tanks to move to a location as follows... however using XYZ coordinates is more accurate.

<element type=”OrderTank” vehicle_id=”tank_01” order=”move” ai=”true” location=”loc_tank_go_here”/>


Creating a Patroling Tank

Having a tank patrol is very similar to standard movement above.  First, you want to find a clear path for your tank to patrol that has a location where the tank can easily patrol and turn around without obstruction.  Light posts, buildings, roadblocks, etc. can all cause the tanks to veer off course and get caught up, so you need plenty of room for these tanks to maneuver, especially if you need your tanks to turn hard corners.


Assure that your AI Graph for Vehicles covers the entire path you would like your tank to patrol.  In the editor, create your tank (we'll call it 'abram01' for this example) and face it in the direction that you want it to move.  Next, we need to create the patroling path points in which we want our tank to follow and in what order.  You can utilize the "Markers" feature to create a "Target" for where you want your tank to patrol.  Name these targets "tar_abram01_path01" "...path02" or something along thos lines so that it is easier to find in the world.xml.  If your tank triggers other events when it reaches a certain point, you can also just use "Locations" to create a sphere and use these x,y coordinates.


In your mission.xml, create the following for your patrol path for a tank that is going around the block.

<element type = "ActivateVehicle" vehicle_id="abram01" start_time = "0.5"/>

<element type = "MakeAttachable" attach="true" detonate_event="e_des_abram01" vehicle_id="abram01" start_time = "2"/>

<element type="OrderTank" vehicle_id="abram01" ai="true" order="patrol" start_time="5">

     <waypoint position="-3947 -23959 0"/> <!-- these are the 4 "Target Markers" x,y positions that I put in the editor -->

     <waypoint position="-12694 -20684 0"/> <!-- the 'z' coordinate can always be zero (0) -->

     <waypoint position="-11103 -18343 0"/>

     <waypoint position="-4264 -19661 0"/>



In the world.xml file, search for your "Target Marker" names that you put in from the editor.  Patroling uses the x,y coordinates, so translate these x,y coordinates into your mission.xml and create the <waypoint position="x y 0"/> for each of the target markers you created.


Tank Quick Tips

  • Make sure you also have a human AI graph as well as a vehicle AI graph as it appears the game uses both graphs to improve the movement of vehicles.

  • Allow plenty of time between tank activities to assure all activities are done in the specific order.  Especially, if your tank changes sides (neutral -> hostile).  So if your tank is not allowing you to attach C4, add a few more seconds to the start time to make certain that your tank is activated, on the correct side, etc. first.
  • If your Tank or Mule just sits there and does not move, check that:
    • Your tank is activated
    • There is a Vehicle AI Graph {see AI Graph section} that your tank or mule can follow
    • Assure that your Vehicle AI Graph's nodes are all connected to make one large grid and are well spaced. Tanks do not like to turn tight corners.  Any dissconnects and all of your vehicles would be effected.
  • To tag your tank as a part of a mission or objective, use the following code in bold when setting up your Objective:


<element type="Objective" id="obj1" state="add" headline_id="Destroy Abram Tank A" txt_id="Abram_A" waypoint_id="Abram A" vehicle_id="abram01" start_time="1"/>


Additional tips and code snippets on Tanks from Bogie

Although you can use locations to specify where the tank should move, using XYZ coordinates when moving tanks allows you to be precise. If you look at the code for "Escape From Juarez", Bogie created 4 locations then just copied their coordinates to the mission.xml file and use this as waypoints of the tanks movement. The two tanks are initially spawned as inactive, and to prevent them from shooting at the players set to slot 40.


<!-- Start of the mission activation and setslot 40 to make them indestructable barriers>

<element type = "ActivateVehicle" vehicle_id="abram01" start_time = "1"/>

<element type = "ActivateVehicle" vehicle_id="abram02" start_time = "1"/>

<element type = "SetSlot" name_id = "abram01" slot="40" start_time = "3"/>

<element type = "SetSlot" name_id = "abram02" slot="40" start_time = "3"/>


Once all objectives are clear and we are ready for the tanks to get nasty, Bogie resets the tanks to hostile (slot 25), setup the extraction point and send the tanks on their merry destructive ways

<event name = "e_extract">

  <element type = "StopTrigger" name = "t_extract"/>

  <element type="StartTrigger" name="t_objectives_complete" start_time = "1"/>

<element type = "Objective" id="obj_end" state="add" headline_id="Path Cleared... Time to get out of Juarez!" txt_id="Extract" waypoint_id="Extract" waypoint="-3589.6494 -11024.073 300" start_time="8"/>

  <element type = "SetSlot" name_id = "abram01" slot="25" start_time = "0.5"/>

  <element type = "SetSlot" name_id = "abram02" slot="25" start_time = "0.5"/>

  <element type = "MakeAttachable" attach="true" detonate_event="e_destroyed_abram01" vehicle_id="abram01" start_time = "5"/>

  <element type = "MakeAttachable" attach="true" detonate_event="e_destroyed_abram02" vehicle_id="abram02" start_time = "6"/>

  <element type="OrderTank" vehicle_id="abram01" ai="true" order="move" world_x="-3998" world_y="-13381" target="true" start_time="7"/>

  <element type="OrderTank" vehicle_id="abram02" ai="true" order="patrol" start_time="8">

      <waypoint position="-3947.0437 -23959.512 0"/>

      <waypoint position="-12694.534 -20684.738 0"/>

      <waypoint position="-11103.846 -18343.965 0"/>

      <waypoint position="-4264.0674 -19661.992 0"/>






<need to expand this section..>

There are some reference materials in your "Tutorials" directory that came with GRAW2 that can also be beneficial and have some specific information on Helicopters.

The general steps would be to:

- Add your heli in the editor by selecting the vehicles, then [ctrl + 2] to switch to dynamic vehicles. Select the heli that you want and put it in the map

     Apache - Do not use - causes the editor/game to crash.  I suspect that this unit was not finished by GRIN.

     mi28 - Mexican attach heli.  Do not need a crew assigned.  Just spawn the heli and a crew will automatically be created.

     mi28 - Mexican troop transport. Should assign a crew (group="blackhawk_crew"). Used to carry and drop mexican soldiers.

     Blackhawk - Friendly.  Should assign a crew (group="blackhawk_crew").

- Assure that sequence spawn is highlighted and if it is friendly or hostile

- Depending on the type of heli, you may want to add crew and\or passenters (also see Panhard Tutorial) You do not need to activate the crew or passengers.  You need to give the crew/passengers a vehicle_name of the heli. They will automatically activate and appear in the helicopter when you activate the heli.  Do not worry about the patrol path or patrol_type, they are ignored.  You can place the crew/passengers anywhere on the map, it does not matter. As soon as the helicopter is spawned the passenger/crew will appear inside the helicopter (as long as you specify the vehicle_id when the passengers/crew).

           <unit name="group_unit" group="mex_special_forces_patrol4" group_id="mex_heli01" vehicle_id="heli01" crew="false">
                <order order="Patrol" source_pos="9772.6289 2780.7937 1266.5654" order_pos="9772.6289 3280.7937 895.64471" patrol_type="moveguard_recon">
                <position pos_x="9772.6289" pos_y="2780.7937" pos_z="1466.5654"/>
                <rotation yaw="0" pitch="0" roll="0"/>

- In the mission.xml, you will need to:

- Activate your vehicle (Scripting Guide page 31) which is why you selected sequence spawn

           <element type = "ActivateVehicle" vehicle_id = "heli01"/>

- Order your vehicle (Scripting Guide page 50)


 Additional notes on Helicopters



Dav's Helicopter routines...

<DRAFT - instructions need loads of fleshing out and a video as this is advanced stuff! >



This routine makes use of the <xi:include> tag and also the "procedure call like" <xdefine> and @ feature (it actually inserts the code rather than making a procedure call, but if you know coding, you get the idea).

Basically it allows you to define the code once and call it with parameters again and again...this is done when defining gun kits and I think is covered in the GRAW2_Gamemodes.pdf

So, what's the big deal? Well, I have a map with 3 heli insertions of enemy teams and that code looks like this.

@heli_insertion_simple( heli01,loc_heli01,7045,-2376,2600,36543,-39494,12356 )

@heli_insertion_simple( heli02,loc_heli02,12362,-8794,2600,36543,-39494,15356 )

@heli_insertion_simple( heli03,loc_heli03,10128,-5818,3300,36543,-39494,15356 )

To add more heli insertions, I just add another 2 lines. No mess, no fuss, and no risk of stuffing up the coding. Now it's starting to look interesting! I used this on my coop compound map where many of the enemy come in via choppers...hmmmmm... I love the smell of exploding heli's in the morning.

This is a bit complex to explain, but simple to use....so here goes...

towards the top of your mission.xml script, put the following line


    <xi:include href = "heli_actions.xml#xpointer(/to_include/*)"/>


This includes a file called heli_actions.xml into the script. heli_actions.xml has all the "smarts" in it.


Next, include the following line in your script where you want to call in the heli...

       <element type = "TriggerEvent" event = "call_heli_insertion_simple_heli01" start_time = "1"/>


At some point in the script below this trigger, and NOT within any other open tags, insert the following line (ie. just after the </event> tag or </trigger> tag)

This procedure is called simple because the heli just comes in relatively straight and drops off the unit and leaves.  I create a heli in the editor and have it hover in the sky away at the edge of the map, waiting until it's activated and called in.

You also need to create a group of mexicans and assign them to the vehicle id (or name) of the heli.

To use the "heli_insertion_simple" routine, you need to ...

1) have the xdefine script included at the start of you mission.xml script.  I usually put it after the <xi:include tags that are there for common etc.

2) have the following line in your script to create the "customised" instance of the heli insertion script.  I usually put it somewhere after the start mission event script.  You'll need to change the details in this to match the parameters for your map/insertion...ie.  you'll have a different insertion location or name of the unit to drop or co-ordinates to leave to etc etc.

The layout/parameters of this call is as follows........

heli_insertion_simple( heli_name , drop_location, move_to_x_1, move_to_y_1, move_to_z_1, move_to_x_final, move_to_y_final, move_to_z_final, heli_group, heli_group_move_loc_a, heli_group_move_loc_b)

        where heli_insertion_simple = the name of the xdefine script and it has the following parameters passed to it...

heli_name = name of the heli in your world file :) in this case heli01

drop_location = this is used as a trigget location so that when the heli enters this zone, it is detected that it's ready to drop the mexicans. Enter the name of the "trigger" location  you created on the map that you want to drop them at.

I suggest using a tall cylinder for this as the chopper comes in high and then lowers down so you need it tall so that it "runs" into the location and can detect that it is there.

 I use the following for exaple in my world.xml file (note the height of 5000 = 50m)....

 <location name="loc_heli01" shape="cylinder" pos="7045.1563 -2376.9478 363.742" radius="788.4906" height="10000"/>

move_to_x_1,  move_to_y_1, move_to_z_1 = x,y,z co-ordinates to move to... taken from the centre of the drop location in the world file.  You need to make sure the move_to_z_1 is set to the groung level height or the guys will disapear into the ground!

I add 2200, which is 22m to this to form the hover height for the heli. Note that the heli will come in higher than this, (that's what the approach_height function sets) and then drop down to the hover height. This is to try and avoid getting hung up on obsticles.

move_to_x_final, move_to_y_final, move_to_z_final  = x,y,z co-ordinates to move to after droping of the mexicans...I just use the start location of the heli from the world.xml.  It''s then removed after 45 seconds.

heli_group = name of the mexican troops in the helicopter

heli_group_move_loc_a = (Random 50%) option1 of location where the mexican troops should move to

heli_group_move_loc_b = (Random 50%) option2 of location where the mexican troops should move to


An example from one of my scripts looks like this

 @heli_insertion_simple( heli01,loc_heli01,1447,156,1,-35580,-26189,9528,mex_heli01a,loc_zone01,loc_zone02 )

3) You trigger this instance from somewhere in your mission script...ie. from within an event tag as follows (if your heli_name is "heli01")....

<element type = "TriggerEvent" event = "call_heli_insertion_simple_heli01" start_time = "1"/>

         where "call_heli_insertion_simple_heli01" will trigger the insertion by heli01 of your group



Ok, now we just need to create the heli_actions.xml...just download an unzip the following file (heli_actions.xml) into the same folder as your mission.xml.

heli_actions.xml - Download and unzip this script file into the same folder as your mission.xml


Lastly, you'll naturally need to create a heli in the map editor and have it set to sequence spawn and hover in the sky away at the edge of the map, waiting until it's activated and called in. You also need to create a group of mexicans and assign them to the vehicle id (or name) of the heli (they are the ones that drop from the heli).  You do not need to activate the mexicans.  They will automatically activate and appear in the helicopter when you call the script.



Spawns an attack heli to move to an area,  guard it for a set period of time, then leave.

<to be completed>

<element type = "TriggerEvent" event = "call_heli_guard_simple_heli01" start_time = "1"/>

heli_guard_simple( heli_name , guard_x_1, guard_y_1, guard_z_1, move_to_x_final, move_to_y_final, move_to_z_final, heli_duration)



A heli moves in a set path (4 points) - used in coop-compount to circle the compound and provide supporting fire while the ghosts extract.

<to be completed>

heli_patrol( heli_event_name, heli_name , move_loc, move_x_1, move_y_1, move_z_1, next_loc, next_heli_event_name,wait_time)




Comments (0)

You don't have permission to comment on this page.