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

Get help using Construct 2

Post » Sat Feb 06, 2016 11:47 pm

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.
B
15
S
5
Posts: 12
Reputation: 949

Post » Sun Feb 07, 2016 5:22 pm

If I understand correctly..you have Dialog_array " And each cell is a nested array..."

Image
just ignore identical data &incorrect format..

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:

Image
Image
B
63
S
23
G
7
Posts: 1,475
Reputation: 10,776

Post » Mon Feb 08, 2016 1:26 am

Perfect! Thank you.
B
15
S
5
Posts: 12
Reputation: 949


Return to How do I....?

Who is online

Users browsing this forum: Davlin, robinw326, Unconnected and 1 guest