Skip to content

Effects & Requests ​

Effects are resources stored in a CCEffectEntries resource. Each request for an effect reaches the script as an instance object.

Effect classInstance classUse
CCEffectCCEffectInstanceAn effect that happens once.
CCEffectParametersCCEffectInstanceParametersAn effect with options or a quantity.
CCEffectTimedCCEffectInstanceTimedAn effect that lasts for a duration.

CCEffectEntries ​

MemberUse
effects: Array[CCEffect]The effects of the game.
save_pack_zip(path: String) -> ErrorWrites the effect pack to upload in the developer portal: menu.json and the effect icons.
get_manifest() -> StringThe menu.json for these effects.
get_manifest_data() -> DictionaryThe same as a dictionary.

CCEffect ​

Properties ​

PropertyTypeDefaultUse
idStringNameUnique ID of the effect: letters, numbers, and underscores.
display_nameStringName shown to viewers.
descriptionStringDescription shown to viewers.
noteStringShort note shown next to the name.
priceint10Default price in coins, at least 1.
categoriesPackedStringArrayMenu categories.
groupsPackedStringArrayGroups the effect belongs to.
moralityNEUTRAL, GOOD, EVILNEUTRAL
orderlinessORDER_NEUTRAL, ORDERLY, CHAOTICORDER_NEUTRAL
visiblebooltrueWhether the effect is listed in the menu. Reported when a session starts and whenever it changes.
sellablebooltrueWhether the effect can be bought. Reported the same way.
session_maxint0Purchases allowed per session, 0 for no limit.
pooling_disabledboolfalseViewers may not pool coins for the effect.
conflictsPackedStringArrayIDs of effects it cannot run alongside.
customboolfalseUploaded by the game instead of being part of the effect pack.
max_retriesint3How often a request is retried before it is refunded.
retry_delayfloat5.0Seconds between retries.
iconTexture2DIcon shown in the effect menu, exported with the effect pack.
icon_colorColorFor your own UI.

Methods to Implement ​

MethodUse
_trigger(instance: CCEffectInstance) -> EffectResultRequired. Apply the effect.
_can_run() -> boolOptional. Whether the effect can run right now.

EffectResult ​

ValueMeaning
SUCCESSThe effect happened.
FAILUREIt could not happen right now; the viewer is refunded.
UNAVAILABLEIt cannot happen at all; the viewer is refunded.
RETRYTry again after retry_delay.
RUNNINGA timed effect is now active.

Other Methods ​

MethodUse
get_definition() -> DictionaryThe effect as it appears in menu.json.

CCEffectInstance ​

MethodUse
get_id() -> StringID of the request.
get_effect() -> CCEffectThe effect resource.
get_effect_id() -> StringNameIts ID.
get_user() -> StreamUserThe viewer.
is_test() -> boolWhether the request is a test.
is_local() -> boolWhether it came from CrowdControl.test_effect().
get_retry_count() -> intHow often the request has been retried.

CCEffectParameters ​

Parameters are edited in the Inspector through parameter_count and parameter_N/name, id, kind, options, min, and max. They can also be built from code:

MethodUse
add_item_parameter(name: String, options: PackedStringArray)Adds a list of options. Its ID is <effect id>_<name in lowercase>.
add_range_parameter(name: String, min: int, max: int)Adds a quantity. Name it Quantity to get the ID quantity.
remove_parameter(idx: int), clear()Removes one or all parameters.
get_parameter_count() -> intNumber of parameters.
get_parameter_id(idx: int) -> StringID of a parameter.

CCEffectInstanceParameters ​

MethodUse
get_option_name(id: String) -> StringName of the option the viewer picked for a parameter.
get_parameter(id: String) -> VariantValue of a parameter: an int for quantity.
get_parameter_names() -> PackedStringArrayIDs of the parameters of the request.

CCEffectTimed ​

PropertyTypeDefaultUse
durationfloat60.0Default duration in seconds, 1 to 600.

Methods to Implement ​

MethodUse
_start(instance: CCEffectInstanceTimed) -> EffectResultRequired. Apply the change and return RUNNING.
_stop(instance: CCEffectInstanceTimed, force: bool) -> boolRequired. Undo the change.
_pause(), _resume(), _reset()Optional.
_should_be_running() -> boolOptional. Whether the effect should currently be active.

CCEffectInstanceTimed ​

MethodUse
get_duration() -> floatDuration of this request in seconds.
get_time_left() -> floatSeconds remaining.
is_paused() -> boolWhether the effect is paused.
get_effect_timed() -> CCEffectTimedThe effect resource.

StreamUser ​

PropertyTypeUse
nameStringName of the user.
display_nameStringDisplay name of the user.
profile_iconTexture2DTheir avatar, once downloaded.
profile_icon_urlStringWhere the avatar comes from.
rolesPackedStringArrayRoles of the user on the channel.
origin_siteStringPlatform of the streamer, for example twitch. Only set for the streamer.
SignalWhen
icon_downloadedprofile_icon is available.