Mines


 

Anti-Personnel Mines   

 


 

In order to make mines work in GRAW2, I needed to create a new static prop.  The new prop is called dav_mine.

A "prop" is an object in the GRAW editor (for example, a wall is a static prop). In this case, the prop is a mine.  It is based upon (and looks just like) the existing static prop called "at_mine".  However the problem with the at_mine static prop is that it could not be triggered to explode when a person walks over it.  It will also explode when shot on the trigger mechanism, ( the 3 prongs), or exploded with a grenade or other explosion nearby. From the code I belive it will only explode when a vehicle moves over it - though I have not tested this feature.

 


Landmines in GRAW2...now working! from davros on Vimeo.


now with sound effect from davros123 on Vimeo.

 


 

Download the mines mod from here.

To do this you need to click here to download this file and place the 4 files into your data directory.

The files are as follows...

<graw2>\data\units\props\u_dav_mine.xml

<graw2>data\objects\props\dav_mine\dav_mine.diesel

<graw2>data\objects\props\dav_mine\dav_mine.xml

<graw2>data\objects\props\dav_mine\materials.xml

 

Making the mine name unique to your mission to avaoid conflicts

You'll need to make some changes to these files to prevent any conflicts with other people also using mines in thir missions.  Let's say your mission is called "sanctuary", (note: Bogie has already used this name so don't name your mission this!)

 

To make the mines work for your mission and not conflict with any other bundles, do the following steps....

1) rename "u_dav_mine.xml" to "u_dav_mine_sanctuary.xml"

2) Change it's contents to match the following bold text, note the new prop name.

     <units>
          <unit type="prop" name="dav_mine_sanctuary" slot="13">
               <network sync="bodies" />
              <model file="\props\dav_mine_sanctuary\dav_mine.xml"/>
               <script_class name="base" class="Base"/>
               <script_class name="damage" class="DamageSystem"/>
               <stats block="base_data">
               </stats>
               <xi:include href="/data/units/mass.xml#xpointer(/mass/mass_object_large/*)"/>
               </unit>
     </units>

3) change the prop directory name from "data\objects\props\dav_mine\" to "data\objects\props\dav_mine_sanctuary\" 

4) change the directory path in your dav_mine_sanctuary.xml to reflect the new path

<diesel file="/data/objects/props/dav_mine/dav_mine.diesel" orientation_object="align" materials="/data/objects/props/dav_mine/materials.xml"/>

changes to....

<diesel file="/data/objects/props/dav_mine_sanctuary/dav_mine.diesel" orientation_object="align" materials="/data/objects/props/dav_mine_sanctuary/materials.xml"/>

Done! Now you'll have :

<graw2>\data\units\props\u_dav_mine_sanctuary.xml   <--- and updated the .xml as per step 2.

<graw2>data\objects\props\dav_mine_sanctuary\dav_mine.diesel

<graw2>data\objects\props\dav_mine_sanctuary\dav_mine.xml <--- and updated the .xml as per step 4.

<graw2>data\objects\props\dav_mine_sanctuary\materials.xml

 

Make sure you include these files when you bundle your mission for testing and release.

 

You can now open up your mission in the graw editor.

 

Placing them in the editor

The new anti-personnel mine prop is called dav_mine_<whatever-you-named-it> and, once set up, appears in the small static porps list in the eitor (press Control-2 in the editoe to see the small static props list). You can easily find it in the list of props by typing dav in the mask and pressing enter as shown in the following image.

 

To set up a mine, you need to

I suggest that you also use control-downarrow to lower it such that just the top of the mine is showing above ground level.  

Subsequent mines will have a name of mine_02, mine_03 etc...

The location must be named "loc_mine_01". Subsequent mines will have a location name of loc_mine_02, loc_mine_03 etc...

 

How to use anti-personnel mines in your mission.

The first step is to download and place the mines_routine.xml in your mission folder (ie. same folder where you have your mission.xml). this is a script I have written to make it easier and cleaner to use mines.

 

The final step is to set up the mine in your missoin.xml. Create the following entries in your mission.xml.

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

@setup_mine( 01 )

Note :This line must appear OUTSIDE of other tags (ie. NOT inside an <event>...</event> tag. THIS IS IMPORTANT). Subsequent mines will require additional lines ie..@setup_mine( 02 ).... @setup_mine( 03 ) etc...

 

         <element type = "TriggerEvent" event = "e_arm_mine_01" start_time = "0"/>

 

         <element type = "TriggerEvent" event = "e_disarm_mine_01" start_time = "0"/>

 

I have included a sample mission file with the above commands used to setup and trigger mines.

Download it by clicking here.

 

 

Note the mines will kill anyone within a 7 meter radius.


Randomising the location of mines

 

Let's say you have one mine, but want to have it spawn randomly in four different places, so every time you play the game, you don't know there it is!

The following script will create a mine on your map from within your mission.xml.

The commented out text is from the world.xml and shows the location we want our mine.  To get the location coordinates, I placed the mine where I wanted it using the editor, then went to the world.xml and removed the unit (ie. cut out the above greyed out text), and added the "CreateUnit" command to my mission.xml.   This created the mine in the desired location (x,y,z coordinates). I then used CentreLocation to move the "trigger" location (loc_mine_01) onto the mine.

<element type="CreateUnit" unit="dav_mine"  name_id="mine_01" pos="-3942.8521 12645.541 -2383.4531"  yaw_pitch_roll="0 0 0" />
<!--            <unit name="dav_mine" unit_id="7858" name_id="mine_01" cover_off="false">
                <position pos_x="-3942.8521" pos_y="12645.541" pos_z="-2383.4531"/>
                <rotation yaw="0" pitch="0" roll="0"/>
            </unit>-->

<element type = "CenterLocation" location = "loc_mine_01"  position = "-3942.8521 12645.541 -2383.4531" />
<element type = "TriggerEvent" event = "e_arm_mine_01" start_time = "0"/>
....

All you need to do to randomise this is to have 4 events which place the mines in diff. x,y,z coordinates and trigger them by the following "random" command. The 4 events would be called e_mine_01_loc_a ...e_mine_01_loc_d.


<element type="TriggerRandomEvent" event1="e_mine_01_loc_a" chance1="25" event2="e_mine_01_loc_b" chance2="50" event3="e_mine_01_loc_c" chance3="75" event4="e_mine_01_loc_d" chance4="100" start_time = "8"/>

 

And finally, create the 4 events for e_mine_01_loc_a, e_mine_01_loc_b, e_mine_01_loc_c, e_mine_01_loc_d

<event name="e_mine_01_loc_a">
<element type="CreateUnit" unit="dav_mine"  name_id="mine_01" pos="-3942.8521 12645.541 -2383.4531"  yaw_pitch_roll="0 0 0" />
<element type = "CenterLocation" location = "loc_mine_01"  position = "-3942.8521 12645.541 -2383.4531" />
<element type = "TriggerEvent" event = "e_arm_mine_01" start_time = "0"/>
</event>

....

 

 


 

Technical details of the mod. and what it all means...

Much more to add here about the structure of the unit files etc...but for now, what I basically did was take a copy of the existing unit (at_mine) and rename it to dav_mine and change the dav_mine.xml to include the sequence tag.  This tag is the one called by the UnitSequence command in the mines_routine.xml (<element type = "UnitSequence" name_id="mine_$mine_number"/>).  It's what causes the mine to explode.  This should be doable for any unit - though I am yet to test it with other units.

 

range : all the object in this range shall be given damage. Its counted in radie so 700 will meen a sphere with 7m radie from the position. ie. 14m circumference.

 

<more to go in here>