gluii's Forum Posts

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • When talking to NPCs I want to click on them to bring up the next line of text. I have figured out a way that I like but it's only happening once.

    My code is-

    *Player_is overlapping_NPC ---> set text to- NPC.Variable=0?"blah,balh,blah":"nothing"&NPC.variable=1?"blah,blah,blah":"nothing"&NPC.variable =2?"blah,blah,blah":"nothing"&NPC.variable=3?"blah,blah,blah":"nothing"

    Subevent

    *on NPC clicked----> Add 1 to Variable

    When I click on the NPC it shows the 1st line of text, then when I click the second time it's shows the 2nd line. But if I try clicking anymore times it does nothing and stays the same.

    Does this mean i Cannot use the ?: indefinitely? Only twice?

  • Actually, I must have had a brain freeze, you don't need chooseindex.

    Just use Array.At(0,counter)

    Oh that makes it so much easier. Thank you so much for your help 😊 XD!

  • Counter is just a name of a variable. When the dialogue starts, set counter to 0. Each time a dialogue line is shown, you need to increase it by 1. (up to the maximum number of lines)

    Oops sorry I see,ok it worked! Thank you so much for your help I appreciate it!😊

  • choose() expression does exactly that - picks one random option.

    You probably need chooseindex() expression.

    Set Text To---> Chooseindex(counter, Array.At(0,1)Array.At(0,2), Array.At(0,3))

    After each time increase the counter variable.

    Thank you, I’m not sure if I’m typing it wrong but it will not let me type in “Counter” ,I’m not sure why. it’ll just replace it with “cos” or suggest another expression saying (Unkown Expresstion- this is not a system expression or variable name in this scope)

    I typed — chooseindex(counter, Array.At(0,1)Array.At(0,2), Array.At(0,3))

    I have this in a sub event, is that the problem? Is this on my end?

  • I have an Array I'm using to have conversations with NPCs. I want to progress the dialuge each time the Space Bar is pressed ,which I know how to do, but instead of going in order it shows up each element at random.

    I used this code

    *When Player---> Overlaping NPC

    *Set Text To---> Choose(Array.At(0,1)Array.At(0,2), Array.At(0,3))

    I want to progress the Text Array from 1 to 3 for example but it's picking them at random like 3,1,2.

    How do I call elements in Array in oder on each Axis?

  • To open the file I sent in a Google Drive link:

    Step 1: Click on Open local file

    Step 2: Open the file I sent to you to download:

    Magic, you get the project, assets and all the code and the comments. If any more questions. I'm watiting for them ^^

    Oh thanks for explaining that to me and especially using pics for visual aid, that helped alot. And the project you sent was exactly what I need thank so much 😊.

    I just need help with the last pare if you can,walking "Behind The Building" and it goes non-solid & transparent