Skip to content

[TF2] Game Instructor support and integration into training/notification HUD#469

Merged
Blixibon merged 5 commits into
mapbase-source:mapbase-mp-2025from
Blixibon:mapbase/mp-2025/tf-lessons
Sep 5, 2025
Merged

[TF2] Game Instructor support and integration into training/notification HUD#469
Blixibon merged 5 commits into
mapbase-source:mapbase-mp-2025from
Blixibon:mapbase/mp-2025/tf-lessons

Conversation

@Blixibon
Copy link
Copy Markdown
Member

@Blixibon Blixibon commented Sep 2, 2025

This PR makes several changes to adapt the Game Instructor into TF2, many of which were ported from TF2 Classic.


env_instructor_hint team and TF2 class support

This allows env_instructor_hint to transmit its team and spawnflags to the hint, filtering by team and player class. This was originally done for TF2C and has been tweaked so that the team value can be used in HL2DM mods as well.

TF2-style instructor hint HUD

This gives instructor hints background and text shadow panels to make it fit in with other HUD elements in TF2. This was also originally done for TF2C with changes made to coexist with the default hint appearance. This can also theoretically be used outside of TF2 mods by changing locator_background_style and having appropriate changes to the .res file, although this hasn't been tested.

Restore/port potential use target for Game Instructor with optional TF2 implementation

This partially ports the "potential use target" feature included in the Alien Swarm SDK, which can be used by the Game Instructor, but was lost when the Game instructor was initially brought over. It is essentially the entity that the player can immediately interact with, even if the player cannot literally initiate +USE on it. In L4D2, this is used to show hints about picking up items, giving items to teammates, among other things.

This PR also adds an optional implementation of this feature to TF2 for use in the Game Instructor and/or VScript. Normally, the potential use entity is calculated on demand, although a tf_scan_potential_use_target cvar can be used to enable periodically scanning and firing the use_target event for the potential use targets, which some instructor lessons may listen to. This cvar is enabled automatically if any lessons with use_target are detected.

Hook Game Instructor to TF training and notification HUD

This adds custom lesson actions for TF2 game logic and new lesson types for its HUD elements. Using a new lesson_type keyvalue, you can make a lesson use either the training HUD or the notification (game_text_tf) HUD instead of the default locator hint. Note that these hints may not support certain display keyvalues, such as icon targets.

As part of this integration, the training HUD now supports an optional image that can be specified in a lesson in the same way as a locator icon. This can also be used directly within training mode with a new ShowTrainingImage input on tf_logic_training_mode, although this blanks out the message content and must be fired earlier.

Example of an instructor lesson which uses the training HUD:

	"TF Training Objective Test"
	{
		"lesson_type"		"tf_training_objective"
		"group"				"tf_test_hints"
		
		"priority"			"30"
		"instance_type"		"2"
		"no_icon_target"	"1"
		
		"display_limit"		"3"
		
		"onscreen_icon"			"cyoa/cyoa_bg_icon_globe"
		"caption_param"			"Objective Hint"
		"caption"				"This is an instructor lesson which uses the training HUD."
		
		"timeout"				"10"

		"open"
		{
			"localplayer_respawn"
			{
				"void is roundstate"	"string running"
			}
		}
	}

202509~2

Note that these new hint types currently cannot be initiated with env_instructor_hint and must be defined in scripts/mod_lessons.txt or scripts/instructor_lessons.txt, although that may change in the future.

Additionally, this PR adds the previously missing c_mod_lesson_stubs.cpp from the Alien Swarm SDK with a new stub for custom lesson types, although it is excluded from the TF2 VPC.


PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

@Blixibon Blixibon force-pushed the mapbase/mp-2025/tf-lessons branch from 1e16cd0 to 5d17ac6 Compare September 2, 2025 20:49
@Blixibon Blixibon marked this pull request as ready for review September 2, 2025 21:16
@Blixibon Blixibon requested a review from azzyr September 2, 2025 21:16
@Blixibon Blixibon force-pushed the mapbase/mp-2025/tf-lessons branch from 5d17ac6 to 265818b Compare September 5, 2025 00:12
@Blixibon Blixibon merged commit 82ddf25 into mapbase-source:mapbase-mp-2025 Sep 5, 2025
4 checks passed
@Blixibon Blixibon deleted the mapbase/mp-2025/tf-lessons branch September 5, 2025 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants