Call of Duty 4: MP Game Script Files: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
(New page: Category:Call of Duty 4 Category:Call of Duty 5 Category:ModTools Category:Scripting Category:Mapping == MP Game Script Files (.gsc) == The purpose of this section is ...)
 
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Call of Duty 4]]
[[Category:Call of Duty 4]]
[[Category:Call of Duty 5]]
[[Category:Modtools]]
[[Category:ModTools]]
[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Mapping]]
[[Category:Mapping]]<br>
== MP Game Script Files (.gsc) ==
[[Image:Nutshell.png]] The purpose of this section is to outline what is needed to create the .gsc files used in a multiplayer map.<br>
 
==Creating the level.gsc file==
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:
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:
Line 23: Line 17:




'''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. <br>
'''<font color="blue">maps\mp\mp_backlot_fx::main();'''</font> - This is a reference to the special FX file for the map.  Only needed if the map_fx.gsc file exists. <br>
'''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.<br>
'''<font color="blue">maps\createart\mp_backlot_art::main();'''</font> - 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.<br>
'''maps\mp\_load::main();''' - Required for map to run. <br>
'''<font color="blue">maps\mp\_load::main();'''</font> - Required for map to run. <br>
'''maps\mp\_compass::setupMiniMap("compass_map_mp_backlot");''' - This line is needed for the minimap image to display correctly.
'''<font color="blue">maps\mp\_compass::setupMiniMap("compass_map_mp_backlot");'''</font> - 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.<br>
'''<font color="blue">//setExpFog(500, 2200, 0.81, 0.75, 0.63, 0);'''</font> - 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.<br>
'''//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.<br>
'''<font color="blue">//VisionSetNaked( "mp_backlot" );'''</font> - 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.<br>
'''ambientPlay("ambient_backlot_ext");''' - Plays the ambient sound track created for this map.
'''<font color="blue">ambientPlay("ambient_backlot_ext");'''</font> - Plays the ambient sound track created for this map.




'''game["allies"] = "marines";''' - Sets the "friendly" team to Marines.<br>
'''<font color="blue">game["allies"] = "marines";'''</font> - Sets the "friendly" team to Marines.<br>
'''game["axis"] = "opfor";''' - Sets the "enemy" team to the OpFor desert enemies.<br>
'''<font color="blue">game["axis"] = "opfor";'''</font> - Sets the "enemy" team to the OpFor desert enemies.<br>
'''game["attackers"] = "axis";''' - Sets the attacking team in Search and Destroy to the "enemy" team.<br>
'''<font color="blue">game["attackers"] = "axis";'''</font> - Sets the attacking team in Search and Destroy to the "enemy" team.<br>
'''game["defenders"] = "allies";''' - Sets the defending team in Search and Destroy to the "friendly" team.<br>
'''<font color="blue">game["defenders"] = "allies";'''</font> - Sets the defending team in Search and Destroy to the "friendly" team.<br>
'''game["allies_soldiertype"] = "desert";''' - The Marines in this map will be using desert gear.<br>
'''<font color="blue">game["allies_soldiertype"] = "desert";'''</font> - The Marines in this map will be using desert gear.<br>
'''game["axis_soldiertype"] = "desert";''' - The OpFor in this map will also be using desert gear.
'''<font color="blue">game["axis_soldiertype"] = "desert";'''</font> - 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.
'''<font color="blue">setdvar( "r_specularcolorscale", "1" );'''</font></font> - 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.<br>
'''<font color="blue">setdvar("r_glowbloomintensity0",".25");'''</font> - These three values are values used to tweak the bloom effect, when bloom is enabled.  Not necissarily needed for user-made map.<br>
'''setdvar("r_glowbloomintensity1",".25");'''<br>
'''<font color="blue">setdvar("r_glowbloomintensity1",".25");'''</font><br>
'''setdvar("r_glowskybleedintensity0",".3");'''<br>
'''<font color="blue">setdvar("r_glowskybleedintensity0",".3");'''</font><br>
'''setdvar("compassmaxrange","1800");''' - Sets the display distance of the minimap.
'''<font color="blue">setdvar("compassmaxrange","1800");'''</font> - Sets the display distance of the minimap.


===Creating the level_fx.gsc file===
==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:
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:
Line 77: Line 71:
'''Defining a looping sound at certain point in the map:'''
'''Defining a looping sound at certain point in the map:'''


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


Line 85: Line 79:
'''Defining a one-shot effect:'''
'''Defining a one-shot effect:'''


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

Latest revision as of 13:30, 25 January 2011


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.