Need help with NPC Random Dialogue Control Variables

Discussion in 'RPG Maker MV' started by ThisExitSign, Oct 26, 2016.

  1. ThisExitSign

    ThisExitSign Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    I've read a number of articles explaining how to supposedly create an NPC which will say randomly selected lines of dialogue using Control Variable. I tried using this tutorial I found on Youtube: 










    But after doing exactly as he said my NPC will only say the first piece of text. It will also sometimes not respond to me selecting the action key, or will quickly look at my character and not say anything or do nothing at all. When messing around with the event further the NCP would disappear all together. My final attempt at this is in the picture below. I tried to find an MV tutorial but all I could find is VX and VX ACE tutorials, so it may have something to do with that. Can someone help out this lowly pleb? (I'm also pretty sure this post is in the correct forum, I'm praying it is) 

    Why does this happen to me.jpg
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,113
    Likes Received:
    10,987
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You didn't do exactly as he said ;)


    Just looking at your screenshot and the event in the video, you can tell that he's got more lines than you do, so there's something missing in yours.  You need to use ELSE statements in there too.  


    What you've got is "if Wood is 1, show this text and then check if Wood is 2 (which it's not going to be, because it's 1)".  Since the two later tests are only run if the previous ones are successful, you're only ever going to get a message when wood is 1.
     
    Last edited by a moderator: Oct 26, 2016
    #2
  3. Vassim74

    Vassim74 It's a Secret! Veteran

    Messages:
    103
    Likes Received:
    69
    Location:
    California
    First Language:
    English
    Primarily Uses:
    RMMV
    As Shaz said, the problem is that you have the other 2 conditions within each other instead of placing them outside of each other. Also, you don't need to use Else statements. Here's a snapshot of I have mine set up:

    [​IMG]
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,113
    Likes Received:
    10,987
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You can do it without else statements, but the benefit of using them is that once it finds a condition that's true, it'll stop testing the others.  If you don't use Else statements, if the variable is set to 1, it'll show the first message, but then it'll also do the other tests to see if it's 2 or 3, when really it already knows it's not going to be either of those.  Hardly worth worrying about in this situation, but if you had a situation where you had a lot of possibilities, you wouldn't want it to keep testing after it found the correct one. :)
     
    Last edited by a moderator: Oct 26, 2016
    #4
  5. ThisExitSign

    ThisExitSign Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Thank you all for your help, I have seen the fault in my ways.
     
    #5
  6. Dad3353

    Dad3353 Veteran Veteran

    Messages:
    421
    Likes Received:
    108
    Location:
    France
    First Language:
    English


    This can be achieved by having a 'Jump' at the end of each 'If' statement. The 'Else' solution is fine, but it can be difficult to manage if one is adding more conditions later, of if the order of conditions needs changing.  There are often several methods for achieving any one result, and all options are useful to know about, so as to choose the most appropriate for one's needs. There is, of course, nothing wrong with using 'else' in many cases.
     
    Last edited by a moderator: Oct 26, 2016
    #6
    Shaz likes this.
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,113
    Likes Received:
    10,987
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    good points.
     
    #7

Share This Page