Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

New forum theme up and running!



  • Charas-Project »
  • Game Creation »
  • RPG Maker »
  • help with npc convo
« previous next »
  • Print
Pages: [1] 2

Author Topic: help with npc convo  (Read 11395 times)

Offline newguy99

  • Initiate
  • *
  • Posts: 24
help with npc convo
« on: July 23, 2013, 12:06:26 AM »
I'm trying to make conversations with my hero and npcs but somehow i cant get it working properly. I got down the basics of variables and switches but I'm not sure what I'm messing up.

can anyone help me out or point me in the right direction?

Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: help with npc convo
« Reply #1 on: July 23, 2013, 12:26:55 AM »
Well what are you trying to do?  Or at least give us how its messing up because it could be many many many many many different things right now.
Logged

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #2 on: July 23, 2013, 12:47:51 AM »
OK here's an example. I would like the convo to go like this

npc: would you like an apple?

choice: yes or no

if yes: here's your apple!
if no: come back if you want an apple!

come back if yes: you already go an apple!
come back if no: ohh so now you want an apple

I hope you get what I'm getting at... now i can get that to work but after the npc says "you already got an apple" it goes back to the question again how do i aviod that especially if i want to keep the convo going.

if its to much to explain maybe someone can point me to a tutorial. I've looked but the few i found were very basic.


Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: help with npc convo
« Reply #3 on: July 23, 2013, 01:19:17 AM »
Give me a minute or two and I'll have my response put up.  This isn't very hard at all to fix.


The event in my mind needs two pages.  So, if the first part works I'm assuming that your event look like this:
Code: [Select]
Page 1
<>Message: Would you like an apple?
<>Show Choices: Yes/No
: [Yes] handler
   <>Message: Here's your apple!
   <>Change Items: Apple 1 Add
   <>Switch Operation: [0001: Apple Received] ON
   <>
: [No] Handler
   <>Message: Come back if you want an apple!
   <>
: End
<>

So, then your next page with a precondition of Switch [0001: Apple Received] is ON looks like this right?  Preconditions for events are the check boxes on the left side.

Code: [Select]
Page 2
<>Message: You already have an apple!

If you want the conversation to go further after you received the apple then just add under the Yes handler in the first page of the event, or when you talk to him again in the second page of the event.

To get them to say the "Oh, so now you want an apple?" and then ask the question again, you could add a Switch at the end of the No Handler like so...

Code: [Select]
: [No] Handler
   <>Message: Come back if you want an apple!
   <>Switch Operation: [0002: Apple Rejected] ON
: End
<>

... and then put a condition branch at the beginning of the event.

Code: [Select]
Page 1
<>Branch if Switch [0002:Apple Rejected] is ON
   <>Message: Oh, so now you want an apple?
: End
<>Message: Would you like an apple?
<>Show Choices: Yes/No
: [Yes] handler
   <>Message: Here's your apple!
   <>Change Items: Apple 1 Add
   <>Switch Operation: [0001: Apple Received] ON
   <>
: [No] Handler
   <>Message: Come back if you want an apple!
   <>
: End
<>

This conditional branch doesn't need an else case, because no matter what the event is going to continue the same way.  Another option you have here is to create a variable.  If the player wants the apple, change the variable to equal one, if they don't, set it to two.  This way, you can make the event have three different pages.  Precondition Variable=0 to do the first time meeting event, Variable=1 to create the received event, and Variable=2 to create the rejected event.  Make sense?  Does that help answer your question?
« Last Edit: July 23, 2013, 01:49:00 AM by A Forgotten Legend »
Logged

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #4 on: July 23, 2013, 02:05:17 AM »
Thank you so much! That answered my question perfectly, I see exactly what I did wrong. I'm trying to start my story line going and I think this is the first step lol. Is there any good tutorials to maybe go more in depth about moving my story along  or like stringing my story line events together or do I just make separate story events that point the player to the next event in the story? Does that make sense?
Logged

Offline A Forgotten Legend

  • Your neighborhood box of colors
  • Royal
  • *
  • Posts: 4,428
    • Website
Re: help with npc convo
« Reply #5 on: July 23, 2013, 03:07:06 AM »
I think I get what you're trying to say.  You'll need to use multiple events, but you can use switches to make sure that the player has completed earlier parts of the story in the same way you check to see if the player has the apple.
Logged

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
Re: help with npc convo
« Reply #6 on: July 23, 2013, 03:09:53 AM »
Quote
like stringing my story line events together or do I just make separate story events that point the player to the next event in the story?

Do you mean how do you make events that work together to make a story, or just tips and tricks on how to make a story? If you're wondering on how to make events that work together to make a story, the key is switches and pages. Lets say a villager sends you on a mission to get an apple from the forest. You have two events, a villager and an apple tree, and you do not want to be able to pick the apple until the villager asks you get an apple, and once you return to the villager with an apple, instead of asking for an apple, he'll say "Thank you!" and give you lots of gold.

You can achieve this by creating a villager with three pages. The first page has no preconditions and consists of the villager asking you to get an apple, and immediately after the message is displayed, you turn a switch [GETTING_APPLE] ON.
The second page is triggered if an apple is in your inventory (with preconditions again). Add a message saying "Thank you!", add 100 gold to the hero's inventory, then turn a switch [QUEST_COMPLETE] ON.
Finally, create a third page that is triggered if the precondition switch [QUEST_COMPLETE] is ON, and have the villager say "Leave me alone, I'm eating my apple!".

