gluii's Recent Forum Activity

  • 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
  • My example has several lines in one cell like how you described. For tokenat you just need the text so that will be the array position. Work out how you are changing the array position, array.at(x,y) is what you need. In my example I pull the row from an instance variable on the NPC. I don't see why that would be different.

    tokenat(text,index,separator) is what you need. The index to move across the string is the chatpos variable. The separator is the underscore. You should have all you need really. For choices I hardcoded it to certain rows, so you can do that with list item, if list item 1 is picked then use this row of the array, i.e. set a variable to that row for array.at(var).

    Look at how I change the Y variable based on text object clicked, you would do that with list item instead, that's probably the only change from my example. If you don't want to set it on the NPC (I was doing this to track it better for bugs), you set the dialogue directly in the list object instead of the NPC.

    ok,i got it to work. thanks so much the help^^

  • I don't understand the question because I didn't use your list object. Try and understand my example, see if you can relate it to the list.

    Oh ya I know you didn't use a list object. I was saying I decided to use a list object instead to see if it worked better for me and it did. So I was asking a diffrent question regarding that. I would like to but a Tokenat INSIDE an array so in each element in the array I can write several lines of dialuge instead of 1 line per element.

    Like at

    0,0 Hello, welcome to the adventure field_ you'll need a sword and shild_ and a map to help you navigate_ good luck

    0,1 ah I see you returned safely_now you see how dangerous the path is_ a word form the wise^ always take left turns

    0,2 you are stronger then you let on to be_ not many have made it this far_ you may be the choosen one our village has been hoping for.

    ----> Choice i.e (list object)

    1.thanks nice talking to ya

    2. The chooses one?

    3. It was difficult,you got healing items?

    4. We're is the next path?

    -----On choice 1 tapped

    Exit dialuege

    -----on choice 2 tapped

    1,0 yes you see there was a prophecy about you_you were born with special powers_lemme tell ya about it.

    1,1 but first let's go get some coffee_ its early in the morning and I'm beat_ at the shop I'll tell you all you need to know.

    1,2 OK thanks I appreaciate it_ I cup of coffee would do me good_ I've gotta loosen up.

    -And so forth-

    Thinking of it like a book. I want each element in the Array to be like a paragraph or a small chapter and the whole Array to be a Book if that makes sense. I don't want to only be able to put 1 sentence in each but still tap a button inside one element several times and get several lines of dialuge then when a choice is made I forward to the next element or exit out.

  • You replace NPC.dialogue with array.at(0,global_number), the first element in the tokenat() is the text you want to use.

    Oh, I'm confused with that last part. I wrote array.at(0,global_number) but were does the tokenat go? May I see a screenshot?

  • You have to press the arrow on the left to open the event block. If you see the arrows it is a sign that there are sub events below but the block was closed.

    Ooooh dang, I'm so sorry I didn't notice that. Ya I knew what arrows were for though.

    I tried out the "Lise Object" and this seems to actually work out easier for me so there won't have to be 4 text objects. Each item in the list is attached to an Array so I can get complex lines of dialuge. But you remeber the Tokenat expresstion you showed me in the beginning? I'm trying to put that into the action but idk how to write it.

    I know this is the code

    tokenat(NPC.dialogue,NPC.variable,"_")

    And I wanna have a tokenat in each parameter of the Array. Do ya know if I can do that? So far I am only able to write this much......

    Set Text to--->

    Array.At(0,GlobalVariable_number)

    I wanna put a tokenat in this

  • On the back and end conditions you are setting inchat to 0 twice, one of those should be a chatpos variable. That might cause it. Yes on my example open up the 'on touched NPC' event you will see it has sub events.

    Oh I see it. OK I changed it. The text is still invisible though.

    And I took another look in the project you sent, is it this? I still cannot see a subevent.

  • Does the touched NPC event have the sub events ? I would try and understand the file so you can suit it to your game. Copy and paste you will get lost later on if bugs occur.

    Sub event? Mm, I didn't see any sub events anywere in the script. I think the script is running fine, it's just the text is staying invisible.

    But ya I'm confident now I can understand how to move forward with my dialuge system. Welp i dont wanna take up anymore of your time, I very much appreaciate your help. Thanks so much 😊 ^^

  • Actually I had some free time so I just made it, you can select the NPC to talk with then choices then keep clicking to progress the mini dialogue bit. Take some time to look at the file and understand it, so you know how to add more NPCs and edit it to fit your game. dropbox.com/s/ibut9p94tzj96mj/dialoguesys.c3p

    Thank you very much it works beutifly it's exactlly what I needed. Though I may be stupid I'm sorry, I'm not sure how to mix it in with my current project. I was able to load it in with my project and "include event sheet", but when I ran it nothing happened.i put all the objects in as well. So I did try to just copy the code it in myself and the only issue is that the text isn't showing so idk what is wrong. Did I put in the code correctly? I named things differently but it shouldn't matter right? It may be because I have a dialuge layer. It's set to inicially visible as well as all text objects.

  • Yeah text object is clickable so you could use this. You'll have to build some kind of dialogue system. To return to the original text or close the dialogue you could even add that into the string of text as an identifier and compare.

    How do I do that?

    Before I used to use an array but I ran into trouble with it.

    Then I tried the "choose" which had problems

    And then this way ya showed me seems the best and easiest. But if you know how to do choices with arrays that would be good. Or if ya know blogs I could look at. I can't do JSON though. I understand it but I keep messing up somewhere idk. I do everything it says and it just won't work lol.

  • You can check what the instance variable is doing in the debug view. Check if it goes above 4. What you are saying is there are 5 bits of dialogue and no 6th right? It should work really but you can share screenshot of that event if you are having trouble.

    For deciding between dialogue lines maybe you have to expand into an array to store complex dialogue. It really depends on the game. If you can happily choose between a few strings of dialogue you can still use this method by choosing between multiple string variables. So if topic A begins then choose NPC.dialogue1 and if topic is B then choose NPC.dialogue2. If it is to do with making choices and dialogue following on from options the player is selecting then that is more complex and maybe you need an array and a different approach.

    So sorry for late reply, just new years and job stuff I had to take care of. But ya the dialuge choice will be very simple, it's just for learning info for puzzles and story.i would like for example the choices to be- an Info "Topic A"(what land is this?), a Hint "Topic B" (where's the hidden key?), and a story "Topic C" (who are you?)

    Some Topics I'd like to loop back to the beginning dialuge when finished. And other Topics to close the conversation when finished.

    Would I be able to make the TEXT itself clickable with the "Touch" object? Otherwise how would I select em? Would a list object be easiest?

  • tokenat() will be helpful, it's maybe better explained. Keep the event where you add 1 to the variable on click to increase it. Have another string variable (here I refer to it as 'NPC.dialogue') on the NPC which is the entire dialogue they will have and write each message as one long bit of text with separators, such as "Hello_I am an NPC_Bye".

    Then with actions you set the text to tokenat(NPC.dialogue,NPC.variable,"_")

    This picks the source text so the string variable, the index which is the number and the separator which I used underscore. It allows you to move through one long string of text with each click, where the number variable is the position in the text.

    So when NPC.variable=0 it will show "Hello", when var is 1 it will show "I am an NPC" and when var is 2 it will show "Bye" etc.

    This is useful because you won't need any conditions to compare the variable and it will apply to all NPCs, very easy.

    Thank you so very much^^, this works wonderfully. I had to put the name of the object along with NPC.DIALUGE & .Variable for it to work but non the less it did.would you by any chance know how to restart it from the beginning when the player is done talking to em? The code I used before to do this now does not work.

    Condition

    NPC_DIALUGE > 4

    Action

    Set NPC_DIALUGE to 0

    Then when I go back to talk to them it'll say the same thing.

    And Do you know were I could also go to make "CHOICES" out of the Texts? I need to be able to choose which topic of descution to converse

  • You wouldn't use that operator in this scenario because for example when the variable is 2 you are trying to set the text but it will also run that 0 and 1 are false so set text to nothing, you are trying to set multiple texts at the same time. Just use a normal compare variable condition if variable=0 and if variable=1. Or to go one step further you could write all the dialogue as a string with a separator and use tokenat() expression where the index is the NPC variable.

    Thanks, Ya I was thinking that was what it was. I know how to do it that one other way but I was trying to look for another way that would save me room cause I'm writing a fairly long RPG story and that's alot to keep setting variable =1,2,3,4,5,6,7 etc and so on. When you said "that operator" do you mean to say there is another operator I can use or no there is no operator I can use at all?

    I have never used tokenat() before what's that do? May I see a screenshot example of the code your describing?

gluii's avatar

gluii

Member since 9 Jun, 2022

None one is following gluii yet!

Trophy Case

  • 2-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies