Glass that starts out broken: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(17 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[[Category:Level Design]] [[Category:Tutorials]]
{{Underlinked|date=January 2024}}
I assume you already now how to make a proper breakable window. If you do not know, there is a good tutorial about it here at [http://developer.valvesoftware.com/wiki/Creating_Breakable_Glass Creating Breakable Glass here at the Source Wiki].
{{LanguageBar|Glass that starts out broken}}
[[File:Brokenglasstutorial0000.jpg|thumb|200px|right|Broken glass that breaks when the map starts]]
This tutorial assumes you already know how to [[Breakable Glass|create breakable glass]]. If not, follow that tutorial first.__FORCETOC__


'''Step 1:''' Open one of your maps or make a new one.
==First method==
This method consists on breaking the glass with the help of an explosion that occurs once the map is loaded.
*Make a {{ent|func_breakable_surf}} with a frame around it (as if you are making a normal breakable window).
*Set up an {{ent|env_explosion}} in the middle of the window, then change the options as follows:
{{entity-kvalue-start|env_explosion}}
{{entity-kvalue|Name|<name>|<name> is whatever name you wish to give to this entity}}
{{entity-kvalue|Magnitude|1|}}
{{entity-kvalue-end}}
*Then in the flags tab, change the flags as follows:  
{{entity-flag-start}}
{{entity-flag|No fireball|on|}}
{{entity-flag|No smoke|on|}}
{{entity-flag|No decal|on|}}
{{entity-flag|No sparks|on|}}
{{entity-flag|No sound|on|}}
{{entity-flag|No fireball smoke|on|}}
{{entity-flag|No particles|on|}}
{{entity-flag|No Dlights|on|}}
{{entity-flag-end}}
*Set up a {{ent|logic_auto}} near the <code>env_explosion</code> (it doesn't matter where you put it, but I recommend that you put it in a convenient place)
*Change the entity outputs for the <code>logic_auto</code> as follows:
{{entity-output-start}}
{{entity-output||OnMapSpawn|<name>|Explode|||Yes|<name> is the name you gave to the <code>env_explosion</code>}}
{{entity-output-end}}
*Then in the flags tab, change the flags as follows:
{{entity-flag-start}}
{{entity-flag|Remove on fire|on|}}
{{entity-flag-end}}
*Test your map! When it loads the <code>env_explosion</code> will break the glass leaving the jagged glass edges on the side of the frame.


'''Step 2:''' Make a func_breakable_surf with a frame around it (as if you are making a normal breakable window).
==Alternative method==
This method consists on setting the <code>logic_auto</code> entity to directly shatter the glass once the map is loaded, which eliminates the need of creating an explosion.
*Name the <code>func_breakable_surf</code> you created in step 2 above. Don't create the <code>env_explosion</code> , but do create the <code>logic_auto</code>.
*Change the entity outputs for the <code>logic_auto</code> as follows:
{{entity-output-start}}
{{entity-output||OnMapSpawn|<name>|Shatter|0.5 0.5 128||Yes|<name> is the name you gave the <code>func_breakable_surf</code> entity}}
{{entity-output-end}}
*Adjust the parameter above as desired. Changing the size of the third number (128) will change how much of the window is broken.


'''Step 3:''' Set up an env_explosion in the middle of the window, then change the options of the env_explosions as follows:
==Third method==
The two methods above will play a glass shattering noise on map load, and will likely force you to make a hole of some size in the pane. One last method is to create a new version of the "unbroken" texture, and make it identical to the "cracked" texture.


:''Name: Anything you want as long as you know what it is''
The glass is technically never broken in the first place, but looks like it. The only downside is that the glass may appear to be just a little oddly strong when hit by a small object or a bullet.
:''Magnitude: 1''


:Then in the flags tab, change the flags as follows: Check No fireball, No smoke, No decal, No sparks, No sound, No fireball smoke, No particles, and No Dlights.
[[Category:Level Design]]
 
[[Category:Tutorials]]
'''Step 4:''' Set up a logic_auto near the env_explosion (it doesn't matter where you put it, but I recommend that you put it in a convenient place)
 
'''Step 5:''' Change the entity outputs for the logic_auto as follows (if you aren't sure how to use the input/output system, read this):
 
:''My output named: OnMapSpawn''
:''Target entities named: env_explosion (the name you typed for that entity)''
:''Via this output: Explode''
:''Check the box that says, "Fire once only".''
 
:Then in the flags tab, change the flags as follows: Check "Remove on fire"
 
'''Step 6:''' Test your map! When it loads the env_explosion will break the glass leaving the jagged glass edges on the side of the frame.
 
:[[:Image:http://developer.valvesoftware.com/wiki/Image:Brokenglasstutorial0000.jpg]]

Latest revision as of 16:01, 18 July 2025

Underlinked - Logo.png
This article needs more Wikipedia icon links to other articles to help Wikipedia icon integrate it into the encyclopedia. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
English (en)Русский (ru)Translate (Translate)
Broken glass that breaks when the map starts

This tutorial assumes you already know how to create breakable glass. If not, follow that tutorial first.

First method

This method consists on breaking the glass with the help of an explosion that occurs once the map is loaded.

  • Make a func_breakable_surf with a frame around it (as if you are making a normal breakable window).
  • Set up an env_explosion in the middle of the window, then change the options as follows:
Class: env_explosion
Keyvalues Comments
Name <name> <name> is whatever name you wish to give to this entity
Magnitude 1
  • Then in the flags tab, change the flags as follows:
Flag
Checkbox-on.png No fireball
Checkbox-on.png No smoke
Checkbox-on.png No decal
Checkbox-on.png No sparks
Checkbox-on.png No sound
Checkbox-on.png No fireball smoke
Checkbox-on.png No particles
Checkbox-on.png No Dlights
  • Set up a logic_auto near the env_explosion (it doesn't matter where you put it, but I recommend that you put it in a convenient place)
  • Change the entity outputs for the logic_auto as follows:
My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnMapSpawn <name> Explode Yes <name> is the name you gave to the env_explosion
  • Then in the flags tab, change the flags as follows:
Flag
Checkbox-on.png Remove on fire
  • Test your map! When it loads the env_explosion will break the glass leaving the jagged glass edges on the side of the frame.

Alternative method

This method consists on setting the logic_auto entity to directly shatter the glass once the map is loaded, which eliminates the need of creating an explosion.

  • Name the func_breakable_surf you created in step 2 above. Don't create the env_explosion , but do create the logic_auto.
  • Change the entity outputs for the logic_auto as follows:
My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnMapSpawn <name> Shatter 0.5 0.5 128 Yes <name> is the name you gave the func_breakable_surf entity
  • Adjust the parameter above as desired. Changing the size of the third number (128) will change how much of the window is broken.

Third method

The two methods above will play a glass shattering noise on map load, and will likely force you to make a hole of some size in the pane. One last method is to create a new version of the "unbroken" texture, and make it identical to the "cracked" texture.

The glass is technically never broken in the first place, but looks like it. The only downside is that the glass may appear to be just a little oddly strong when hit by a small object or a bullet.