Difficulty Detection Example

Half-Life HL
Difficulty Detection Example by Windawz
Posted 3 years ago2021-12-17 21:42:43 UTC • Examples • Half-Life
Loading...
Screenshot Thumbnail
Screenshot Thumbnail
Screenshot Thumbnail
Name
Difficulty Detection Example
By
Windawz Windawz
Type
Map
Engine
Goldsource
Game
Half-Life
Category
Examples
Included
RMF/VMF
Created
3 years ago2021-12-17 21:42:43 UTC
Updated
3 years ago2021-12-18 00:56:48 UTC
Views
1407
Downloads
309
Comments
1

Foreword

As you may know, vanilla Half-Life maps cannot directly detect the current difficulty selected by the user. Unlike Quake 1, Half-Life does not have the "Not in *" family of spawnflags, except for "Not in Deathmatch".

This example shows how to leverage monster health defined in skill.cfg to detect whether the difficulty is easy, normal, or hard (skill cvar equal to 1, 2, and 3 respectively).

It is able to determine the difficulty in 1 second. Attempts to make it faster resulted in loss of precision and unreliable difficulty detection. If you've been able to shrink that time even further, please upload the modified map and notify me, so that I can leave a link.

The setup has been tested once with the following framerate caps: 15, 30, 45, 60, 100, 500, and worked properly on each.

As long as you don't have any entities colliding with the names used used in the skselect setup, you may remove the skgauge setup and straight up copy the rest of the map over, then use the "hook" Target names listed below.

In case you've discovered an issue, contant me. Leave a comment preferably. I read them.

Setup Description

There are two groups of entities:
  • skselect: The main skill selection mechanism. It triggers the following Targets (as a kind of hooks), corresponding to the detected skill. To use the setup, name whatever entity you want to be triggered if a specific skill level is detected as one of these values:
    • skselect_on_1,
    • skselect_on_2,
    • skselect_on_3.
Note
A more detailed description of skselect is available in the readme file.
  • skgauge: The "gauge" or indicator that uses the skill selection mechanism and shows what difficulty is selected as soon as the process is over.

1 Comment

Commented 3 years ago2021-12-19 11:40:19 UTC Comment #103887
Very neat idea. Thanky for sharing!

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