Call of Duty 4: destruct model

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
This tutorial uses an adaptation of the IW SP script _interactive_objects.gsc This will work on any stock models for which you have a normal state model and a destroyed state model available and an FX for the destruction effect.
Example will use the security camera model ( com_security_camera & com_security_camera_destroyed ).


Place the normal state (not destroyed) model where you want it in your level

With the model selected enter the entity property window (n) and enter the following keys/values:

Key: Classname
Value: script_model
Key: Targetname
Value: destroyable_security_camera


Create a new file _destructables_obj.gsc in /raw/maps/mp/


	precachemodel( "com_security_camera" );
	precachemodel( "com_security_camera_destroyed" );

	thread arrays();

	security_camera = getentarray("destroyable_security_camera", "targetname" );
	level.breakables_fx[ "security_camera_explode" ] = loadfx( "props/securitycamera_explosion" );

	for(i=0;i < security_camera.size;i++)
		security_camera[i] thread security_camera_logic();

	self setcandamage( true );
	damagemodel = undefined;

	if(self.model == "com_security_camera")
		damagemodel = "com_security_camera_destroyed";

	self waittill( "damage", damage, other, direction_vec, P, type );

	self setmodel( damagemodel );
	playfxontag( level.breakables_fx[ "security_camera_explode" ], self, "tag_deathfx" );
Note that in the example above the destroyed model is com_security_camera_destroyed and the FX is props/securitycamera_explosion.

In your Level/Map GSC add the following after maps/mp/_load::main();


Finally in your Level/Map Zone File add the following


In the map the model will be destroyed on bullet/c4/grenade/RL/GL and replaced with destroyed model with a nice FX

--Zeroy. 20:59, 15 October 2008 (UTC)