Help with NPC flow

Hey folks... so here is what I am trying to figure out.
if I have a dialogue with a certain npc and he asks the player to go buy him something from the store.. do I create a new object for the npc and remove the previous npc object to continue the dialogue, or is it better to use conditional branches and if statements?


Branch and if...


Here is the situation.

I have an npc who you owe 50 dollars, once you pay him the 50 dollars he asks you to go get him some chicken from the store.
How can I make the NPC react to being givin the chicken?
Would it be an attribute on the npc object?


That would depend if you're using ConversationLib or a similar library; or the built-in "speak to" or "talk to" commands.

I would suggest having a couple of boolean attributes (flags) on the NPC to keep track of which actions you've done. Then your talk to or speak to script will check those flags with a couple of if statements, and use that to decide which thing he says.

As far as giving him the chicken goes, do you want the player character to automatically give it to him if you talk to him when you've got the chicken? Or would you rather use the "give" command? In the latter case, you'd use the "Give" feature on the chicken, and have the script there check the NPC's flag to see if he's asked for it.


J_J

I'm going to second using flags. They are wonderful. I use things like convo1 and then If convo1 is flagged have the next part of the conversation play and change it to convo2. It also lets you check for information. If you ask or tell a character about something that might change the way they respond to you, just stick a flag in, and then check for that flag later in the conversation.

In terms of reacting to the chicken, I sometimes do timed responses so a few seconds after something has happened I will have a msg appear of what the npc is doing or saying, so that there is a feeling of a flowing conversation.


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

Support

Forums