Data Container Plugin

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
A well commented Dynamic Heart Containers template to learn from or to use as a base for your own game!
  • Thought i would share my database object.

    construct.net/en/make-games/addons/1513/data-container

    I always seem to end up using invisible sprite objects to store and organise data because it's so easy to manage using Construct's picking system, but it has its issues.

    So i decided to create my own database object that emulates Construct's picking behaviour, but with more options.

    quick example

    DataContainer → Add file "Sword"

    DataContainer → Set file's "damage" to 10 for file "Sword"

    DataContainer → Set file's "rarity" to "common" for file "Sword"

    DataContainer → Pick highest "damage" → Sub-event: Text Set text to CurFileName & ": " & CurProperty("damage")

    ACEs Overview

    All ACEs are under the Container category. Here's the full list:

    Conditions (Picking, Looping, Checks, Triggers)

    File exists {0}: True if the file exists.

    Pick file {0}: Picks a specific file by name (sets as current).

    Pick file with highest {0}: Picks the file with the max value for a property.

    Pick file with lowest {0}: Picks the file with the min value for a property.

    Pick random file: Picks a random file.

    Pick weighted random file with highest {0}: Random pick weighted by property (higher = more likely; negatives/0 = equal chance).

    Pick weighted random file with lowest {0}: Random pick weighted inversely (lower/negatives = more likely).

    Pick last created file: Picks the most recently added file.

    Pick all files: Resets to select all files.

    Pick files where {0} {1} {2}: Picks files matching a property comparison (=, >, <, >=, <=, !=).

    For each file: Loops over all (or picked) files.

    For each file ordered randomly: Loops in random order.

    For each file ordered descending {0}: Loops highest-to-lowest by property.

    For each file ordered ascending {0}: Loops lowest-to-highest by property.

    For each file alphabetically ascending: Loops A-Z by filename.

    For each file alphabetically descending: Loops Z-A by filename.

    For each file weighted random highest {0}: Loops in weighted random order (higher prop first).

    For each file weighted random lowest {0}: Loops in weighted random order (lower prop first).

    On file added {0}: Triggers when a file is added.

    On file deleted {0}: Triggers when a file is deleted.

    On property changed {0} {1}: Triggers on single-file changes (or "all files" if file is empty).

    On any change: Triggers on any data modification.

    Actions (Data Manipulation)

    Add file {0}: Adds a new empty file.

    Add property {0}: Adds a property (with null value) to all files.

    Set file's {1} to {2} for file {0}: Sets a property in a specific file (creates if missing).

    Set all files' {0} to {1}: Sets a property across all files (creates if missing; triggers "all" change event).

    Delete file {0}: Removes a file.

    Delete property {0}: Removes a property from all files.

    Clear all: Wipes all files and properties.

    Load from JSON {0}: Replaces data with parsed JSON string.

    Download to JSON file {0}: Downloads current data as a .json file.

    Expressions (Data Access)

    CountFiles: Number of files.

    CurFileName: Name of the current file (in loops/picks).

    CurProperty({0}): Value of a property on the current file ("" if missing).

    FileProperty({0}, {1}): Value of a property on a specific file ("" if missing).

    AsJSON: Entire container as a JSON string.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Tom

    Why is my plugin not showing up on the plugins page when you search?

  • What's the differences between a file and a property.

    In my head I thought a property was a "value" associated with a file, however when using the "add a property" action, i thought it would have asked which file it went with so i'm a bit confused of the difference.

  • You are correct in that a property is like a value, but properties are applied to all files. It works like an array. You can set or alter the property of a specific file but you need to pick the file, if no specific file is picked it applies the changes to properties of all files.

    A file could be a character, and each property could be what's in their inventory.

    If you add the property apples, every character gets apples. You need to pick the character if you want to set only their number of apples.

    If you want a multi depth array then you need to add more than one plugin to your project.

    What are you trying to do?

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)