Call of Duty 5: Exploding barrels: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
We select a model (barrel), make it a script_model, assign it targetname = explodable_barrel and script_noteworthy = explodable_barrel. To the .gsc file we add:
We select a model (barrel), make it a script_model, assign it targetname = explodable_barrel and script_noteworthy = explodable_barrel. To the .gsc file we add:


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">maps\mp\_interactive_objects::init();</div>
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>maps\mp\_interactive_objects::init();</pre></div>


And to the .csv file we add:
And to the .csv file we add:


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">rawfile,maps/mp/_interactive_objects.gsc
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>rawfile,maps/mp/_interactive_objects.gsc


fx,destructibles/fx_barrelexp_mp
fx,destructibles/fx_barrelexp_mp
Line 15: Line 15:
fx,destructibles/fx_barrel_fire_top
fx,destructibles/fx_barrel_fire_top


xmodel,exploding_barrel_test_d</div>
xmodel,exploding_barrel_test_d</pre></div>


=== Preparing your map ===
=== Preparing your map ===
Line 28: Line 28:


Key: <span style="font-family:'Courier New';">targetname</span>
Key: <span style="font-family:'Courier New';">targetname</span>
Value: <span style="font-family:'Courier New';">explodable_barrel</span>
Value: <span style="font-family:'Courier New';">explodable_barrel</span>


Key: <span style="font-family:'Courier New';">script_noteworthy</span>
Key: <span style="font-family:'Courier New';">script_noteworthy</span>
Value: <span style="font-family:'Courier New';">explodable_barrel</span>
Value: <span style="font-family:'Courier New';">explodable_barrel</span>


Line 37: Line 40:
Now, in our .gsc file, located in [root]/raw/maps/mp/mp_[mapname].gsc, we need to add the following line (you can edit .gsc files using notepad):
Now, in our .gsc file, located in [root]/raw/maps/mp/mp_[mapname].gsc, we need to add the following line (you can edit .gsc files using notepad):


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">maps\mp\_interactive_objects::init();</div>
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>maps\mp\_interactive_objects::init();</pre></div>


So, your .gsc file might become:
So, your .gsc file might become:


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">main()
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>main()
{
{
maps\mp\_interactive_objects::init(); // added line
maps\mp\_interactive_objects::init(); // added line
Line 61: Line 64:
// enable new spawning system
// enable new spawning system
maps\mp\gametypes\_spawning::level_use_unified_spawning(true);
maps\mp\gametypes\_spawning::level_use_unified_spawning(true);
}</div>
}</pre></div>


