Mortar Mod

Did you ever pass a mortar in a map and wish you could use it? Well today is your lucky day because :Uk-HaS:Robinson has created the perfect...


Do not refresh or leave this page!

File Description

Did you ever pass a mortar in a map and wish you could use it? Well today is your lucky day because :Uk-HaS:Robinson has created the perfect mod for you. See a mortar in a map? Go up to it and press your use key. The mortar then primes, loads, and fires itself and then lands with an explosive bang at a random target area which can be defined in the scripting. The author has even made an easy to use tutorial in his readme below, so you can add mortars yourself to maps you have created. Honestly, this looks like a great mod to me, and I would really recommend to give this try. :thumbsup:


Read More

COD2 Mortar Script
Author: :Uk-HaS:Robinson

(codfiles username: Pedro699)
Version: 1.0
Build Time: 6 days

Contents of file

- readme.txt (please use the included readme.txt file, not the one on CODfiles, as you will get script errors when copying code.
- z_cl_mort.iwd (client file - must be downloaded)
- z_svr_mort.iwd (server-side file)
- mortarpoints.jpg
- demopic.jpg
- 5 ingame screenshots showing hud and effects
- mp_anema.gsc by Rabbit & Peri (contact E-mail: rabbit AT 4mori DOT biz)


This script allows any modder / mapper to add usable mortars to maps on a 'per map' basis. The script is designed
to be based around 'static' mortars found in some maps, such as Normandie Night and Anemaber Albar. 

    - Mortars usable with the [use] key.
    - Limited ammunition (number of shells).
    - Full sound and graphical effects.
    - Can be integrated into existing maps without modifying the map file itself.
    - Full Hud icons and progress status bars.
    - Mortars inflict a damage radius and earthquake effect around they point they land in.
    - Includes example files for use with the map Anemaber Albar. (;81123)

The mod has a small client download containing a custom sound and modified soundaliases file. 
The script itself can be server side, allowing it to be easily modified without creating a new download for clients.


- Video of mod in action:


- Some coding / scripting ability (eg. map makers, modders etc)
- Understanding of IWD structure and software to open them (e.g. PakScape or WinRar)
- Patience! (can take some time to set up)

Mod Compatibility

- Tested only with WRM and stock COD2

Usage Instructions


This modification can be added to any map by modifying the mapname.gsc file. This can be done at the time 
of creation by the map-maker themselves, or by creating a server side mod (as this is released as), which 
contains the modified mapname.gsc file. It is not necessary to edit the map IWD file, unless you are the map 
maker and you wish to include this script when you release your project.

Adding The Mortars

Before continuing, ensure you are able to start a local server with cheats enabled (/devmap mapname) as noclip is required,
and you have a piece of paper and a pen handy (or notepad file). The included file mortarpoints.jpg is designed to 
accompany this section.

1. Once the map has loaded find the mortar you wish to make usable.
2. Enter noclip (/noclip)
3. Try and line up your view using the movement keys until your view is just in front of the square plate at the base
   of the mortar, level with the ground. 
4. Open your console and type /viewpos. Open the full console (shift + console key). You should see something 
   like (140, 20, 40) : 130 (the numbers will differ).
5. Take a note of the numbers in the brackets. This will be the mortars origin, so label it as such.
6. Next repeat steps 4 & 5, but this time lining your view up with the very end of the mortars barrel. 
   Again take note of the numbers in the brackets, giving them the label 'nose'.
7. Now (still in noclip) fly up into the sky until you are a couple of metres above the mortar. Line yourself up so you 
   looking directly down the barrel from this height. Repeat steps 4 & 5, labeling the number as 'target'.
   This is the mortar positioning complete. Now for the target area....
8. Locate the area of the map that you wish the mortar shot to fall in. Bear in mind that the shape must be roughly rectangular.
9. Use noclip (or just run) to the four different corners of your target area. Use the /viewpos command to take a note of the 
   locations of the corners.
10. The last measurement you will need is the height of the map. Use noclip to fly up, just past the highest point in your map, but not out of the skybox.
11. Use /viewpos and record the third number in the brackets. Label it height.

    That's the measurement bit complete - now for the scripting!
1. You will need a program to open / extract the files from the map.iwd you wish to modify (I recommend WinRar or Pakscape, both Free)
2. Locate the mapname.gsc file. This will be in the maps/mp directory. Open the file in notepad (or text editor - NOT word or wordpad)
3. If the map supports HQ you will see some code about level.radios with some numbers and stuff.
4. Any code that you add to the .gsc file must be placed before the last '}' and after any HQ code. (curley bracket)
5. Copy this chunk of code just before the last '}'


    thread maps\mp\gametypes\_mortars::init();
    level.mortar_rounds = 30;                                    // Number of rounds per mortar (default: 30)
    level.maxheight = 1000;                                      // Max height of map ('height' value)
    level.mortar[0] = spawn("script_model", (-1181, -337, -10)); // Numbers are the 'origin' values    
    level.mortar[0].nose = (-1179, -344, 20);                    // Numbers are the 'nose' values
    level.mortar[0].obj_target = (-1151, -422, 182);             // Numbers are the 'target' value
    level.mortar[0].minx = -1340;                                // Minimum X of target area
    level.mortar[0].maxx = 200;                                  // Maximum X of target area
    level.mortar[0].miny = -3360;                                // Minimum Y of target area
    level.mortar[0].maxy = -2300;                                // Maximum Y of target area
    level.mortar[0].effect = "mud";                              // The impact effect. Choices are "beach" "concrete" "mud" "water" "dirt"
    //Add next mortar details here
     thread maps\mp\gametypes\_mortars::main();

 End of Code

Editing the code above

The first three level.mortar[0] lines should be obvious (read the comments) as you just need to enter the values you wrote down earlier
The bottom 4 are more tricky and need some explaining:
The numbers you wrote down before for the four corners are sets of coordinates. The numbers indicate this:
    (X coord, Y coord, Z coord)
Looking at all four coordinates find the highest and lowest X & Y values (don't forget any minus signs). Put the numbers next
to their respective label in the code above.

Set the level.mortar[0].effect to the impact effect you want.

Set the level.maxheight setting as the maximum height of your map (see steps 10 & 11)

Adding file to mod

Add the .gsc you just modified to the z_svr_mort.iwd file, in the maps/mp folder (where mp_anema.gsc is);

Thats it! You've (if done correctly) successfully added a working mortar to your map!

Load up the map again.

    /set sv_mortars 1 

into your console then /fast_restart 

Check that your mortar works. You will get a repeating message if part of the code is incorrect, so check over the instructions again.

If the smoke trail effect is not coming out the barrel in the right place, or at the wrong angle, check the position again with
/viewpos and tweak the numbers for level.mortar[0].nose and level.mortar[0].obj_target.

If you wish to change the number of mortar rounds available then change the number for level.mortar_rounds

To add more than one mortar, use the same 8 lines, except replacing the [0] with [1] - see mp_anema.gsc for an example.


- When running on a dedicated server add: set sv_mortars "1" to the server config to enable the mortars
- The mortar cool-down time (delay before it can be used again), mortar load time, max damage and min damage can be edited in the _mortars.gsc file (commented with notes)
- Because the z_svr_mort.iwd file is server side (caused by z_svr prefix), it can be updated when you add a new map to your server, without changing the client download.
- Ensure that the name of the custom map iwd does not begin with the letter z. This will cause the mod to not function. Rename the map iwd file if this is the case.
- Script errors when /developer 1 is used - ensure that set developer "0" is in your config.

Known Bugs

- Overlapping Ammo counter when standing in range of two mortars
- When killed by a mortar, your death is treated as a suicide and you lose one point from your score.


Copyright: Peter Robinson 2007

You may distribute this ZIP package in any not-for-profit electronic format as long as you contact me first, 
and include all files, including this readme, intact in the original archive. 
You may not modify the script outside of the directions given here, without my express permission.


Contact Details:
    email: peter.peterrobinson AT gmail DOT com
    xfire: tee699
    Private Message at: (name: :Uk-HaS:Robinson)
               (name: pedro699)
               (name: Pedro)
               (name: Robinson)

Please let me know of any bugs and/or suggestions.

Read More

Comments on this File

There are no comments yet. Be the first!


50 XP

Registered 9th August 2007

1 Files Uploaded

Share This File
Embed File