How do I Access Data in a C2 Data Editor Nested Array

0 favourites
  • 3 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I'm trying to access a nested array with data injected from the C2 Data Editor for a Dialog system. Without getting too deep, basically in the parent array, each row is a characters dialog. Each column is separate situation for that character (the first time you meet them, when they give you a quest, when you complete a quest, etc). And within each cell is a nested array that includes the conversation split up into columns for each paragraph of text, and rows to alternate who is talking(odd rows are the NPC, even rows, the player).

    It's easy enough to build the structure in the editor but once it's in the game I can't figure out how to access it. Something like if I wanted to access the seventh column in the second row of the first row, third column's nested array;

    On 'space' key pressed -> Set Dialog_Text to 'Dialog_array.At( 1, 3 [ nested_array.At(7,2) ])'

    But I'd have no idea what the syntax would be. Any help would be appreciated or if there is simply a better way to accomplish this. I could possibly just skip the nested 2-d arrays and make a simpler 3-d array but I think nested arrays would open up potential for conditional responses and other more complex functionality.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I understand correctly..you have Dialog_array " And each cell is a nested array..."

    just ignore identical data &incorrect format..

    [quote:1ma660u5]On 'space' key pressed -> Set Dialog_Text to 'Dialog_array.At( 1, 3 [ nested_array.At(7,2) ])'

    to extract data from nested array ..you need another array(Nested_Array) and something like:

  • Perfect! Thank you.

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