Lua Functions

v1.0

The Juicy Actions integration provides Lua functions that can be called from Dialogue System Lua scripts, conditions, and dialogue entry fields. These functions provide programmatic control over ActionExecutor execution.

Available Functions

JuicyActions.Execute()

Executes an ActionExecutor immediately (fire and forget).

Syntax:

JuicyActions.Execute(actionExecutorFieldName, targetName)

Parameters:

  • actionName (string): Name of the public ActionExecutor field

  • targetGameObject (GameObject): Target GameObject reference

Returns:

void

Scope:

Automatically uses current conversation scope (or "lua" if called outside a conversation)

Example:

JuicyActions.ExecuteAndWait()

Executes an ActionExecutor and waits for it to complete. Blocks Lua execution - use only in sequencer Lua commands!

Syntax:

Parameters:

Same as Execute()

Returns:

void (blocks until completion)

⚠️ Important: This function blocks execution. Only use it:

  • In sequencer Lua commands: Lua(JuicyActions.ExecuteAndWait(...))

  • In coroutines where blocking is acceptable

  • Never in conditions or immediate Lua evaluations (will freeze the conversation!)

Example (in sequencer):


JuicyActions.Stop()

Stops all ActionExecutors with a specific scope or ID.

Syntax:

Parameters:

  • scopeOrId (string): Scope name or execution ID to stop

Returns:

void

Example:


JuicyActions.StopAll()

Stops all running ActionExecutors across all scopes.

Syntax:

Returns:

void

Example:

⚠️ Use with caution: This stops ALL Juicy Actions in the entire game, not just conversation-related ones.


JuicyActions.IsExecuting()

Checks if any ActionExecutors are currently running in a specific scope or ID.

Syntax:

Parameters:

  • scopeOrId (string): Scope name or execution ID to check

Returns:

boolean - true if executing, false otherwise

Example (in a condition):

Example (in a Script field):

Common Lua Patterns

Conditional Execution Based on Variables:

Execute Different Effects Based on Quest State:

Stop Previous Effects Before Starting New Ones:

Check if Effect is Running Before Triggering:


Accessing GameObjects in Lua

To reference GameObjects in Lua, use these methods:

Actor References (for participants in conversation):

GameObject.Find by name:

GameObject.FindWithTag:

Example:

Last updated