Form Instancing

From GECK
Jump to: navigation, search

Form Instancing: Dynamic Baseforms

Form Instancing is a system that allows the creation of dynamic baseforms—new variations of existing objects—tied specifically to your save game. These dynamic forms are created during gameplay and are recycled when loading a new game or another save.

Unlike static baseforms, which are pre-defined and constant, dynamic baseforms allow for greater flexibility by enabling customized objects to exist temporarily without modifying the original data.

Dynamic baseforms are linked to their parent static baseform, and the game recognizes both static and dynamic baseforms under a unified system. Every dynamic baseform has:

  • A unique instance ID relative to its parent static baseform.
  • An optional string key that allows grouping and filtering of related instances.

Key Features

  • Dynamic Baseforms: Temporary objects tied to your save game that are based on static baseforms.
  • Instance Keys: Group related instances using string keys for easier filtering and management.
  • Save-Specific Forms: Dynamic baseforms exist only in the save where they were created. Memory is recycled when starting a new game.
  • Integration with Scripts: A robust set of functions allows creating, managing, and querying dynamic instances during gameplay.

Creating and Managing Instances

Form instances can be created, deleted, and queried through script functions. Here are the core concepts:

  • Creating Instances: Use `CreateFormInstance` to create a dynamic form instance based on a static baseform. Assign a string key to group related instances.
  • Retrieving Instances: Use `GetAllInstances` or `GetObjectInstances` to retrieve instances based on keys or parent static baseforms.
  • Checking Instance Status: Use `IsFormInstance` to check if a form is dynamic or `IsStaticForm` to check if it is static.
  • Managing Instance Properties: Functions like `GetFormInstanceID` and `GetFormInstanceKey` provide details about individual instances.

Form Instancing Directory Structure

Dynamic baseforms interact directly with the static forms defined in the game. These relationships are structured as follows:

  • Static Baseforms: Pre-defined and constant objects loaded when the game starts.
  • Dynamic Baseforms: Temporary variations tied to specific saves and indexed by their instance ID.

Related Functions

Core Functions

Template:CoreFormInstanceFunctions

Utility Functions

Template:UtilityFormInstanceFunctions

Examples

Creating a New Weapon Instance

rInstance = CreateFormInstance Weap9mmPistol "MyInstances"

This creates a new instance of Weap9mmPistol

Retrieving All Instances with a Specific Key

array = GetAllInstances "Weapon Smith"

Retrieves all instances associated with the `"Weapon Smith"` key.

Getting the Static Baseform of a Dynamic Instance

staticForm = GetStaticBaseForm dynamicForm

See Also