Level Transition Fix

If you liked this item, please rate it up on Steam Workshop page.

Author: Captain Applesauce

Last revision: 2 Dec, 2017 at 00:53 UTC

File size: 4.1 KB

On Steam Workshop

Description:

A simple addon that fixes issues with players not spawning at the correct position (along with default health, armor, weapons, and ammunition) after level transitions (in the Half-Life 2 singleplayer campaigns, for example).

This addon is enabled by default and can be disabled via the "transFix_enabled" convar.

If you would like to play a campaign, you could download the "Basic Campaign" addon (found here), or the "Half Life 2 Save Menu" addon (found here).

NOTE: In multiplayer, all players must be in the trigger for the level to change.

If you would like to play the non-episodic Half-Life 2 campaign with this addon, follow these instructions:

1. Copy and paste the following URL in a web browser (Remove the _): https://_/mega.nz/#!PARFDbBa!3ZSkPPgE6cQQSuWkEZeLj_MlxyBjmCHEy4kKFqwlSb8
2. Download and extract the contents of the .zip file to your addons directory (C:Program Files (x86)SteamsteamappscommonGarrysModgarrysmodaddons). You may check the file for viruses if you wish.

NOTE 1: You must have Half-Life 2 mounted for this addon to work properly.
NOTE 2: If you have any addons that override in-game sounds, this addon may reverse the effects of the other addon. This cannot be helped.

To control which entities with certain classes are deleted upon transitioning, use the following functions in the "GM:Initialize()" hook. (It is not guaranteed to work when placed directly inside a file’s source code, as the code can be run before any of these functions are defined.):

TransFix.AddClassNoSave(class, key, condition) – Adds an entity class to be scheduled for deletion. The "key" argument acts as an identifier. The "condition" argument can either be a boolean (make "true" to delete the entity), or a function with one argument as an entity in question (return "true" to delete and "false" or "nil" to keep the entity).

TransFix.RemoveClassNoSave(class, key) – Attempts to remove a class blacklist with the specified classname (the "class" argument) and identifier (the "key" argument). Prints an error message if there is no such blacklist.

TransFix.ClassNoSaveExists(class, key) – Checks if a class blacklist with the specified classname and identifier exists.

TransFix.GetClassNoSave(class, key) – Attempts to retrieve the function/boolean value of a class blacklist with the specified classname and identifier. Prints an error message if there is no such blacklist.