Call of Duty 4: MP Game Script Files

From COD Modding & Mapping Wiki
Revision as of 13:30, 25 January 2011 by Zeroy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


The purpose of this section is to outline what is needed to create the .gsc files used in a multiplayer map.

Creating the level.gsc file

The first step is to create a game script file with your level's name in the filename. It goes in the following game directory:

\raw\maps\mp\mp_yourmap.gsc


Below is a screenshot of the mp_backlot.gsc file, opened in UltraEdit. It can be opened in any text editing application. Below the image is a breakdown of each of the lines in the script file.



maps\mp\mp_backlot_fx::main(); - This is a reference to the special FX file for the map. Only needed if the map_fx.gsc file exists.
maps\createart\mp_backlot_art::main(); - This is a reference to the Art file for the map. The map_art.gsc files don't exist in the community tools, so in a user-made map this line wouldn't exist.
maps\mp\_load::main(); - Required for map to run.
maps\mp\_compass::setupMiniMap("compass_map_mp_backlot"); - This line is needed for the minimap image to display correctly.


//setExpFog(500, 2200, 0.81, 0.75, 0.63, 0); - This line creates exponential fog for the map (start distance, end distance, red, green, blue, transition time). It is commented out because it was later redefined in the map_art.gsc file. It should be uncommented in a user-made map.
//VisionSetNaked( "mp_backlot" ); - This line references the map's .vision file for post-processed color correction. It is commented out because it was later redefined in the map_art.gsc file. It should be uncommented in a user-made map with a .vision file.
ambientPlay("ambient_backlot_ext"); - Plays the ambient sound track created for this map.


game["allies"] = "marines"; - Sets the "friendly" team to Marines.
game["axis"] = "opfor"; - Sets the "enemy" team to the OpFor desert enemies.
game["attackers"] = "axis"; - Sets the attacking team in Search and Destroy to the "enemy" team.
game["defenders"] = "allies"; - Sets the defending team in Search and Destroy to the "friendly" team.
game["allies_soldiertype"] = "desert"; - The Marines in this map will be using desert gear.
game["axis_soldiertype"] = "desert"; - The OpFor in this map will also be using desert gear.


setdvar( "r_specularcolorscale", "1" ); - This value is defined in some maps to make surfaces more reflective. (To simulate wet surfaces in maps like Downpour, for instance). It has to be zeroed out to 1 in all other maps so it won't stay at the reflective value on a map switch.


setdvar("r_glowbloomintensity0",".25"); - These three values are values used to tweak the bloom effect, when bloom is enabled. Not necissarily needed for user-made map.
setdvar("r_glowbloomintensity1",".25");
setdvar("r_glowskybleedintensity0",".3");
setdvar("compassmaxrange","1800"); - Sets the display distance of the minimap.

Creating the level_fx.gsc file

The level_fx.gsc file is optional, but can be used to add special effects to your level. It goes in the following game directory:

\raw\maps\mp\mp_yourmap_fx.gsc


Below is a screenshot of the mp_backlot_fx.gsc file, opened in UltraEdit. It can be opened in any text editing application.



Each of these lines is loading a special effect into memory under a certain alias, which can then be referenced when defining an effect as described below.


The maps that shipped with the game have a separate map_art.gsc file where these effects were defined. User-made maps won't have this file, so the effects should be defined within the map_fx.gsc file.


Names of special FX that you can use are located in the \raw\fx directory.


Below are a few examples of what these definitions would look like.


Defining a looping sound at certain point in the map:

ent = maps\mp\_createfx::createLoopSound();
ent.v[ "origin" ] = ( -619.675, -2705.93, 331.715 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "soundalias" ] = "emt_tree_palm_rustle";


Defining a one-shot effect:

ent = maps\mp\_utility::createOneshotEffect( "firelp_small_pm" );
ent.v[ "origin" ] = ( -187.003, -703.577, 67.8959 );
ent.v[ "angles" ] = ( 270, 30.6197, 101.38 );
ent.v[ "fxid" ] = "firelp_small_pm";
ent.v[ "delay" ] = -15;
ent.v[ "soundalias" ] = "fire_metal_small";

A one-shot effect places a certain effect at the specified location in a map. The effect file itself is generally set to looping, so a placed one-shot effect will generally loop.