Skip to main content

Generator

You can find a video tutorial for Generators ▶ here.

Generators generate values over time by targeting other stats.

It is commonly used for gameplay mechanics such as Health regeneration, Mana regeneration, Energy recovery, or resource production.

Generator Signature​

The Generator Signature defines how a Generator Stat behaves at runtime.

Fields​

FieldDescription
Use Turn StatUses a Stat instead of a predefined Turn value.
TurnThe predefined Turn value used by the Generator.
Turn StatThe Int Stat that provides the Turn value when Use Turn Stat is enabled.
Turn Stat Value AdapterA Value Adapter applied to the Turn Stat before its value is used as the Turn value.
UpdaterThe Updater Id that determines which Updater executes this Generator.
Use IntervalDetermines whether generation occurs at fixed intervals or continuously over time. When disabled, the Generator value represents the amount generated per second.
Use Interval StatUses a Stat instead of a predefined Interval value.
IntervalThe predefined Interval value used by the Generator when Use Interval Stat is disabled.
Interval StatA Stat From lookup supplying the interval: a Float for realtime Generators or an Int for turn-based Generators. Changes update the running Generator; disposal removes the subscription.
StackableDetermines how Modifier values are generated. When enabled, all Modifier values are combined and generated as a single value. When disabled, each Modifier is generated independently.
ToggleableAllows the Generator to be enabled or disabled based on the value of a Toggle Stat.
Toggle Stat KeyThe Stat Key of the Toggle Stat. The referenced Stat must be an Int Stat.
Toggle On Value TypeDetermines when the Generator is active based on the Toggle Stat's value. See Toggle On Value Types below.
Toggle Off On ZeroStops generation when the Generator's value is 0. Generation automatically resumes when the value becomes non-zero.
Generating Effect TemplateDefines the Effect used to apply generated values. Generators never modify target Stats directly; instead, they generate through an Effect, allowing the normal Effect processing pipeline to be used.
Target OthersOff (default): each generated Effect goes to the Generator's own actor. On: it goes to the actors picked by Generating Target on every tick, each receiving its own copy.
Generating TargetWho receives the generated Effect when Target Others is on: Relation State (actors related to Relate To by Target Relation, narrowed by a Targeting Filter), Team Flags, Custom (a Custom Targeter), Actor Stat, Source or Target.
Override Target EnvironmentSends the generated Effect into another Environment of the receivers.
State CheckA tick sends its Effect only when the check passes (a single stat or several stats with their conditions), read with Source = the actor that started the Generator and Target = its own actor.

Targeting other actors​

A Generator with Target Others handles anything that should act on other actors on a timer: a status spreading to nearby foes, a pulsing aura, a periodic area hit. Use an EffectPack Generator when one tick should apply several Effects.

The receivers are looked up again on every tick of every Generator. Many Generators ticking at short intervals cost more, so prefer a longer interval or a narrower filter (a distance limit, "doesn't have the status yet") when it shows.

Stat-driven intervals​

Enable Use Interval and Use Interval Stat to let upgrades change the interval without rebuilding the Generator. The referenced Stat must exist on the selected Actor. For a global player-controlled rate, a Stat From can use Actor → Static Actor, Static Actor → Player, and the player's interval key. Kodes' EchoGap scales the interval this way.

Toggle On Value Types​

ValueDescription
On ZeroThe Generator is active when the Toggle Stat's value is 0.
On PositiveThe Generator is active when the Toggle Stat's value is greater than 0.

Types​

  • Float
  • Int
  • Vector3
  • Vector2
  • Vector3Int
  • Vector2Int
  • EffectPack