Left 4 Dead 2/Scripting/Expanded Mutation System/ConfigureHammerForEntityGroupCompilation: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Bruh, I wanted to use Preview not submit an edit... Undo revision 240366 by Orinuse (talk))
Tag: Undo
Line 2: Line 2:
{{L4D2_simple_staged_holdout_menu}}
{{L4D2_simple_staged_holdout_menu}}
= Configuring Hammer to compile Entity Groups =
= Configuring Hammer to compile Entity Groups =
Entity Groups, used extensively in Valve's EMS showcase mutations, are script files containing entity data which are exported contents of a VMF file. However Hammer does not support this by default, but Valve has provided the tools necessary to use. This tutorial should give a basic idea of how Valve configured Hammer to be capable of auto-generating Entity Group scripts.
There are quirks of Entity Group exporting to take note of first:
* Only entities can be compiled into an Entity Group, so world data (geometry and all) is ditched.
* Brush entities can be compiled but they will not have brush models. For example, compile a func_tracktrain and it'll still be exported into the script, but any associated brushes will be discarded.
** Brushes will not maintain their angles when you export; You'll have to exit [[SmartEdit]] and add in the<code>angles</code>key yourself with the values you want. Hammer doesn't allow you to view the rotated degrees of a brush, so your best bet is to do trial and error with the Transform tool, and see what number you end up liking.
{{note|With the Transform tool, Z coord lets you rotate the brush entity, but when converting to the<code>angles</code> key, the number you tested with should be put into the Y coord for the<code>angles</code> key.}}
{{todo|Test the angles key with brush entities}}
The following brush entities are converted into their script versions on compile:
* [[func_attribute_nav_region]]
* [[func_button]]
* [[func_nav_blocker]]
* [[trigger_hurt]]
* [[trigger_multiple]]
* [[trigger_once]]
* [[trigger_push]]


== Install Perl ==
== Install Perl ==
Executing a Perl script, specifically the one named<code>export_entity_group.pl</code>, provided by Valve which compile entity groups. In order to proceed you must have the Perl programming language installed or the script can't be ran.  
Part of this process involves executing some Perl scripts provided by Valve which compile entity groups. In order to proceed you must have the Perl programming language installed on your computer so that these scripts can run.


Download Perl at www.perl.org. If you are running Windows, download and install '''ActiveState Perl'''.
If you are running Windows, go to www.perl.org to download and install '''ActiveState Perl'''


== Set up Hammer ==
== Set up Hammer ==
* Load up a .VMF with Hammer that you wish to compile into an entity group.   
* Load '''Hammer'''
* Load a .VMF that you wish to compile into an entity group.   
** Only entities can be compiled into an Entity Group.  World solids will be discarded.  Brush entities can be compiled but they will not have brush models.  So you can for example compile a func_tracktrain or func_door but any associated brushes will be discarded.
** The following trigger volumes (trigger_hurt, trigger_multiple, trigger_once, trigger_push) can be compiled as entity groups.  The brush models are discarded but the trigger area still functions as expected.
* Ensure that you have configured Hammer to compile maps and the game executable and paths are correct.  Below are example images showing the tabs you'll need to configure in order to compile entity groups.
* Ensure that you have configured Hammer to compile maps and the game executable and paths are correct.  Below are example images showing the tabs you'll need to configure in order to compile entity groups.



Revision as of 14:32, 22 March 2021

Configuring Hammer to compile Entity Groups

Install Perl

Part of this process involves executing some Perl scripts provided by Valve which compile entity groups. In order to proceed you must have the Perl programming language installed on your computer so that these scripts can run.

If you are running Windows, go to www.perl.org to download and install ActiveState Perl

Set up Hammer

  • Load Hammer
  • Load a .VMF that you wish to compile into an entity group.
    • Only entities can be compiled into an Entity Group. World solids will be discarded. Brush entities can be compiled but they will not have brush models. So you can for example compile a func_tracktrain or func_door but any associated brushes will be discarded.
    • The following trigger volumes (trigger_hurt, trigger_multiple, trigger_once, trigger_push) can be compiled as entity groups. The brush models are discarded but the trigger area still functions as expected.
  • Ensure that you have configured Hammer to compile maps and the game executable and paths are correct. Below are example images showing the tabs you'll need to configure in order to compile entity groups.

Build programs.jpg

EXAMPLE: The Build Programs tab located in Tools->Options. Your file paths may differ!



Build configuration.jpg

EXAMPLE: The Game Configurations tab located in Tools->Options. Your file paths may differ!



  • If you make changes you may be prompted to restart Hammer in order for the changes to take effect
  • Load a vmf you wish to compile into an entity group (NOTE: file must be saved in EntityGroups folder as of this writing)
  • Open the "Run Map dialog" by pressing F9 or by clicking the game pad button on the Map Operations bar:

Run map.jpg


Expert dialog.jpg

If you are not in "Expert" mode click the button at the bottom of the dialog labeled "Expert"


  • Click the "Edit" button to open the Run Map Configurations panel and then click "New"

Run map configurations dialog.jpg


  • Name your configuration (e.g., Export Entity Group) and click Close
  • Ensure that your new configuration is selected in the Configurations dropdown
  • Click the "New" button to add a new command and check the checkbox to enable it.

Checkbox dialog.jpg

  • In the Command field in Command Properties enter the path to your perl.exe. If you prefer, you can click Cmds then select Executable from the list that appears and browse to where you installed perl.exe.


  • In the Parameters field use these parameters:
$gamedir\..\bin\export_entity_group.pl $path\$file.$ext $gamedir\scripts\vscripts\entitygroups\$file_group.nut

Entity dialog.jpg

  • It is highly recommended that you check the box labeled "Wait for keypress when done compiling" so you can examine the output of the script.
  • Click 'GO!' and it should compile your entity group.