All the possible scene events.
Special game variables: vanilla inventory items, chapter, etc. The sceneric game variables, used to control the game state, are not in this enum.
All the possible scene load modes (why the scene is being loaded).
ReadonlyobjectsAn iterable property that allows iteration over all objects (actors) in the scene. This provides a convenient way to iterate through all scene objects using for...of loops. Also provides length property and [index] operator.
ReadonlywaypointsAn iterable property that allows iteration over all waypoints in the scene. This provides a convenient way to iterate through all scene waypoints using for...of loops. Also provides length propery and [index] operator.
ReadonlyzonesAn iterable property that allows iteration over all zones in the scene. This provides a convenient way to iterate through all scene zones using for...of loops. Also provides length propery and [index] operator.
Subscribe to beforeLoadScene event. This event is called right before a scene is loaded by any reason.
Must be SceneEvents.beforeLoadScene
The callback that receives the arguments.
Optionalname: stringA name can be given to the event listener to unregister it later.
Subscribe to afterLoadScene event.
This is the main entry point for the mod for each particular scene.
This event is called right after the scene is fully loaded from SCENE.hqr, but before any previously saved game state is applied.
This is called when new game is started, when game is loaded, and also during the game, when you move between scenes.
In this call the scene state is allowed to be modified.
Use this call to setup everything in your mode: modify scene objects, zones, variables, as if the HQR file itself would have contained the desired modifications.
Also in this call you will have to register life handlers, coroutines and do other mod initializations.
See Samples for examples of usage of this event.
Must be SceneEvents.afterLoadScene
The callback that receives the arguments.
Optionalname: stringA name can be given to the event listener to unregister it later.
Subscribe to afterLoadSavedState event.
This event is called right after the game is loaded from a save file or a backup state.
Must be SceneEvents.afterLoadSavedState
The callback of the event
Optionalname: stringA name can be given to the event listener to unregister it later.
Only use this if you know what you are doing.
This is called only when the game is loaded from a saved state, not when a new game is started or when moving between scenes.
If the game is loaded, this is called after SceneEvents.afterLoadScene event, so at this point, any modifications you might have made to the scene objects, zones, and variables in the SceneEvents.afterLoadScene, will have been overwritten by the saved game state.
Adds one or several new GameObjects (actors) to the scene. The objects will be added at the end of the scene objects list. The objects will be initialized with default values, so you need to set its properties before using it.
Optionalcount: numberThe number of objects to add. If not specified, it will try to add one object.
The id of the first added object. The subsequent objects will have consecutive ids (i.e., firstId + 1, firstId + 2, etc.)
Adds one or several new waypoints to the scene. The waypoints will be added at the end of the scene waypoints list. The waypoints will be initialized with zeros, so you need to call Scene.updateWaypoint to set their positions before using them.
Optionalcount: numberThe number of waypoints to add. If not specified, it will try to add one waypoint.
The id of the first added waypoint. The subsequent waypoints will have consecutive ids (i.e., firstId + 1, firstId + 2, etc.)
Adds one or several new Zones to the scene. The zones will be added at the end of the scene zones list. The zones will be initialized with zeros, so you need to set its properties before using it.
Optionalcount: numberThe number of zones to add. If not specified, it will try to add one zone.
The id of the first added zone. The subsequent zones will have consecutive ids (i.e., firstId + 1, firstId + 2, etc.)
Returns the first unused zone value (zone number) for the given zone type.
The zone value are used in the script commands for sceneric, camera, ladder, and other zones.
One zone value can be assigned to one or multiple zones of a particular type, so they act the same way, as a group of zones.
The type of the zone to find a free value for
OptionalexceptZoneId: numberThe ID of a zone to exclude from the search
Returns the amount of current planet's money the hero has. If the hero is on Twinsun, this returns Gold. If on Zeelich, this returns Zlitos. This is the currency displayed in the main hero menu.
The amount of current planet's currency
Returns the amount of foreign planet's money the hero has. If the hero is on Twinsun, this returns Zlitos. If on Zeelich, this returns Gold. This currency is displayed as an inventory item.
The amount of foreign planet's currency
Returns a game variable value by its index The game variables (aka VAR_GAME) are used by the original game scripts in the scope of the whole game. They are not reset when the scene is reloaded, or when navigating between scenes.
The whole legacy inventory of the game is managed by the game variables, as well as current chapter, and some other game states.
The index of the variable to get from 0 to 255
Returns the amount of Gold (Twinsun currency) the hero currently has.
The amount of gold in the hero's possession
Returns the current scene ID.
Returns the current island ID.
Returns the current magic level of the hero. To change this value use Life script commands.
The current magic level of the hero
Returns the current magic points of the hero. To change this value use Life script commands.
The current magic points of the hero
Returns the number of the small keys the hero has. To change this value use Life script commands.
The number of keys the hero has
Returns the number of the current scene objects, if the scene is loaded.
Returns the number of waypoints in the current scene. The waypoints are used by the original game scripts to navigate.
Returns the number of the current scene zones, if the scene is loaded.
Returns a scene GameObject at the given index. The index is zero-based. The player object is 0. The NitroMecaPingouin is 1.
The index of the object to get.
The object at the given index.
Returns the current planet ID.
Returns the start position of the player in the current scene. The start position is used in the new game or if player teleports to this scene.
Array of 3 values representing the position as [x, y, z]
Returns a scene variable value by its index The scene variables (aka VAR_CUBE) are used by the original game scripts in the scope of the current scene. They reset to their default values when the scene is reloaded (also when navigating between scenes).
The index of the variable to get from 0 to 79
Returns a waypoint from the scene, at the given index. The index is zero-based.
The index of the waypoint to get.
The waypoint at the given index as an array of three numbers (x, y, z).
Returns the amount of Zlitos (Zeelich currency) the hero currently has.
The amount of zlitos in the hero's possession
Returns a Zone from the scene, at the given index. The index is zero-based.
The index of the zone to get.
The zone at the given index.
Unregisters a previously registered event callback.
Sets the amount of current planet's money the hero has. If the hero is on Twinsun, this sets Gold. If on Zeelich, this sets Zlitos. This is the currency displayed in the main hero menu.
The amount of current planet's currency to set
Sets the amount of foreign planet's money the hero has. If the hero is on Twinsun, this sets Zlitos. If on Zeelich, this sets Gold. This currency is displayed as an inventory item.
The amount of foreign planet's currency to set
Sets a game variable value by its index.
The index of the variable to set from 0 to 255
The value to set the variable to, from -32,768 to 32,767
Only use it to read / set inventory and existing LBA game variables in order to integrate your mod with the rest of the game.
Do not create new game variables for your mod, using this function! Use the javascript store variables instead to persist your mod state.
The classic game variables (aka VAR_GAME) are used by the original game scripts in the scope of the whole game. They are not reset when the scene is reloaded, or when navigating between scenes.
The whole legacy inventory of the game is managed by the game variables, as well as current chapter, and some other game states.
Sets the amount of Gold (Twinsun currency) the hero has.
The amount of gold to set
Sets a start position of the hero The start position is used in the new game or if player teleports to this scene.
Array of 3 values representing the position as [x, y, z]
Sets a scene variable value by its index.
The index of the variable to set from 0 to 79
The value to set the variable to, from 0 to 255
You should not use this for your new variables in the mods. Use the javascript variables instead:
The classic scene variables (aka VAR_CUBE) are used by the original game scripts in the scope of the current scene.
They reset to their default values when the scene is reloaded (also when navigating between scenes).
Sets the amount of Zlitos (Zeelich currency) the hero has.
The amount of zlitos to set
Updates the position of a waypoint in the scene. Any changes to the waypoints are not saved to the saved game file.
This function can be used outside of scene setup, during move and life flows. However, if you are using it outside of the scene setup, use it with caution, and make sure to persist any changes in your custom scene variable, if you need them. The updated waypoint coordinate will not be saved to the saved game file automatically.
This allows to have dynamic waypoints that can be updated during the game.
Be careful to not update waypoints that are used by current running scripts, as it may lead to unexpected behavior.
The index of the waypoint to update
The new position of the waypoint as an array of three numbers (x, y, z)
Private_Private_PrivateSets an Ida save handler callback to handle saving the game state to a file.
The callback that receives isBackupSave as an argument.
Represents a scene in the LBA game. Provides access to the scene life cycle events. Allows to do the scene setup operations with objects, zones and waypoints. Provides access to the LBA2 classic scene and game variables.
This object is globally accessible through scene.