Blockbullets

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
Tool Textures
Toolsblockbullets.gif

ToolsBlockBullets is a tool texture that should tell the compiler (VBSP) to cause all bullets to be blocked when this texture is used.
However, for all intents and purposes, it is nothing but an invisible wall, solid to everything which also cuts visleafes, just like any regular wall. As a matter of fact, if the brush is too thin, the bullets will simply pass. So it would block everything but bullets in that case.
In some games, it is the exact same as ToolsInvisible, but without the %compilepassbullets parameter.

ToolsBlockBullets consists of %CompileNoDraw, $translucent and $nodecal. No special Compile Flag exists to block bullets.
Counter-Strike: Global Offensive has its own blockbullets_cs variant that actually does what it is supposed to do, even with a one unit thick wall. However, this branch is no longer actively developed and not used for any other game nowadays. So this tool texture and its code is unusable.

Todo: Test if CONTENTS_DEBRIS works on brushes in various games. This can be achieved either through modifying VBSP or editing the VMF by hand.
Todo: Test the Source 2 version of the same texture.

Actually blocking bullets

But no despair, there are ways to block bullets, just without tool textures.
As it turns out, physical debris objects possess the ability to "eat" bullets and not let them pass.

Using Func_physbox

A npc_strider, the one unit thick func_physbox, and a npc_citizen that is about to be spooked.
The settings required to make this func_physbox block bullets.

Create a simple brush that you would want your bullet blocker to be, and turn it into a func_physbox entity using any material using the "default_silent" surfaceprop.
A good contender would be Tools/toolsskybox2D, simply because every game has it, and you're unlikely to ever actually use it. So it stands out from the regular skybox texture.
Do not worry, it won't work as skybox texture, as it will loose all functionality as tool texture when used on an entity. We only want the surfaceprop.

Note.pngNote:This also blocks and redirects prop_combine_ball and npc_grenade_frag, but not npc_grenade_bugbait, grenade_ar2, rpg_missile, and crossbow_bolt.
Not sure what other thrown objects it may block in other games.


This Func_physbox entity must have the following flags set:

  • Start Asleep.
  • Ignore +USE for Pickup.
  • Debris - Don't collide with the player or other debris.
  • Motion Disabled.
  • Not affected by rotor wash.
  • Physgun is NOT allowed to pick this up.
  • Physgun is NOT allowed to punt this object.
  • Prevent motion enable on player bump.
  • Only Break on Trigger.
  • Don't allow bullet penetration.


Depending on game, some of these flags may not exist. Left 4 Dead series for example does not have the rotorwash flag.
You merely need to set all flags to stop it from ever moving. As we're abusing the "Don't allow bullet penetration" flag for our purposes.
To make it easier for you you can use the following spawnflag value if you turn "Smart Edit" mode off:
For Half-Life 2 15005697.
For Left 4 Dead 2 9750529.


Next, the following keyvalues need to be set:
Rendermode : "Do not render"
Disable Shadows : "Yes"
Disable Receiving Shadows : "Yes"

Note.pngNote:Some games require you to overlap two Func_physbox in the same spot. Left 4 Dead 2 is one of the games that needs two, Half-Life 2 does not.
Probably because the "Don't allow bullet penetration" flag does not work in L4D2. But simply overlapping two Func_physboxes at once fixes this somehow.

Using Prop_physics

A door that is 8x times its size is fitting for a Strider.
Or for a bullet blocker. It looks stupid, but it works.

If for whatever reason, func_physbox is not an option for you, you can do the exact same thing with a physics prop. Even prop_physics_override works if you have no physics prop that fits, but a dynamic prop happens to work.
Find or create a model that has the size you need. If your branch allows it, you can upscale any prop to be fitting. Perhaps a Door model, or a garage gate would fit nicely.

This prop_dynamic or prop_dynamic_override entity must have the following flags set:

  • Start Asleep.
  • Don't take physics damage
  • Debris - Don't collide with the player or other debris.
  • Motion Disabled.
  • Not affected by rotor wash.
  • Prevent pickup.
  • Prevent motion enable on player bump.


Next, the following keyvalues need to be set:
Rendermode : "Do not render"
Disable Shadows : "Yes"
Disable Receiving Shadows : "Yes"
Breakable by : "Only Tanks" (only in Left 4 Dead series)

The finished product of a strider desperately trying to hurt an unamused citizen.

Blocking Projectiles

Making a projectile deflecting brush is not possible, but you can make a trigger that deletes the projectile, using filters and the OnStartTouch - !Activator - Kill outputs.

  1. Place a filter_activator_class or filter_activator_model entity for every projectile you want to delete.
  2. Place a filter_multi that lists every filter you had just created, with the "Logic Type" set to "OR (any filter must pass)".
  3. Build a trigger_multiple using whatever filter entity you wish.
  4. Set the Trigger's outputs toOnStartTouch - !Activator - Kill
  5. Set the Trigger's flags to "Everything (not including physics debris)"
Icon-Bug.pngBug:Shooting a rpg_missile through this trigger will delete the missile, but not the sound its emitting. Causing the sound to be stuck where it was deleted  [todo tested in ?]