=== Adding it to the FastFile ===  
=== Adding it to the FastFile ===  
Line 67: Line 70:
To use the script we call in out .gsc file, we need to include it into our .ff file. Go to [root]/zone_source/mp_[mapname].csv and open it using notepad. Add the following lines to it (on it's own row!):
To use the script we call in out .gsc file, we need to include it into our .ff file. Go to [root]/zone_source/mp_[mapname].csv and open it using notepad. Add the following lines to it (on it's own row!):


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">rawfile,maps/mp/_interactive_objects.gsc</div>
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>rawfile,maps/mp/_interactive_objects.gsc


fx,destructibles/fx_barrelexp_mp
fx,destructibles/fx_barrelexp_mp
Line 73: Line 76:
fx,destructibles/fx_barrel_fire_top
fx,destructibles/fx_barrel_fire_top


xmodel,exploding_barrel_test_d</div>
xmodel,exploding_barrel_test_d</pre></div>


A typical .csv file might now look like this (where mp_test is the map name):
A typical .csv file might now look like this (where mp_test is the map name):


<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;">ignore,code_post_gfx_mp
<div style="background-color:#202020; border:1px solid #606060; color:#d0d0d0; font-family:'Courier New'; padding:2px;"><pre>ignore,code_post_gfx_mp
ignore,localized_code_post_gfx_mp
ignore,localized_code_post_gfx_mp
ignore,common_mp
ignore,common_mp
Line 110: Line 113:
character,char_jap_impinf_player_lmg
character,char_jap_impinf_player_lmg
character,char_jap_impinf_player_cqb
character,char_jap_impinf_player_cqb
character,char_jap_impinf_player_assault</div>
character,char_jap_impinf_player_assault</pre></div>


== Conclusion ==
== Conclusion ==

Revision as of 23:00, 21 November 2008

By Daevius

Abstract

We select a model (barrel), make it a script_model, assign it targetname = explodable_barrel and script_noteworthy = explodable_barrel. To the .gsc file we add:

maps\mp\_interactive_objects::init();

And to the .csv file we add:

rawfile,maps/mp/_interactive_objects.gsc

fx,destructibles/fx_barrelexp_mp
fx,destructibles/fx_barrel_ignite
fx,destructibles/fx_barrel_fire_top

xmodel,exploding_barrel_test_d

Preparing your map

We first select a barrel model, this can be any model, but I suggest we use a barrel for this.

Right click in the 2D grid and click misc -> model. Now browse to your [root]/raw/xmodel/ directory, select a model that suits you (I advice you to browse to that directory outside the radiant, then perform a search on the word 'barrel'). Once a suitable barrel is found, click Open and the model will appear in the map. Move it around till it's settled.

Now, while having the barrel selected, right click in the 2D grid and select script -> model. This will make your model ready to be accessed by a script.

To tell the game which script, we need to give it a targetname. Still having the barrel selected, press N (or twice) and, in the two text boxes below, fill in the following:

Key: targetname

Value: explodable_barrel


Key: script_noteworthy

Value: explodable_barrel

Calling the script

Now, in our .gsc file, located in [root]/raw/maps/mp/mp_[mapname].gsc, we need to add the following line (you can edit .gsc files using notepad):

maps\mp\_interactive_objects::init();

So, your .gsc file might become:

main()
{
	maps\mp\_interactive_objects::init(); // added line
	maps\mp\_load::main();

	// If the team nationalites change in this file,
	// you must update the team nationality in the level's csc file as well!
	game["allies"] = "marines";
	game["axis"] = "japanese";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["allies_soldiertype"] = "pacific";
	game["axis_soldiertype"] = "pacific";

	setdvar( "r_specularcolorscale", "1" );

	setdvar("compassmaxrange","2100");
	
	// enable new spawning system
	maps\mp\gametypes\_spawning::level_use_unified_spawning(true);
}

Adding it to the FastFile

To use the script we call in out .gsc file, we need to include it into our .ff file. Go to [root]/zone_source/mp_[mapname].csv and open it using notepad. Add the following lines to it (on it's own row!):

rawfile,maps/mp/_interactive_objects.gsc

fx,destructibles/fx_barrelexp_mp
fx,destructibles/fx_barrel_ignite
fx,destructibles/fx_barrel_fire_top

xmodel,exploding_barrel_test_d

A typical .csv file might now look like this (where mp_test is the map name):

ignore,code_post_gfx_mp
ignore,localized_code_post_gfx_mp
ignore,common_mp
ignore,localized_common_mp

col_map_mp,maps/mp/mp_test.d3dbsp

rawfile,maps/mp/mp_test.gsc
rawfile,vision/mp_test.vision
rawfile,maps/mp/_interactive_objects.gsc

fx,destructibles/fx_barrelexp_mp
fx,destructibles/fx_barrel_ignite
fx,destructibles/fx_barrel_fire_top

xmodel,skybox_mak1
xmodel,exploding_barrel_test_d

sound,common,mp_test,!all_mp
sound,generic,mp_test,!all_mp
sound,voiceovers,mp_test,!all_mp
sound,multiplayer,mp_test,!all_mp
sound,destructibles,mp_test,!all_mp

character,char_usa_raider_player_rifle
character,char_usa_raider_player_cqb
character,char_usa_raider_player_assault
character,char_usa_raider_player_lmg
character,char_usa_raider_player_smg
character,char_jap_impinf_player_smg
character,char_jap_impinf_player_rifle
character,char_jap_impinf_player_lmg
character,char_jap_impinf_player_cqb
character,char_jap_impinf_player_assault

Conclusion

When succeed, exploding barrels will look like this: