Tutorial: Non-coding workarounds for your mod Last edited 2 days ago2024-11-20 12:26:41 UTC

NOTE: This guide is a work in progress, which means that you might find it very short, lacking of information, poorly done or with terrible spelling. If you have any suggestions, ideas or you know any workarounds, please go to the comments section.
If you are not a programmer, or don't have one in your team, it might present a problem for the development of your mod. The next course of action would be to use other mods as a base (like Featureful or Opposing Force). However, in some cases, you may not be able to use custom code either. This is where this guide comes in: it contains a list of cool Half-Life features and stuff that you can implement in your mod!
Most of these went unused, or are workarounds rather than features themselves. It also contains some cool map tricks (such as the screen tint). These are meant to solve or tackle specific problems.

Caveats

The techniques discussed in this page isn't without gotchas. Here's some of the main problems of no-coding workarounds and dummied out features:

UI/Menu

A common feature in a lot of mods. Add an .mp3 file named gamestartup.mp3 to YourMod/media. This file should contain your selected main menu music. It will be played every time the game is launched. However, the music plays in a loop and does not play again when the player leaves the game or disconnects from a server.

Mapping/Level editing

Screen tint

This one was created by the user Mota. The original map presents a México-yellowish tint, but you can change this to other colors to fit your needs.
Normal Screen picture by MotaNormal Screen picture by Mota
Tinted Screen picture by MotaTinted Screen picture by Mota
Explanation and steps for achieving this effect is available in the vault entry page, linked below:
Loading embedded content: Vault Item #6681

Moving sprites

You would have seen sprites that moves through a level in various locations in Half-Life: Opposing Force. It is achieved through a custom entity (func_spritetrain) that are not available in vanilla Half-Life. However, you can use a trick to have a func_train display a sprite. This trick requires that you use some version of ZHLT compile tools (or its derivatives e.g. VHLT) that supports the use of the zhlt_usemodel keyvalue.

The following vault item has an example and the steps of achieving this trick:
Loading embedded content: Vault Item #6461
You can also use this trick to have a simple rotating sprite that doesn't use animation frames (thus saving on filesize), by using the angular velocity (avelocity) keyvalue. To have the sprite rotate in place, make the path_corner entities very close together (e.g. 1u apart) and have the func_train move very slowly e.g. 0.1u speed.

Model-based func_ entities

Using the same zhlt_usemodel keyvalue as mentioned in previous section, you can force a func_ entity, which is usually brush-based (just like func_train in previous section) to use a model. This is actually used in Condition Zero: Deleted Scenes with the mounted guns: they are func_tank entities that uses a model, that are otherwise identical in function to the vanilla entity.

The tutorial page "Using models for health/HEV chargers in vanilla Half-Life" explores the use case for this workaround with the health and HEV chargers in particular. A vault item is linked in the page, but here's the same thing:
Loading embedded content: Vault Item #6897
Crash caveat
A few func_ entities constantly runs a check if they are blocked, to deal damage to the blocking entity. If the entity is using a model instead of brushwork, this check will fail when an entity touches it and the game will crash. You need to make sure you check the "not solid" or "passable" flags for these entities.

Corpses of monsters without a _dead variant

You may notice that some monsters don't have a _dead variant. Checking the models used by these monsters (See Reference: Entities and their models page) with a model viewer (e.g. Half-Life Asset Manager aka HLAM) would reveal that they don't have any dead poses. But don't fret! You can use the env_sprite entity to display a model. Just turn off SmartEdit on J.A.C.K./Hammer and input the path to the monster's model as the model keyvalue. Then, with SmartEdit still turned off, add the following keyvalues:
Cons of this method
  • The corpse is not gibbable.
  • The env_sprite entity would not accept a custom body or skin keyvalue due to technical reasons. body and skin keyvalues were hijacked to enable env_sprite entities to become attached to another entity's model attachment points.
  • The dying animation will play (albeit sped up 8x) at the start of the level, so you need to place the entity out of sight of the players near the loading/transition place(s).
