Call of Duty 4: destruct model: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Note|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.}} | |||
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 ). | Example will use the security camera model ( com_security_camera & com_security_camera_destroyed ). | ||
Line 25: | Line 20: | ||
==Scripting== | ==Scripting== | ||
Create a new file _destructables_obj.gsc in /raw/maps/mp/ | Create a new file <code>_destructables_obj.gsc</code> in <code>/raw/maps/mp/</code> | ||
Content: | Content: | ||
Line 72: | Line 67: | ||
}</pre> | }</pre> | ||
{{Warning|Note that in the example above the destroyed model is ''com_security_camera_destroyed'' and the FX is | |||
''props/securitycamera_explosion''. | ''props/securitycamera_explosion''.}} | ||
In your Level/Map GSC add the following after | In your Level/Map GSC add the following after <code>maps/mp/_load::main();</code> | ||
maps\mp\_destructables_obj::main(); | maps\mp\_destructables_obj::main(); | ||
Line 89: | Line 84: | ||
--[[User:Zeroy|Zeroy.]] 20:59, 15 October 2008 (UTC) | --[[User:Zeroy|Zeroy.]] 20:59, 15 October 2008 (UTC) | ||
[[Category:Call of Duty 4]] | |||
[[Category:Modtools]] | |||
[[Category:Radiant]] | |||
[[Category:Advanced Editing]] | |||
[[Category:FXs]] |
Revision as of 23:27, 12 October 2009
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 ).
Radiant
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
Scripting
Create a new file _destructables_obj.gsc
in /raw/maps/mp/
Content:
main() { precache(); } precache() { precachemodel( "com_security_camera" ); precachemodel( "com_security_camera_destroyed" ); thread arrays(); } 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(); } security_camera_logic() { self setcandamage( true ); damagemodel = undefined; switch( self.model ) { case "com_security_camera": damagemodel = "com_security_camera_destroyed"; break; } 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();
maps\mp\_destructables_obj::main();
Finally in your Level/Map Zone File add the following
rawfile,maps/mp/_destructables_obj.gsc xmodel,com_security_camera_destroyed fx,props/securityCamera_explosion
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)