Issue with NPC dialogue.

So I am trying to create an NPC for my game and I am using the ConvLib library to help but no matter what I seem to do I can't get the player to actually talk to my NPC.


Also I now have this issue where the greeting doesn't trigger before the conversation starts.


Are you sure you set the conversation up the same way the example does it?


Yeah I am sure and yet in the game I put in the command Talk to and it asks me what you can talk about with the one option that I have right now. I click on it and it plays both the greeting and the conversation response.


Ah. you made the same mistake I did. Greeting is the first thing they will say to you, followed immediately by whatever is in Conversation. You have to write assuming this will happen, or don't include a Greeting.


So I should make an object that is just the greeting and don't have anything written in it so that when clicked on it will just play the greeting message?


Gimme a few minutes to get my own Quest open so I can see how I did this. I'm still learning myself, but I JUST had this problem like, yesterday XD


Okay, so I got frustrated and just accepted it, but I know how to fix it now (having been screwing around with it for as long as I was). So, you can basically make a blank "Continue" or "Start Conversation" option, which is meh. OR, you can move the "greeting" to a Reaction. I set it up as a Reaction, as it worked just fine if he said it when I first enter the room.


Example:

@
greeting
true
"Welcome to Dj Inn!" The Innkeeper smiles at you. "Will you be staying the night?"

Depending on what you're trying to do, you might need to do something different. I'd need to know more to be able to tell for sure.


Another thing I do that I'd recommend, but that you don't HAVE to do, as it depends on if it's appropriate to your game, is putting the text from your "question" (or whatever the Player is saying) in text at the beginning of the Conversation since it can be multiline. This can end up creating something like this.

A south warren - dj inn: main room
You can see Innkeeper.
You can go up.
The inn is lively, with lots of people, and even a small group of Bards playing in the background. The decorations are mostly warm-colored, with well-kept furniture spread through-out. Opposite the door, front and center, is the Innkeeper.
"Welcome to Dj Inn!" The Innkeeper smiles at you. "Will you be staying the night?"

> speak to Innkeeper
"I'm here about the Ring. Can you tell me where the Old Man is?" You ask.
"Ah, another one, huh?" He shakes his head. "Yeah, if you're willing to throw your life away like the rest. He's up the stairs, room 25."
"The rest?"
He nods his head. "Yeah. I've seen 6 other people go up there today. None of them have come back down. People are starting to wonder."
(Charm) "Just who is this old man? No one seems to know."
The Innkeeper looks at you for a moment before responding.
"Sorry, I haven't heard his name either."
Talk to Innkeeper about...
1: "Can he really pay what he claims?"
2: "Do you know anything about this ring he's looking for?"
3: "How much for a Room?
4: "Thanks. Goodbye."

The last 4 lines are the conversation going on, but that is after asking 3 different questions in the conversation.


Thanks for the help there. I now have an issue where I want to check the player's gender and depending on the gender will make one conversation option appear or the other.


That's gonna need the Show/HideTopic function if you're talking about Options. Basically, instead of using the normal method of adding an option to the conversation, have the previous part run a script.

      <object name="Innkeeper Old Man Who">
        <inherit name="topic" />
        <inherit name="editor_object" />
        <alias>(Charm) "Just who is this old man? No one seems to know."</alias>
        <exchange><![CDATA[(Charm) "Just who is this old man? No one seems to know."<br/>The Innkeeper looks at you for a moment before responding.]]></exchange>
        <talk type="script"><![CDATA[
          if (game.pov.Charm >= 15) {
            msg ("\"Yeah, I heard his name is Alphos Sadel.\"")
            if (game.pov.Magic >= 10) {
              ShowTopic (Innkeeper Alphos Sadel)
            }
          }
          else {
            msg ("\"Sorry, I haven't heard his name either.\"")
          }
        ]]></talk>
      </object>
      <object name="Innkeeper Alphos Sadel">
        <inherit name="editor_object" />
        <inherit name="topic" />
        <alias>"Alphos Sadel, as in Grand Magus Alphos Sadel?"</alias>
        <nowshow type="stringlist">
          <value>Innkeeper Alphos 2</value>
        </nowshow>
        <exchange><![CDATA[You pause for a moment. "Alphos Sadel, as in Grand Magus Alphos Sadel?"<br/>The Innkeeper's smile grows larger. "The very same!"]]></exchange>
        <talk type="script">
          HideTopic (Innkeeper Doubt)
        </talk>
      </object>
      <object name="Innkeeper Alphos 2">
        <inherit name="editor_object" />
        <inherit name="topic" />
        <alias>"Why is one of the most powerful Mages asking for help finding a ring? Can't he do it himself?"</alias>
        <exchange><![CDATA["Why is one of the most powerful Mages asking for help finding a ring? Can't he do it himself?"<br/>The Innkeeper shrugs. "Apparently this particular ring is special, and the one who stole it is somehow able to hide it's exact location. Going in to find it by force would of course be overkill. You don't send a Grand Magus for something like that. So, he's willing to pay handsomely to get an adventurer to do it for him."]]></exchange>
        <talk type="script">
          msg ("For asking about Grand Magus Alphos Sadel, you've earned 1 CP!")
          game.pov.CP = game.pov.CP + 1
          msg ("Your CP is now " +game.pov.CP+"!")
        </talk>
      </object>

Where it says "ShowTopic (Innkeeper Alphos Sadel)" is where this script adds the option to specifically talk further about that guy, but only if your Charm AND Magic are high enough. Just replace the IFs with a check for Gender (however its stored in your game), and it SHOULD be a functional option.


I see. Well here is the error that I am getting: "Error running script: Error compiling expression 'player.race = Stallion': Unknown object or variable 'Stallion' "

And this is the code that I thought would work.

if (player.race = Stallion) {
  ShowTopic
}
else {
  ShowTopic
}

I cut out what was suppose to be in ShowTopic by choice. I already know what goes in them.


Ah.... It's saying you don't have the trait on your character. I should know, since I got that error..... well, a lot >>;;

Basically you need to make sure that the attribute race is set to Stallion (with that exact spelling AND case) or it doesn't work. That means stallion is not the same as Stallion. It must also be set BEFORE this happens.


Someone who knows the code better than me might be able to help a bit more in regards to that (I'm still having to get help on pretty much everything right now aside from what is obvious from the GUI on the desktop version).


In this case, it's complaining that there isn't an object whose name is Stallion.
From your previous code, I'm guessing that you mean the actual word "Stallion" rather than an object called that.

So you want if (player.gender = "Stallion") {

(You also put "race", when I think you meant "gender")


Alright I have got it mostly working. It stills needs a fair amount of clean up but it is functional at the moment.


remember... try to remember...


String Values REQUIRE double quotes:

if (RandomChance (50)) {
  player.alias = "HK"
}
else {
  player.alias = "joe"
}

if (player.alias = "HK") {
  msg ("You're awesome!"
}
else if (player.alias = "joe") {
  msg ("You're ordinary.")
}

whereas, Object Values do NOT have double quotes:

create ("katana")
create ("claymore")

if (RandomChance (50)) {
  player.weapon = katana
}
else {
  player.weapon = claymore
}

if (player.weapon = katana) {
  msg ("You're a samurai")
}
else if (player.weapon = claymore) {
  msg ("You're a knight")
}

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums