Core GameKit Support

This page describes how to set up the Dialogue System with Core GameKit (Core GameKit is required.)

Core GameKit copyright © Dark Tonic Studios.

Core GameKit Support Features

The support package adds these features:

  • Lua access (e.g., in conversations) to World Variables (read/write) and current level/wave values (read-only).
  • World Variable listeners that can synchronize Lua variables and World Variables on the fly.
  • Sequencer commands to control waves, spawning and despawning, and spawned object attributes.

How to Set Up Core GameKit Support

To set up the Dialogue System with Core GameKit, import the package Third Party Support ► Core GameKit Support.

Example Scene

The example scene contains an NPC that you can converse with to control Core GameKit inside a conversation.

The scene starts in Wave 1, which is an empty wave that doesn't spawn anything. In the conversation, you can end the wave and progess to Wave 2 (select the responses "Wave Control", then "End Wave"), which will spawn enemy soldiers.

You can also manually spawn and despawn enemies and change their hit points and attack points during the conversation.

Core GameKit Lua Bridge & Listeners

The Core GameKit Lua Bridge component synchronizes Core GameKit's level settings and world variables with the Dialogue System's Lua environment. It automatically synchronizes before and after conversations, and you can synchronize manually using SyncToLua() and SyncFromLua().

World Variables

For every Core GameKit world variable, there will be a corresponding entry in the Lua environment's Variable[] table. Spaces and hyphens in variable names will be replaced with underscores. For example:

Core GameKit world variable Dialogue System Lua equivalent
Experience Points Variable["Experience_Points"]

The Lua variables below will also be set as read-only. They won't be synchronized back to Core GameKit.

Variable Description
Variable["Current_Level"] Current level number.
Variable["Current_Wave"] Current wave number in the current level.
Variable["Current_Wave_Length"] Length of the current wave in seconds.
Variable["Current_Wave_Time_Remaining"] Seconds remaining in the current wave.

Listeners

The World Variable To Lua and Lua To World Variable listeners can be used to keep Lua and Core GameKit' world variables synchronized.

Listener Description
World Variable To Lua Listens for changes to world variables. When they change, the listener updates the corresponding Lua variable.
Lua To World Variable Listens for changes to Lua variables. When they change, the listener updates the corresponding world variable.

Sequencer Commands

The support package adds the following sequencer commands. You can use them in any cutscene sequence.

Sequencer Command Description
CoreGameKitPauseWave() Pauses the current wave.
CoreGameKitUnpauseWave() Unpauses the current wave.
CoreGameKitRestartWave() Restarts the current wave.
CoreGameKitEndWave() Ends the current wave.
CoreGameKitGotoWave(levelNumber, waveNumber) Goes to a specific wave.
CoreGameKitGameOver() Ends all waves.
CoreGameKitSynchroSpawn(spawner[, min[, max]]) Tells a spawner to spawn a single object, or a random amount if you specify min and max. Provide the name of the spawner.
CoreGameKitDespawnKillable(killable) Despawns a killable object. You can omit "(Clone)".
CoreGameKitDestroyKillable(killable[, scenarioName]) Destroys a killable object. You can omit "(Clone)".
CoreGameKitAddAttackPoints(killable, pointsToAdd) Adds attack points to a killable. You can omit "(Clone)".
CoreGameKitAddHitPoints(killable, pointsToAdd)() Adds hit points to a killable. You can omit "(Clone)".
CoreGameKitTakeDamage(killable, damagePoints) Does damage to a killable. You can omit "(Clone)".
CoreGameKitTemporaryInvincibility(killable, seconds) Makes a killable object invincible for a duration. You can omit "(Clone).
`CoreGameKitFireCustomEvent(customEventName[, origin])` Fires a custom event. Origin defaults to (0,0,0) if omitted.

<< Third Party Integration