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
| Field | Description |
|---|---|
| Use Turn Stat | Uses a Stat instead of a predefined Turn value. |
| Turn | The predefined Turn value used by the Generator. |
| Turn Stat | The Int Stat that provides the Turn value when Use Turn Stat is enabled. |
| Turn Stat Value Adapter | A Value Adapter applied to the Turn Stat before its value is used as the Turn value. |
| Updater | The Updater Id that determines which Updater executes this Generator. |
| Use Interval | Determines whether generation occurs at fixed intervals or continuously over time. When disabled, the Generator value represents the amount generated per second. |
| Use Interval Stat | Uses a Stat instead of a predefined Interval value. |
| Interval | The predefined Interval value used by the Generator when Use Interval Stat is disabled. |
| Interval Stat | A 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. |
| Stackable | Determines 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. |
| Toggleable | Allows the Generator to be enabled or disabled based on the value of a Toggle Stat. |
| Toggle Stat Key | The Stat Key of the Toggle Stat. The referenced Stat must be an Int Stat. |
| Toggle On Value Type | Determines when the Generator is active based on the Toggle Stat's value. See Toggle On Value Types below. |
| Toggle Off On Zero | Stops generation when the Generator's value is 0. Generation automatically resumes when the value becomes non-zero. |
| Generating Effect Template | Defines 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 Others | Off (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 Target | Who 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 Environment | Sends the generated Effect into another Environment of the receivers. |
| State Check | A 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
| Value | Description |
|---|---|
| On Zero | The Generator is active when the Toggle Stat's value is 0. |
| On Positive | The Generator is active when the Toggle Stat's value is greater than 0. |
Types
- Float
- Int
- Vector3
- Vector2
- Vector3Int
- Vector2Int
- EffectPack