How do I switch to another Row/Column/Sheet in an array using a key pressed? (Dialuge System)

0 favourites
  • 4 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I am not sure how to phrase this question cause I know my Questions must be detailed or they won't make sense or understood so I'll do my best and I hope what I'm asking makes sense. I can clarify in the comments more if anyone needs me to.

    I am talking with an NPC using an Array for a Dialuge system. In each row and column I have a paragraph or text the character says. Each row or column belongs to a character.

    I use Tokenat to progress the dialuge with "_". And I use "back" to set the conversation to the beginning. I would like to have a tokenat like "next" or somthing to move up and down a row and or go to another column as well as some paramater that'll make the text go to the next sheet of the array so the text advances to the other characters paragraph; and when it does change a Character Profile Picture to the corresponding character and name.

    So far this is the code I use

    CONDISTION

    LIST: selected item is = 0 ------>

    ACTION

    *Set Text to----> tokenat(Dialuge_System.At(0,2),Chatposition,"_")

    *Set List Invisible

    Global variables

    Inchat= 0

    Chatposition= 0

    Selected NPC= 0

    The idea is for the array to act like a screenplay sheet. 1 sheet has a few related missions and when going to diffrent NPCs the text opens up another sheet.

    If I can get this last bit to work my dialuge system will be complete.

    I've had lot of help so far on thanks so much guys.(^-^)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the tokenat expression you would change array.at(0,2) to use a variable instead o the 2 so array.at(0,var). Then using a similar condition you have for = 'back', you have = 'next' and then change that new variable, maybe add 2 to it so it skips from 2 to 4. You also need to set chatposition back to 0.

    That would be for column skipping. If you want to change row then you need a variable for the X so array.at(var,2) and then change that variable to signal the row.

  • In the tokenat expression you would change array.at(0,2) to use a variable instead o the 2 so array.at(0,var). Then using a similar condition you have for = 'back', you have = 'next' and then change that new variable, maybe add 2 to it so it skips from 2 to 4. You also need to set chatposition back to 0.

    That would be for column skipping. If you want to change row then you need a variable for the X so array.at(var,2) and then change that variable to signal the row.

    Oh hey thanks for helping me again ^^

    So would I use a global,instance or local variable for the expression then?

    And what about for skipping sheets?

    And when it’s another character’s turn to talk I need the character picture & name text to change at the same time.

  • You could use global for simplicity or a local one if you really know what you're doing. Using variables will help you manipulate the array and have control then you should be able to think about what you need and apply those variables.

    The skipping sheets bit i'm not sure, do you have several arrays or are you loading them into one array randomly? You need access to the text and then just call it in the same way.

    Or character images again you could use a variable, set varChar using the same row but a different column like array.at(var,1). Then you set the portrait based on the current value of varChar, the actual text could match the name of the animation or something similar.

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