Note: the pages will try to execute from the highest page (right most) to the lowest page (left most), whichever page meets all of the trigger conditions first, will be executed first. So if the highest page is triggered when [QUEST_COMPLETE] is ON, then once you complete the quest, the villager will always say "Leave me alone, I'm eating my apple!", and will never ask you to get the apple again.

Finally, create an apple tree, and put an event at the base of the tree that will start when touched ('touched by hero') or press a key ('action key'). For the page preconditions, require [GETTING_APPLE] is ON. In the Event Commands, add an apple to the inventory and display a message saying "Picked an apple!".

You should now be able to complete a very simple quest. Longer stories are very similar, disallow heroes to progress unless they complete their tasks, once they do, turn a switch on and allow them to progress. You can disallow heroes to progress by blocking the path with an NPC that won't let you by, making the hero turn back as if they new they shouldn't move on yet, etc.


If you mean how is a good way to progress through a story, I wrote these three tutorials on stories back in 2006, hopefully they can help with coming up with a good plot.

DB's guide to making an Intro
DB's Guide to Storylines
DB's guide to 'epic' endings
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #7 on: July 23, 2013, 03:16:03 AM »
Thank you both of you guys that's exactly what I was looking for. Honestly a good story is the only thing I think I have going for me. I literally been working on this game for a week and have not one thing made yet. I have learned a whole lot though in the next day or 2 I should be making my home town and first quest... that is if I can decide on a chip set, I hate all the houses I've found and have no type or artistic skill to make my own. Again thanks a lot guys I'm sure I'll have a lot more questions in the coming weeks
Logged

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #8 on: July 23, 2013, 03:55:40 AM »
Maybe you guys could help me with one more thing. At the start of my game my hero is in his room and I want the window to break and make a noise. I created 2 pages, the page with the broken window I put the sound effect and no matter what I cant get it to work. I tried using wait and different things how can I make this work nicely.
Logged

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
Re: help with npc convo
« Reply #9 on: July 23, 2013, 04:03:24 AM »
Can you post your code or take a screenshot of each page and post it?
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #10 on: July 23, 2013, 04:13:46 AM »
page 1
wait 0.7
switch: window on
graphic- pretty window
page to
precondition- switch window on
play sound shatter
wait 0.5
message- what the hell was that
graphic broken window
end event processing


That's the it.. and now it works but it wont stop playing at all the sound and message pop up over and over no matter where I put the end process. and is there a way to put the broken glass on the floor? maybe a new switch at the end of page to and then make a new event on floor with the graphic somehow? And I know this is real stupid but i press print screen but how do I find it. Thank in advance for helping my stupidity.
Logged

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #11 on: July 23, 2013, 04:48:40 AM »
And apparently I cant erase an event either because every time I walk in the room it starts up again. and when he walks down stairs I have him walk around a little looking for his mother and then event stops and he just keeps walking around. I used a stop graphics in the actual event line.. I used halt movement under it, I used stop event processing. I feel like I can't get   one thing to go how I want. If anyone has time to help me with these issues it would be greatly appreciated cause either way I'm going to make this work, but if you could save me a week of fiddling around on the first 5 mins of the game that would be great. 
Logged

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
Re: help with npc convo
« Reply #12 on: July 23, 2013, 05:15:56 AM »
Haha no worries, we can help ya.

First things first though, don't double post, just edit your post with the new content instead of posting twice in a row.

So I'm assuming that the first page has a trigger condition of "action key" while the second page has a trigger condition of "Auto Start" or "Parallel Process". The issue is that when an event is "auto start" or "parallel process" it will run FOREVER until turned off, which is why it's looping for you. Using the event "end event processing" will only work while you are on the same map as the event. Once you leave and come back, it will continue to process like normal. In order to stop it after the first time, turn a switch on at the end of the second page called [Glass_Broken] (or something), and then create a third page with the broken window graphic  that has a precondition of [Glass_Broken]. Make sure that the trigger condition is "action key" (if it's autostart or parallel process, it'll either freeze the hero if autostart or it could lag the game if it's parallel process). This will lock the window into a state where it has the broken glass graphic and no longer displays a message or sound effect.

Adding broken glass to the ground is easy (if you have broken glass graphics), what you do is create an event where you want the broken glass, set the graphics to broken glass, set the Event Layer to Below Hero, and set a precondition to require switch window on (if you want the broken glass to appear immediately), or the switch Window_Broken (if you want a delay before the broken glass is on the floor). Since there is no page that doesn't require a precondition, the broken glass graphic won't be displayed until the correct switch is turned on.

Edit: The wait commands aren't necessary either. You can use a wait if you want a delay from when the glass is broken and when the hero says "What the hell was that?", but in terms of functionality you don't need it.
« Last Edit: July 23, 2013, 05:18:17 AM by DragonBlaze »
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

Offline newguy99

  • Initiate
  • *
  • Posts: 24
Re: help with npc convo
« Reply #13 on: July 23, 2013, 05:59:50 AM »
perfect I got it working perfectly now I appreciate all the help I would have been here all night.  Hopefully I'll be able to do some work on my own for a little while lol
Logged

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
Re: help with npc convo
« Reply #14 on: July 23, 2013, 06:11:24 AM »
Have you played through the sample game yet? The sample game is pretty short, but if you open it up and look through how they do everything, they have a lot of great examples to learn from.
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

  • Print
Pages: [1] 2
« previous next »
  • Charas-Project »
  • Game Creation »
  • RPG Maker »
  • help with npc convo
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum