Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
Adventure Creator: Scripting guide

Welcome to Adventure Creator's scripting guide. You can use this guide to get detailed descriptions on all of ACs public functions and variables.
Please read this page before delving in!

Adventure Creator's scripts are written in C#, and use the 'AC' namespace, so you'll need to add the following at the top of any script that accesses them:

using AC;

Accessing ACs scripts is very simple: each component on the GameEngine and PersistentEngine prefabs, as well as all Managers, can be accessed by referencing their associated static variable in the KickStarter class, e.g.:

AC.KickStarter.settingsManager;
AC.KickStarter.playerInput;

Additionally, the Player and MainCamera can also be accessed in this way:

AC.KickStarter.player;
AC.KickStarter.mainCamera;

The KickStarter class also has functions that can be used to turn AC off or on completely:

You can detect the game's current state (cutscene, gameplay, or paused) from the StateHandler:

AC.KickStarter.stateHandler.IsInCutscene ();
AC.KickStarter.stateHandler.IsInGameplay ();
AC.KickStarter.stateHandler.IsPaused ();

If you want to place the game in a scripted cutscene, the StateHandler has functions for that, too:

AC.KickStarter.stateHandler.StartCutscene ();
AC.KickStarter.stateHandler.EndCutscene ();

All-scene based ActionLists, inculding Cutscenes and Triggers, derive from the ActionList class. Action List assets rely on the ActionListAsset class. Both classes have an Interact function, which will cause their Actions to run.

Global and Local variables can be read and written to with static functions in the GlobalVariables and LocalVariables classes respectively:

AC.LocalVariables.SetStringValue (int _id, string _value);

The best way to hook up custom code with AC is to use the EventManager. Custom events allow you to hook up your own code whenever AC performs common tasks, such as playing speech or changing the camera. A tutorial on writing custom events can be found here.

If you're using this guide to help write an integration script with another Unity asset, check out the Integrations page of the AC wiki - it may have what you're looking for!

More common functions and variables can be found under Section 12.7 of the AC Manual. Happy scripting!

AC.KickStarter.TurnOffAC
static void TurnOffAC()
Definition: KickStarter.cs:1144
AC.KickStarter.TurnOnAC
static void TurnOnAC()
Definition: KickStarter.cs:1128
AC.StateHandler.IsInGameplay
bool IsInGameplay()
Checks if the game is currently in regular gameplay.
Definition: StateHandler.cs:703
AC.StateHandler.IsPaused
bool IsPaused()
Checks if the game is currently paused.
Definition: StateHandler.cs:693
AC.LocalVariables.SetStringValue
static void SetStringValue(int _id, string _value)
Sets the value of a local String variable.
Definition: LocalVariables.cs:299
AC.KickStarter
Definition: KickStarter.cs:26
AC.GlobalVariables.GetBooleanValue
static bool GetBooleanValue(int _id, bool synchronise=true)
Returns the value of a global Boolean variable.
Definition: GlobalVariables.cs:162
AC.GlobalVariables
Definition: GlobalVariables.cs:22
AC.LocalVariables
Definition: LocalVariables.cs:24
AC
Definition: Action.cs:21
AC.StateHandler.IsInCutscene
bool IsInCutscene()
Checks if the game is currently in a cutscene, scripted or otherwise.
Definition: StateHandler.cs:683