How do I make a variable that'll move between Columns/Rows/Sheets in an Array?

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I feel so bad for asking cause I've been stuck on this so long.i took a couple months break, But I'm in the middle of making a Dialuge System just like the ones you'd find in any RPG (like Undertale).

    I have an Array with Rows, Columbia and Sheets of Dialuge for my NPCs. Everything's set up when the player collides with them and I can get several lines of speech with the Tokenat. But I don't know how to go about going down rows or across columns or going to the next sheet in the array.

    I just want when the player taps the screen for the text object to read the next row/column/sheet.

    Should I make a variable or idk? I was told to be very percist with my Questions but I'm not sure all the time if I'm asking right so sorry.

  • So let's say the OBI character has 20 dialogue lines. Some are on sheet1, some on sheet2 etc.

    When you collide with OBI, how do you know which dialogue should be played and from which sheet?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So let's say the OBI character has 20 dialogue lines. Some are on sheet1, some on sheet2 etc.

    When you collide with OBI, how do you know which dialogue should be played and from which sheet?

    I probably confused everybody with the pick. How I set it up was just for my personal refrance. Is it nessary to know? Just to make a variable that can change columns/rows/sheets?

    Well to answer, OBI would be the main character. And when he collides with any NPC, several characters can be part of that conversation. You know how in other video games just because you walk up and talk to 1 NPC doesn't mean another can't walk up to you in that sense and join the conversation. It's like a scense being played out in a movie ya know? You don't have to walk up to each individually and speak to only 1 NPC at a time. And I want after one NPC finishes saying what they need to say for the row to go down 1 and the next character will say there thing, then down another etc.

    Each ROW (Vertical) = a group of CONVERSATIONS, Each COLUMN (Horizontal) = Represents A TOPIC or Mission, Each SHEET = a new PLOT or Progresstion in the Storyline. And I will have diffrent variables to trigger when a new plot point is finished and has begun (I may have gotten the horizontal/vertical confused). I hope I'm making sense I'm so sorry 😞.

    The characters you see would all play a part in the conversation even if OBI didn't collide with them to begin with. Like it's not like you collide with a particular NPC and you ONLY have a conversation with that one at a time. It's like a movie scene playing out. Another NPC can come in and start talking. And you know how there's a picture of the character and the characters name by the dialuge to? Those change when the player taps and the next character taps.

    Idk. It's just the same as dialuge in a Pokémon game or undertale. I just want that. I feel I'm almost there. Would you like to see the code I have so far for it?

    tokenat(Array.At(0,0),Chatposition,"_")

    Using the Token At expresstion has been so helpful so far. So I was wondering if I could put something within the expresstion mabye to make the text object go down rows/columns/sheets. I was thinking of using the dictionary but it didn't work.

  • Referencing elements in an array with variables is not difficult:

    Array.At(column, row, sheet)

    So you'll need three variables - column, row and sheet.

    Say, if column=1, row=4 and sheet=0, it will return "this is the box for the choicebox" line from your array. Add 1 to row variable and it will return the next line below it.

    I still don't quite understand your idea, but if the plot of the game is linear and dialogues are played one by one, it may work.

  • Referencing elements in an array with variables is not difficult:

    Array.At(column, row, sheet)

    So you'll need three variables - column, row and sheet.

    Say, if column=1, row=4 and sheet=0, it will return "this is the box for the choicebox" line from your array. Add 1 to row variable and it will return the next line below it.

    I still don't quite understand your idea, but if the plot of the game is linear and dialogues are played one by one, it may work.

    Oh ok, And I can use a Tokenat expresstion with it to? I wanna keep using tokenat if possible.

    And with "Add 1", would I code it to be - on Tapped anywere --> Add 1 to "Row Variable" And it'll make it go down? And so I just make a "Column Variable" and "Sheet Variable"?

    I'm I thinking of it right or understood ya good? Could I see a screenshot of what the code would look like if that's OK?

  • I don't know what you are using the tokenat expression for. Is it to split the text into multiple lines? In this case you can continue using it of course.

    And with "Add 1", would I code it to be - on Tapped anywere --> Add 1 to "Row Variable" And it'll make it go down? And so I just make a "Column Variable" and "Sheet Variable"?

    Correct.

    And then use Array.At(columnVariable, rowVariable, sheetVariable) to actually get the value from the array.

  • I don't know what you are using the tokenat expression for. Is it to split the text into multiple lines? In this case you can continue using it of course.

    > And with "Add 1", would I code it to be - on Tapped anywere --> Add 1 to "Row Variable" And it'll make it go down? And so I just make a "Column Variable" and "Sheet Variable"?

    Correct.

    And then use Array.At(columnVariable, rowVariable, sheetVariable) to actually get the value from the array.

    Tokenat is for the Dialuge System. In each element sentences are separated by "_", every time screen is tapped dialuge progresses. When I tell the Text Object what to do I want to be able to keep using it with what you gave me. I guess the picture of my Code is Still not enough to convey what I want. I'm sorry 😞

    I just don't know how to ask my questions.

    I apologize if I was being frustrating. But thanks for the help anyway. I'll use what you given me.

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