Sonic the Hedgehog (2006) Script Functions
{set_layer}:{actor_name} (without the brackets, of course). Otherwise, the actor names can be provided as-is.Global Namespace
These functions are provided as globals.
Signal
Description
Unknown.
Signature
Signal({}, unknown)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| N/A | Table | Unknown. | ✔️ |
| unknown | Number | Unknown. Used as a message parameter. | ❓ |
Results
None.
Shoot
Description
Unknown.
Signature
Shoot({}, unknown)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| N/A | Table | Unknown. | ✔️ |
| unknown | Unknown | Unknown. | ❓ |
Results
None.
Game Namespace
These functions are provided by the Game library.
Game.SetPlayer
Description
Sets default player parameters for the stage. These are only used if the stage set does not provide player start objects.
Signature
Game.SetPlayer(x, y, z, yaw, player_name, player_no, amigo)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| x | Number | The default X position of the player. | ✔️ |
| y | Number | The default Y position of the player. | ✔️ |
| z | Number | The default Z position of the player. | ✔️ |
| yaw | Number | The default yaw rotation of the player in degrees. | ✔️ |
| player_name | String | The file name of the player script. | ✔️ |
| player_no | Number | The identifier of the player object. | ❌ |
| amigo | Boolean | Determines whether the player object is for an amigo. | ❌ |
Results
None.
Game.StartEntityByName
Description
Starts the specified entity that was spawned in as inactive.
Signature
Game.StartEntityByName(name)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| name | String | The name of the entity to start. | ✔️ |
Results
None.
Game.Signal
Description
Sends a signal message to the specified entity.
Signature
Game.Signal(name) Game.Signal(name, unknown)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| name | String | The name of the entity to signal. | ✔️ |
| unknown | Number | This parameter is unused. It was likely used for optional data to pass to the message receiver. It isn't used by any of the scripts in the game. | ❌ |
Results
None.
Game.PlayBGM
Description
Plays the specified sound bank entry from bgm.sbk as background music for the stage. This is overridden by mission_bgm in the Mission Parameters.
Signature
Game.PlayBGM(name)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| name | String | The name of the sound bank entry. | ✔️ |
Results
None.
Game.StopBGM
Description
Stops the current background music in the stage.
Signature
Game.StopBGM()
Results
None.
Game.SetGenArea
Description
Sets the bounding box for entities to spawn within.
Signature
Game.SetGenArea({})
Parameters
| Parameter | Type | Description | Required? | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| N/A | Table |
|
✔️ |
Results
None.
Game.LoadTerrain
Description
Loads all of the terrain models and collision from the specified directory. This is overridden by mission_terrain in the Mission Parameters.
Signature
Game.LoadTerrain(path) Game.LoadTerrain(path, optimize_world)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to load from. | ✔️ |
| optimize_world | Boolean | This feature is unimplemented. It was likely intended for Havok optimizations. | ❌ |
Results
None.
Game.LoadSky
Description
Loads the sky model from the specified directory.
Signature
Game.LoadSky(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to load from. | ✔️ |
Results
None.
Game.LoadStageSet
Description
Loads the specified stage set. This function expects a path to a *.set file with a *.xml file extension.
Signature
Game.LoadStageSet(path) Game.LoadStageSet(path, layer)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
| layer | String | The name of the set layer. | ❌ |
Set Layers
| Name | Description |
|---|---|
| default | The default layer used when no layer is specified. |
| design | The layer used for additional details. |
| particle | The layer used for particle effects. |
| test | The layer used for testing purposes. |
| area | The layer used for area design that is usually static between new layouts. |
| pathobj | The layer used for common_path_obj objects.
|
Results
None.
Game.LoadPath
Description
Loads the specified spline path. This function expects a path to a *.path file without a file extension.
Signature
Game.LoadPath(path) Game.LoadPath(path, layer)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
| layer | String | The name of the path layer. | ❌ |
Path Layers
| Name | Description |
|---|---|
| (null) | The default layer used when no layer is specified. |
| grind | The layer used for grind rails. |
| guide | The layer used for guide paths for loops and surfaces that move the player forwards only. |
| pathobj | The layer used for common_path_obj objects.
|
| physicspath | The layer used for physicspath objects. This layer is unused and said objects tend to use the default layer.
|
Results
None.
Game.LoadParticle
Description
Loads the specified particle container. This function expects a path to a *.plc file.
Signature
Game.LoadParticle(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadSceneParams
Description
Loads the specified Lua script containing the necessary tables for Scene Parameters. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadSceneParams(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadLight
Description
Loads the specified Lua script containing the necessary tables for light parameters. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadLight(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadSceneEnvMap
Description
Loads the specified texture to use as the environment map for the stage. This function was superseded by the EnvMap table in the Scene Parameters.
Signature
Game.LoadSceneEnvMap(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadReflectionAreas
Description
Loads the specified reflection area. This function expects a path to a *.rab file. This function was superseded by the ReflectionAreas table in the Scene Parameters.
Signature
Game.LoadReflectionAreas(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadSoundBank
Description
Loads the specified sound bank for stage-specific sound effects. This function expects a path to a *.sbk file without a file extension.
Signature
Game.LoadSoundBank(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadVoiceBank
Description
Loads the specified sound bank for stage-specific voice clips. This function expects a path to a *.sbk file without the file extension. The specified sound bank must have a _e suffix, the game will automatically locate the Japanese sound bank if it's present.
Signature
Game.LoadVoiceBank(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadCameraParam
Description
Loads the specified Lua script containing the necessary constants for camera parameters. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadCameraParam(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadRenderScript
Description
Loads the specified Lua script containing the necessary functions and constants for a render script. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadRenderScript(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadKynapse
Description
Loads the specified Kynapse Big File for AI agent parameters, navigation meshes and spatial graphs. This function expects a path to a *.kbf file.
Signature
Game.LoadKynapse(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadTownsmanInfo
Description
Loads the specified Lua script containing the necessary tables and constants for NPC info. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadTownsmanInfo(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadRaderMap
Description
Loads the specified package for the radar model. This function expects a path to a *.pkg file without a file extension.
Signature
Game.LoadRaderMap(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadObjectPhysics
Description
Loads the specified object physics parameter list. This function was superseded by the game loading a static file from object.arc called Common.bin.
Signature
Game.LoadObjectPhysics(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadExplosion
Description
Loads the specified object explosion parameter list. This function was superseded by the game loading a static file from object.arc called Explosion.bin.
Signature
Game.LoadExplosion(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadEnemy
Description
Loads the specified enemy parameter list. This function was superseded by the game loading a static file from enemy.arc called ScriptParameter.bin.
Signature
Game.LoadEnemy(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.LoadShot
Description
Loads the specified enemy shot parameter list. This function was superseded by the game loading a static file from enemy.arc called ShotParameter.bin.
Signature
Game.LoadShot(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.DebugCommand
Description
Executes a debug command.
Signature
Game.DebugCommand(command)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| command | String | The command to execute. | ✔️ |
Commands
| Name | Parameters | Description |
|---|---|---|
| shadowcameradist | Double | Sets the shadow camera distance to the specified value. |
Results
None.
Game.LoadTimeLight
Description
Loads the specified Lua script containing the necessary tables and constants for time light parameters. This function expects a path to a *.lub file with a *.lua file extension.
Signature
Game.LoadTimeLight(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
None.
Game.ProcessMessage
Description
Signature
Game.ProcessMessage(actor_id, message_name)
Game.ProcessMessage(actor_id, message_name, {})
Game.ProcessMessage(actor_name, message_name)
Game.ProcessMessage(actor_name, message_name, {})
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| actor_id | Number | The ID of the actor to send the message to. | ✔️ |
| actor_name | String | The name of the actor to send the message to. Singletons for the level and player can be accessed by providing either LEVEL or PLAYER here.
|
✔️ |
| message_name | String | The name of the message to send. | ✔️ |
| N/A | Table | The message data to send, if required. | ❌ |
Messages
| Name | Description | Data | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Shoot | Shoots an object towards the specified actor. |
| ||||||||||||||||||||||||
| GateOpen | Opens a gate. | None. | ||||||||||||||||||||||||
| GateClose | Closes a gate. | |||||||||||||||||||||||||
| CallEvent | Calls a generic event handler function from the current area script. |
| ||||||||||||||||||||||||
| Switch | Calls a switch object event handler function from the current area script. |
| ||||||||||||||||||||||||
| FixCamera | Sets a new camera origin and looks at a specific point. |
| ||||||||||||||||||||||||
| ControlPause | Determines whether the player can pause the game. |
| ||||||||||||||||||||||||
| NotifyRestart | Notifies the actor that the stage has been restarted. | None. | ||||||||||||||||||||||||
| PsiEffect | Determines whether the specified actor uses the psychokinesis effect. |
| ||||||||||||||||||||||||
| TornadoShoot | Shoots an object towards the specified actor. |
| ||||||||||||||||||||||||
| PlaySE | Plays a sound effect. |
|
Results
None.
Game.InternalMessage
Description
Unknown.
Signature
Game.InternalMessage(unknown)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| unknown | String | Unknown. | ✔️ |
Results
None.
Game.SeparateRenderAndExecute
Description
Unknown.
Signature
Game.SeparateRenderAndExecute(unknown)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| unknown | Boolean | Unknown. | ✔️ |
Results
None.
Game.SetAreaName
Description
Sets the area name for the current stage. This is overridden by mission_area in the Mission Parameters.
Signature
Game.SetAreaName(name)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| name | String | The area name to use for the current stage. | ✔️ |
Results
None.
Game.LoadPEBank
Description
Unknown.
Signature
Unknown.
Parameters
Unknown.
Results
Unknown.
Game.PreloadPlayer
Description
Unknown.
Signature
Game.PreloadPlayer()
Parameters
Unknown.
Results
Unknown.
Game.LoadCameraLib
Description
Unknown.
Signature
Unknown.
Parameters
Unknown.
Results
Unknown.
Game.LoadCameraSet
Description
This function expects a path to a *.xml file.
Signature
Game.LoadCameraSet(path)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| path | String | The path to the file to load. | ✔️ |
Results
Unknown.
Game.LoadEntityLib
Description
Unknown.
Signature
Unknown.
Parameters
Unknown.
Results
Unknown.
Game.CreateCameraTornado
Description
Unknown.
Signature
Unknown.
Parameters
Unknown.
Results
Unknown.
Game.CreateObjInfo
Description
Unknown.
Signature
Game.CreateObjInfo(actor_type)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| actor_type | String | The type of actor to create info for. | ✔️ |
Results
Unknown.
Game.NewActor
Description
Unknown.
Signature
Game.NewActor(actor_type, {})
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| actor_type | String | The type of actor to create. | ✔️ |
| N/A | Table | The set parameters for the actor. | ✔️ |
Results
Unknown.
Game.LoadEvent
Description
Unknown.
Signature
Game.LoadEvent(name)
Parameters
| Parameter | Type | Description | Required? |
|---|---|---|---|
| name | String | The name of the event. | ✔️ |
Results
Unknown.
Game.ChangeArea
Description
Unknown.
Signature
Unknown.
Parameters
Unknown.
Results
Unknown.
Game.SetupWorld
Description
Unknown.
Signature
Game.SetupWorld()
Parameters
Unknown.
Results
Unknown.
Game.DestroyWorld
Description
Unknown.
Signature
Game.DestroyWorld()
Parameters
Unknown.
Results
Unknown.
Game.StartPlaying
Description
Unknown.
Signature
Game.StartPlaying()
Parameters
Unknown.
Results
Unknown.
Game.Retry
Description
Unknown.
Signature
Game.Retry()
Parameters
Unknown.
Results
Unknown.
Game.End
Description
Unknown.
Signature
Game.End()
Parameters
Unknown.
Results
Unknown.