Skip to main content
The Item class represents any collectible object placed on a side in a RollingQuest level. Scripts attached to an item receive it as self in hooks such as OnCollect and OnRespawn. You can read the item’s state, programmatically collect it for any ball, and toggle its presence in the level. RollingQuest ships with a large library of typed item sub-classes — from simple collectibles like ItemCoin to gameplay modifiers like ItemSlowMotion — all inheriting the properties and methods described here.

Properties

Identity

Transform

State

Methods

collect

Forces the specified ball to collect this item immediately, triggering the normal collection logic.

enable / disable

Show or hide the item. A disabled item is invisible and cannot be collected until re-enabled.

Type-cast helpers

Use these when you hold a generic entity reference and need to narrow its type. Each throws an error if the cast is invalid.

ItemData

ItemData is the raw, mutable representation used when building level data (e.g. in OnLevelLoad). It exposes template, scriptRef, scriptTag, scriptVars, and properties as writable fields, plus isRespawnEnabled and respawnTime which control whether the item reappears after being collected. Call clear() to reset it to defaults.

Item Subtypes

All of the following sub-classes inherit every property and method from Item. You receive the most specific type automatically when accessing items at runtime.

Custom Events

Most Item sub-classes don’t emit custom events. The exception is ItemPortalEntrance, which fires when the portal teleports a ball. Listen for it with the OnCustomEvent hook.

Usage Example

The OnCollect hook fires when a ball collects the item. The example below logs the collector’s name and disables the item for 5 seconds before re-enabling it:
You can also collect an item manually from another script — for example when a ball steps onto a trigger side: