Variable

Introduction

Variables offer a method of saving data to memory. They can be used to save settings, such as the current rotation of a camera, the number of items held, the lead party character, and so forth.

Supported Types

Variables can be stored as three different types:

  • strings of characters (string)
  • whole numbers (integer)
  • floating-point numbers (float)

If a variable stores an integer, it can still be leveraged the same way a string would, and vice-versa. RPG Architect does its best to interpolate what your data is stored as and leverage it as the desired type.

Contexts

Contextually, variables are supported globally and locally.

Local

Local contexts are generated for an individual instance. Local instances are usually setup on their respective containers and only exist while that container is active. If the container is no longer in play, the local data is removed.

Example: Entities support local variables and switches. If you were creating an action battle system that had entities that could take damage, it would be possible to set local variables for health, defense, and so forth on the entity. Copying and pasting the same entity over and over again would then allow each entity to have their own local variables that were unaffected by others, essentially creating a prefabricated enemy.

Global

Global contexts exist throughout an instance of a game, regardless of where they exist. This is the default way variables are implemented in most engines.