KDScript

Subtitles

ParameterTypeDescriptionDefault value
subtitle_colorcolorcolor of the subtitle text (and border)0xffffff (white)

The KDSubtitledAI and KDSubtitledVO scripts provide automatic subtitling of AI speech and voiceovers, respectively. They share the common setup discussed here.

Subtitles are taken from the strings\subtitles.str file, where they are identified by schema name; if no subtitle is present for a schema, nothing will be shown. In addition to the trigger for each script below, a subtitle can be displayed by sending the script a Subtitle message whose data is the object name or number of the schema.

By default, subtitles are displayed like other onscreen text in the top center of the screen. If the subtitles_use_hud quest variable is set to 1, subtitles will be displayed as HUD elements instead. These are individual boxes of text that track the position of the speaker and do not overwrite each other or other text. See the custom HUD elements documentation for more details.

The subtitle is displayed in subtitle_color, which may be set either on the schema object (takes priority) or another relevant object (see below). If the Script→Timing property is set on the schema object, it determines how long, in milliseconds, the subtitle is displayed; otherwise, an appropriate length is calculated based on the text.

KDSubtitledAI

When the AI it is placed on plays a speech schema, KDSubtitledAI displays a subtitle for that schema on screen.

The subtitle_color parameter may be set on the AI itself, as a default for all the AI's speech schemas.

For convenience, this script can be placed on the Creature archetype to be inherited by all AI. (Any AI archetype or instance with the “Don't Inherit” option on its Scripts property would need to re-add the script to use it. In the stock T2 (TMA) dark.gam, these are Rat, ScurryBot, and Phantom.)

KDSubtitledVO

When the VOTrap (or other trap with a SoundDescription link) it is placed on is turned on, KDSubtitledVO displays a subtitle for the linked schema on screen. There should only be one SoundDescription link from the object. The subtitle for a schema will only be displayed once in a mission, like the schema itself.

The subtitle_color parameter may be set on the Player object (via the starting point or the Garrett archetype), as a default for all voiceover schemas.

For convenience, this script can be placed on the VOTrap archetype to be inherited by all voiceovers.

These scripts are part of the KDScript module. Copyright © 2012–2013 Kevin Daughtridge. See introduction for details.