Call of Duty 5: Breakable Windows

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
Tutorial by Badman adapted from COD4 for CODWAW; This is to show you how to add destructible Windows in your levels

The Script

  • Create a new file called _breakable_windows.gsc in:
C:\Program Files\Activision\Call of Duty - World at War\raw\maps\mp\
  • In the file copy paste this code:
// *************************************************************************************************************
// Destructible Window Script Version 1.1 by BadMan
// Latest Update: Sunday, 30th November 2008
// *************************************************************************************************************
// *************************************************************************************************************
// Original Version 1.1 by -=FD=-
// Latest Update: Friday, 22nd February 2008
// *************************************************************************************************************
// This Script allows the use of breakable windows after a certain damage it will breaks 
// This Tutorial tries to remain as simple as possible. 
// The Tutorial contains one “broken” - status for the window (as e.g. with the cars!)

// In order to change the value of the damage, which the window can sustain,
// you must adjust the value with ' targetdamage' value.

// Credits: Tally, which helped me with the starting of the Script. 
// Credits: noobCODmapper and Ghost Death for the Script on, which inspired me for this. 
// Credits: IW for this great Game and the release of the tools!

	windfx = loadfx ("maps/sniper/fx_glass_break");
	windtrigs = getentarray("window1","targetname");
	for(i=0; i<windtrigs.size; i++)
			windtrigs[i] thread dowindow(windfx);

	targetdamage = 80;
	totaldamage  = 0;
	WindowShattered = false;
	WindowShatteredtwo = false;
	WindowBroken = false;
	self enablegrenadetouchdamage();
	NormalState = getent(,"targetname");
	ShatteredState = getent(,"targetname");
	ShatteredState hide();
	ShatteredStatetwo = getent(,"targetname");
	ShatteredStatetwo hide();
	BrokenState = getent(,"targetname");
	BrokenState hide();

			self waittill ("damage", amount,attacker, direction_vec, point, type);
			if(totaldamage>targetdamage || getdamagetype(type)=="melee")
					WindowBroken = true;
					NormalState delete();
					ShatteredState show();
					WindowShattered = true;
			else if(!WindowShatteredtwo)
					ShatteredState delete();
					ShatteredStatetwo show();
					WindowShatteredtwo = true;

	BrokenState show();
	self playsound("glass_pane_break");
	PlayFX(windfx, BrokenState.origin );
	ShatteredState delete();
	ShatteredStatetwo delete();
	self delete();

	if(!isdefined(type)) { return "unknown"; }
	type = tolower(type);
			case "mod_melee":
			case "mod_crush":
			case "melee":
			return "melee";
			return "other";

Map GSC/Zone File

  • Open your main Map gsc file and add the following right after maps\mp\_load::main();
  • Update Zone File by adding the following lines:

In Radiant

  • The Tutorial assumes you have the map/Building done and have an opening to place the Window Models
  • XModels in use are:
  • Add the first Model (breakable_window2_pristine) into the map by right-clicking on 2D window > Misc > Model;

  • With the model still selected right-click in the 2D window > script > model

  • Now you can adapt the building/wall opening to the window and/or the window to the opening on the building/wall

The Window opening size is 64Units in Height and 56Units in Width

  • Now for the trigger, using the Trigger Texture Tool cover the window model
  • With the trigger selected right-click in the 2D window > Trigger > Damage

  • You now need to add a targetname value for the Trigger, with the Trigger selected press N and add the key/values
Key   : targetname
Value : window1

  • Now we must add the broken models for the different states of the damaged window; An easy way to do this is to place the Radiant Grid on 32Units so that you can easily move the models back to their origin, otherwise it gets confusing;
  • Select the First Window model you add and press space to copy it 3 more Times, Each time move the new model so that you can see clearly;

  • Now change the model and add targetname like this:
model = breakable_window2_pristine
model = breakable_window2_brkn1
model = breakable_window2_brkn2
model = breakable_window2_brkn3
  • Now to connect all this!
  • Select the Trigger created then the first Window model and press W to connect them
  • Deselect all then select the First window model then the second window model and again hit W
  • Deselect all then select the second window model then the third one and again hit W
  • Finally deselect all and select the third then fourth model and Hit W
  • It should look like this:

  • Now place back each model on top of the first Window
  • Dont forget to clip the main window so no-one can go through

Note that you can use less model if you like;

  • Compile and test!


  • You can download the script and prefab used for this tutorial HERE

Sources: Opferlamm-Clan Board