Charas-Project

Game Creation => RPG Maker => Topic started by: newguy99 on July 23, 2013, 12:06:26 AM

Title: help with npc convo
Post by: newguy99 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?

Title: Re: help with npc convo
Post by: A Forgotten Legend 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.
Title: Re: help with npc convo
Post by: newguy99 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.


Title: Re: help with npc convo
Post by: A Forgotten Legend 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?
Title: Re: help with npc convo
Post by: newguy99 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?
Title: Re: help with npc convo
Post by: A Forgotten Legend 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.
Title: Re: help with npc convo
Post by: DragonBlaze 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 (http://www.charas-project.net/forum/index.php?topic=15557.0)
DB's Guide to Storylines (http://www.charas-project.net/forum/index.php?topic=16222.0)
DB's guide to 'epic' endings (http://www.charas-project.net/forum/index.php?topic=15456.0)
Title: Re: help with npc convo
Post by: newguy99 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
Title: Re: help with npc convo
Post by: newguy99 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.
Title: Re: help with npc convo
Post by: DragonBlaze on July 23, 2013, 04:03:24 AM
Can you post your code or take a screenshot of each page and post it?
Title: Re: help with npc convo
Post by: newguy99 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.
Title: Re: help with npc convo
Post by: newguy99 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. 
Title: Re: help with npc convo
Post by: DragonBlaze 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.
Title: Re: help with npc convo
Post by: newguy99 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
Title: Re: help with npc convo
Post by: DragonBlaze 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.
Title: Re: help with npc convo
Post by: newguy99 on July 23, 2013, 04:23:43 PM
I cant find the sample game.. maybe it didn't come with the version I DL. Where would it be?
Title: Re: help with npc convo
Post by: Prpl_Mage on July 23, 2013, 04:48:45 PM
I cant find the sample game.. maybe it didn't come with the version I DL. Where would it be?

Ditto this, is there a sample game?
Title: Re: help with npc convo
Post by: DragonBlaze on July 23, 2013, 04:55:03 PM
Ditto this, is there a sample game?

Hmm the version I first downloaded came with a sample game that the translator/hacker created. It's 10 minutes and just has a lot of simple examples on how to make a game. I'll see if I can dig it up. Though now that I think about it, it was probably for rm2k and not rm2k3...

Edit: Ah yes the sample game that came with the rm2k English translation was called Don's Adventure. It is made for rm2k, but you can still open it in rm2k3 and play it (the battles may be messed up), but it has a lot of very simple examples.

http://www.rpgrevolution.com/download-game/dons_adventures.zip (http://www.rpgrevolution.com/download-game/dons_adventures.zip)

The other thing you can do is download other people's games and see how they did things.
Title: Re: help with npc convo
Post by: A Forgotten Legend on July 23, 2013, 06:43:27 PM
I loved Don's Adventures!  That was really useful with learning about pictures and variables.  I really agree on downloading it!

EDIT: In fact... I'm going, too!  I sure there is something I can get out of it even now.

It seems my RTP is different that the one I need for it.  I guess I'll just have to find 2k's rtp somewhere...
EDIT 2:  Which is actually harder than it really seems like it should be, because its still not working very well.  Oh well, maybe its just me being a little dumb today.
Title: Re: help with npc convo
Post by: DragonBlaze on July 23, 2013, 07:41:02 PM
Oh yeah forgot about that.. I think I have the RTP graphics floating around on my home computer somewhere. The names vary slightly in different translations such as People1 vs Person1, so I put all the different versions I found over the years in a giant RTP folder, so that no matter which version people use, my RTP folder should work.

My RTP folder may have also been utterly destroyed when my hard drive broke, hopefully that folder was one of the folders that was successfully recovered..
Title: Re: help with npc convo
Post by: newguy99 on July 23, 2013, 10:14:09 PM
Where is a good place to download RM2k3 games? And what are some good games you guys have played. I really need help with making my classes, and especially my battle system, so any help with that would be amazing! Thanks for all the help everyone, I'm amazed at how good I feel my opening scene is coming

It starts with my hero in his room and his window gets smashed and he hears some banging. He runs downstairs and sees his house destroyed and his mother missing. He calls out for her and looks around. he runs outside and sees her yelling out to him and there's an evil looking guy with 2 monsters at his sides. He says a few things and the monsters attack and beat the hero. after the battle is lost my hero wakes up at the strange old mans house on the outskirts off town. I know that sounds short and basic but putting the events together to make this happen was not easy for me, it took me days lol. But I wouldn't have gotten this far without the help here, so a big thank you!