The Selected Data feature can be used for all kinds of custom systems.

Selected data can be accessed in the event system, formulas ans battle AI. Formulas originally called by events – either directly or through a battle action, e.g. formulas used by an ability that’s calculated from a battle event – will share the selected data with the event.

Selected data could be anything, e.g.:

  • a game object or multiple game objects
  • a component or instance of a class (or multiple)
  • a combatant or multiple combatants
  • an ability or multiple abilities
  • a weapon/armor or multiple weapons/armors
  • an item or multiple items
  • a combination of different things, e.g. a combatant and 2 items

You can keep track of different selected data by using different Selected Keys to identify them.

The selected key equipment holds all equipment of a combatant, while the selected key abilities holds all abilities of another combatant.

You can see an example use case for the selected data feature in this gameplay tutorial.

Similar to game variables, selected data can have different origins:

  • Local
    Local selected data is only available in the event system, formulas and battle AIs.
    As soon as the event/formula/battle AI has finished, the selected data will be gone.
    Usually you’d use them to keep track of something that’s only needed within an event, formula or battle AI.
    Formulas called by an event/battle AI or another formula (directly or through an underlying battle action) will share the local selected data with it.
  • Global
    Global selected data is available everywhere and any time.
    It persists throughout the running game, but it’ll be gone once the game is closed.
  • Object
    Object selected data is bound to game objects in your scene using an Object ID.
    It requires an already existing game object with an Object Variables component attached to access them.

Selected data is not saved with save games.

Selecting data

Data is selected through the Selected Data nodes in the event system (Add > Event > Selected Data), formulas (Add > Selected Data) and battle AI (Add > Selected Data).

There are different nodes to select different kinds of data, e.g. game objects, combatants or the current equipment of a combatant. Some nodes also allow creating new data instead of using data from an existing source, e.g. the Select Item node can select items from a combatants inventory or create new instances of defined items.

Using selected data

Selected data can be used in various other nodes in the event system, formulas and battle AIs. E.g. the Add To Inventory node can optionally use items and equipment stored in selected data and add them to a combatant’s inventory.

The Selected variable origin allows using game variables attached to the selected data (e.g. Object Variables attached to game objects or combatants, ability/item/equipment variables attached to abilities, items or equipment).

Additionally, object selection fields in events can use game objects stored in selected data. Game objects can come from game objects directly, or be the game objects of combatants.

This can be used to e.g. add all float variables damageBonus attached to a combatant’s equipment to a damage formula’s result.

Special selected keys

Battle events and formulas used by abilities and items will automatically add the ability/item with the selected key action to the selected data.

Through this, you can always use or change variables attached to the ability/item that is used by their battle events or formulas (e.g. damage formulas or hit chances).

An ability’s battle event increases a float variable useCount by 1 each time the ability is used.

The ability’s damage formula (target status changes) adds the useCount variable to the formula’s result to give bonus damage depending on how often the ability is used.