Or, you could just edit the models and add dead sequences (being the last frames of the dying sequences) at the end of the QC file.

Advanced Half-Life FGD

This FGD implements plenty of dummied out features from Half-Life, such as Dynamic Lights, the inclusion of new unused entities like item_sodacan or grenade. Keep in mind, this FGD is meant for Hammer. Other programs, like J.A.C.K. editor, can't really handle some features, and cause bugs.
Loading embedded content: Vault Item #6618

Models

Different models for a single entity

You can make variations of pickups, monsters, etc. by adding a bodygroup to the model and adding the "body" property in a map editor:
PickupsPickups
MonstersMonsters
You can also add "limitless" body/skingroups to entities that already use them like HECU grunts or scientists. I wrote "limitless" because there is still a limit on every model. According to The303.org, the limits are: A problem with this workaround is that entities that already work with bodygroups and skingroups (like the scientists and security guards) can't have more groups added, since this will break the models.
An example can be found here, by UrbaNebula.
Loading embedded content: Vault Item #6409
monster_ entity warning
Many monster_ entities programmatically override body and skin keyvalues. For example, a monster_barney with non-standard body groups will break, and so would monster_scientist with non-standard bodygroups and skins, and monster_houndeye with their skin values being used to blink their eyes, among others. You can consult the Reference: Entities and their models page for whether custom body and skin groups are supported by any particular entity in the vanilla codebase.

Misc

(LEGACY) Different launch screen

NOTE: This may no longer work, as the game got an update for the 25 anniversary. If you really want to use this feature, consider switching to steam_legacy version.
TODO: update information on usage for HL25 branch.
Half-Life uses a single background image both for the menu and when the game is loading. However, you can add different backgrounds for the loading screen and menu.
Main MenuMain Menu
Loading screenLoading screen
This can be achieved by modifying the file YourMod/resource/BackgroundLoadingLayout.txt, and adding your new background files. A recommended way to organize the backgrounds is putting the files in different folders, rather than putting everything in the background folder:
ImageImage

6 Comments

Commented 1 year ago2023-08-13 10:23:31 UTC Comment #105469
All of the features shown in Mapping are included in Advanced Half-Life FGD by default. Thus, there is no need to turn off the Smart Edit and add relevant keyvalues every time.
User posted image
User posted image
Even scientists with different pitches using the same head bodygroup can be created.
User posted image
Body and Skin keys are already included as long as they are supported on almost most monster_* entities.
User posted image
All func_* entities include the effects key by default.
User posted image
User posted image
Of course, this FGD did not become popular because it didn't get enough attention, and everyone is still making maps with the outdated Half-Life FGD.
Commented 1 year ago2023-08-13 21:38:29 UTC Comment #105470
User posted image
Commented 1 year ago2023-08-14 05:00:13 UTC Comment #105471
我曾经在ka_airtrain里使用func_conveyor的时候,也出现了光照效果,即使我并未有任何非常规操作。
When I once used the func_conveyor entity in ka_airtrain, it also compiled with a light effect in the map, even though I didn't do anything unconventional with it.
Commented 1 year ago2023-08-14 21:05:10 UTC Comment #105472
Interesting, could you please elaborate further?
Commented 1 year ago2023-08-15 10:14:12 UTC Comment #105476
很难说,因为这个实体很久以前就被我删除了。
It's hard to say because this entity was deleted by me a long time ago.
Commented 1 year ago2023-09-04 16:41:42 UTC Comment #105523
Here to clarify what "loading screen" means. It's the moment after the game entered fullscreen and before the main menu shows. It's actually not the time when the maps are loading (I tested) so you're actually only seeing it for a fraction of a second tops. No wonder nobody bothers making a custom one.

You must log in to post a comment. You can login or register a new account.