Skip to content

ContextualActionData

Inheritance 1 ancestor · 3 siblings · 1 descendant

Class Documentation

Edit documentation

A unit's set of contextual actions: voice lines, animations and events that play when something happens in the game, such as a spell cast, a kill or low health. The unit's contextual action component reads this object.

Which units run it

The client creates a contextual action component when it initializes a unit. The shopkeeper also has one. The component finds the unit's data through SkinCharacterDataProperties.mContextualActionData. Each component keeps its own state: the situation context, the cooldown timers and the play counts. The client does not test whether a unit belongs to the local player before it evaluates a situation, so every client evaluates the situations of every unit that has a component. Only the voice line event name depends on the viewer (see ContextualActionPlayAudio).

What fires a situation

A situation is a named game event, such as a kill, an attack order, a spell cast or an emote. The game event fires the situation on the components that it concerns. ContextualSituation lists the situation keys and the game event that fires each one. mHealthPercentThreshold sets the condition of one of them.

Order of a run

When a situation fires on a unit, the client runs these steps:

  1. It looks up the key in this object's mSituations and runs the audio action of the situation, with the gates that ContextualRule describes.
  2. In the same entry, it runs the user fact action, the mix state action, the champion music action and the announcer action, in this order.
  3. For each GlobalContextualActionData in AudioGlobalEventManager.GlobalContextualActionData, in list order, it runs the same four actions of the entry with the same key, against this unit's context. The audio action of a global object does not run.

If mSituations has no entry for the key, steps 1 and 2 do nothing. Each action kind chooses its own rule from the entry (see ContextualSituation). Animation and trigger event actions run only from some situations: IContextualAction lists them.

Cooldowns

Three cooldowns limit how often voice lines play:

Cooldown Scope Set by Applies to
Situation cooldown one situation on one unit ContextualSituation.mCoolDownTime the audio action of that situation
Shared cooldown all situations of the unit mCooldown audio actions of rules with ActiveVoiceOver
Rule cooldown one rule on one unit ContextualConditionRuleCooldown rules that have the condition

Each time starts when a voice line of a rule with ActiveVoiceOver ends, not when it starts. A rule whose ActiveVoiceOver is false never starts a cooldown. The other action kinds ignore all three cooldowns.

Properties

mCooldown

F32 = 0
Edit documentation

A cooldown, in seconds, shared by all situations of the unit. The unit's contextual action timer restarts when a voice line of a rule with ActiveVoiceOver ends. While the timer shows mCooldown seconds or less, the client skips every rule whose ActiveVoiceOver is true. The first voice line of the game is free, because the timer has not started yet.

A rule is exempt from the check when it sets mOverrideCacCooldown, or when its CooldownModifications sets IgnoreTimer (see ContextualActionCooldownModifications). A rule does not restart the timer when it sets mOverrideCacCooldown, or when its CooldownModifications sets DontResetTimer.

Rules whose ActiveVoiceOver is false do not check this cooldown.

mHealthPercentThreshold

F32 = 0
Edit documentation

A health fraction, from 0 to 1. When the unit takes damage and its health goes from above this value to this value or below, the client fires the situation HealthDroppedBelowThreshold for the unit. It fires once per crossing: health must rise above the threshold again before it can fire again. With 0, the situation fires only when health reaches 0.

The client reads the value only from the unit's own object. The value in a GlobalContextualActionData has no effect.

mObjectPath

String = ""
Edit documentation

The object's own path, such as Characters/Ahri/CAC/Ahri_Base. In shipped data it is the same string as the object's name. No reader of this value was found in the game client.

mSituations

Map<Hash, ContextualSituation> = {}
Edit documentation

The situations this unit reacts to, keyed by situation name. The key is the FNV-1a hash of the lowercased name, so a bin that writes the key as a string, such as HealthDroppedBelowThreshold, matches the client's own hash. Each value is a ContextualSituation.

When the situation happens, the audio action first checks the situation cooldown: if fewer than mCoolDownTime seconds have passed since a voice line of this situation ended, no voice line plays. The other actions of the situation still run. Then each action kind picks a rule. When mChooseRandomValidRule is false, it takes the first rule in mRules that is valid for that kind. When it is true, it picks one of the valid rules at random, weighted by each rule's ChanceWeight.

Referenced by 1 class · 1 property