Avoid creating cycler_sprite and env_sprites entities and manually setting the model/sprite path. Plus: you have a quick model/sprite preview before placing the entity without using external viewers.
fgd_generator.py
reads the game path (e.g: /Half-Life/cstrike/
). Then models.fgd
and sprites.fgd
are generated.
// ... Base class: Targetname, Angles, FrameRate, RenderFields, ConvertToCycler ...
// Models
@PointClass base(Targetname, Angles, FrameRate, RenderFields, ConvertToCycler) size(-8 -8 -8, 8 8 8) color(204 0 255) model({ "path": "models/example.mdl" }) = prop_example : "Model"
[ model(string): "Path" : "models/example.mdl"]
@PointClass base(Targetname, Angles, FrameRate, RenderFields, ConvertToCycler) size(-8 -8 -8, 8 8 8) color(204 0 255) model({ "path": "models/sub_folder/box.mdl" }) = prop_box : "Model"
[ model(string): "Path" : "models/sub_folder/box.mdl"]
// Rest of models...
// ... Base class: Targetname, Angles, FrameRate, RenderFields, ToggleSprite, ConvertToEnvSprite ...
// Sprites
@PointClass base(Targetname, Angles, FrameRate, RenderFields, ToggleSprite, ConvertToEnvSprite) size(-8 -8 -8, 8 8 8) color(204 0 255) iconsprite("sprites/ikgrass3.spr") = spr_ikgrass3 : "Sprite"
[ model(string): "Path" : "models/ikgrass3.spr"]
// Resot of sprites...
entity_converter.py
read the .map
file and covert the prop_*
entities into cycler_sprite
and the spr_*
entities into env_sprite
(during the compiling task)
Before | After |
---|---|
Extract the files in your working directory:
Mapping/tools/TAB/fgd_generator.py
Mapping/tools/TAB/entity_converter.py
Mapping/tools/TAB/base.py
Now follow the next steps:
-
Open terminal/cmd in
Mapping/tools/TAB
-
Run
fgd_generator.py
:
python fgd_generator.py path/to/Half-Life/mod
Output:
Mapping/tools/TAB/models.fgd
Mapping/tools/TAB/sprites.fgd
-
Navigate to the folder where the game configuration files are located (where TrenchBroom.exe is located, or
user/share/trenchbroom
in linux. -
Paste
models.fgd
andsprites.fgd
intogames/Halflife
-
Incude new fgds with your other fgds (create a combined FGD, e.g: combined.fgd) with following text:
@include "zhlt.fgd"
@include "HalfLife.fgd"
@include "models.fgd"
@include "sprites.fgd"
- Open
GameConfig.cfg
, gotoentities
and replace"definitions": [ "HalfLife.fgd" ]
by"definitions": [ "combined.fgd" ]
. Make sure you have"setDefaultProperties": true
:
"entities": {
"definitions": [ "combine.fgd" ],
"defaultcolor": "0.6 0.6 0.6 1.0",
"setDefaultProperties": true
},
Now you have all models and sprites from your game folder into Entity Browser (Recommendation: press to group entities by name)
This is a method to easy-fast update the fgd when new models or sprites are added to your models/
sprites/
folder.
First, if you use linux probably you need change the permissions of the destination directory
sudo chmod a+w <prefix>/share/trenchbroom/games/your_game
where <prefix> is the installation prefix
- Add a new compile profile and config like this:
- Now when you add new models or sprites, only you need is goto
Run
->Compile map
-> select profile ->Compile
->Close
-> (Reload Entity Definitions) pressF6
Install goldsrcmap
pip install goldsrcmap
-
Goto
Run->Compile Map...
-
Select your profile
-
Add new
Run Tool
task afterExport Map
and beforehlcsg
-
Config the new task:
WARNING!!! This will overwrite the .map file you are editing in trenchbroom if the file is located in ${WORK_DIR_PATH}. RECOMMENDATION: add a new export map task ${MAP_BASE_NAME}_backup.map before
- Tool Path:
python
- Parameters:
path/to/entity_converter.py ${WORK_DIR_PATH}/${MAP_BASE_NAME}.map
- Tool Path: