Перейти к основному содержимому

Dynamic Music Track

Music track that reacts to game facts

A dynamic music track plays a base music loop and optionally activates additional layers based on a readable fact entry.

Поля

ПолеТипПо умолчаниюОписание
baseTrackVar<Sound>EMPTYBase music track that always plays when active
sfxLayerVar<Sound>?—Optional sfx layer that activates when the trigger fact is met
melodyLayerVar<Sound>?—Optional melody layer that activates when the trigger fact is met
triggerFactRef<ReadableFactEntry>—The readable fact entry to check (e.g., a danger_level fact)
activationThresholdInt1Fact value threshold to activate additional layers
checkIntervalDurationofSeconds(5)How often to check the fact value (in seconds)
layerAudioLayerMUSICAudio layer for music. All three sounds go through the mixer on this layer, so they follow the player's volume for it.Значения:MASTERMUSICAMBIENTSFXVOICE
Общие поля TypeWriter (criteria, modifiers, triggers)
ПолеТипПо умолчаниюОписание
criteriaList<Criteria>empty—
modifiersList<Modifier>empty—
triggersList<Ref<TriggerableEntry>>empty—

How to use it​

When the action runs, baseTrack starts once. Every checkInterval, the extension reads triggerFact for the player: when the value reaches activationThreshold, sfxLayer and melodyLayer start; when it falls back below, they are stopped. The check continues until the player leaves. All three sounds play through the mixer on layer, so they follow the player's volume for it (a layer set to 0 means silence).

The base track is not repeated by the extension: use a sound long enough, or one that loops in your resource pack.