Need help making quests run properly in a menu based game

I'll try to explain this the best way I can. So, I'm currently working on a project which is a Dungeon RPG. For those of you familiar with the genre, you know most of the interacting is done through menus. That's what I've been doing for my project as well and most of it has been working fine... Except for quests. I'm encountering a problem with this because normally, in other RPGs, you'd just go talk to the NPC and they would have their very own event, right?

Well, that sort of thing is a bit more difficult in a first person RPG, heh. The entire town, the menu, and everything that goes on within those submenus are all on one event. Right now, that's well over 200 lines of code, dialogue, switches, variables, you name it. Now, I have the quests set up to be accepted at the guild, right? Well, implementing that part was simple enough, but the problem came when I tried to make the first quest. For starters, I have a warning message that pops up whenever the player tries to leave the town before accepting the quest. It simply tells them they need to continue looking around first. That was easy enough.

However, when it came time to teleport back to the dungeon after accepting the quest, the menu (which is constantly looping) stayed on the screen after entering the dungeon. So, I added a break loop command and that got rid of the menu in the dungeon, but as you may have already guessed... My little warning message didn't like that too much, lol. Now, whenever the player clicks on 'Dungeon' before they get the quest, it displays the warning message, then the menu disappears. I finally found a quick solution to this by using 'end event processing' after they teleport to the dungeon so it can still loop the menu if they don't have the quest and get rid of the menu once they're in the dungeon.

"But what happened to the town?" you ask? Well, in the dungeon, there's actually an event which takes place in front of the door to the town (which initiates all of this). Seeing as that was a one time event anyway, that's why I'm able to get away with wiping the entire event once you leave (don't worry, this ties into my current problem). Well, I created a new event on the wall (basically how I open and close doors in my project) to allow the player to access the town again with all of the menus and such intact. Now here's where my problem comes in.

[IMG]http://i.imgur.com/YHLG435.png[/IMG]

[IMG]http://i.imgur.com/PeJpUNU.png[/IMG]

Event 1 is where we accept the quest and it lets the game know it should only be run once to avoid repeating itself (like any one time event). However, due to me having to "split the town" earlier, the events aren't tying together. Basically, Event 1 has self-switch A active, yet in Event 2, all of this isn't present (since they've already accepted the quest earlier). When I created a test quest before this, it seemed fairly simple. I just added Self-Switch A when they accepted the quest, then Self-Switch B after they obtained the reward(s) and that was that. They couldn't repeat the quest or get the reward(s) again.

Now, here is Event 2:

[IMG]http://i.imgur.com/RUWy7TW.png[/IMG]

Unfortunately, despite Self-Switch B being active during this, any time I click on the 'Quests' submenu after turning in the quest, it simply repeats the process and the player can repeat it as many times as they want. Here's what I'm wanting to accomplish:

A. When the player originally accepts the quest, they can click on 'Quests' and have the game check to see if they have completed the task yet. If they haven't, they will be told to do so.

B. When the player turns the quest in, they should only receive the reward(s) one time, as well as the conversation which takes place with it.

B2. In this particular instance, another NPC is congratulating them on a job well done and tells them to come back when they're ready to take on a real job/quest (this should be the point where when the player clicks on 'Quests', it will initiate the new quest available).

C. A greater understanding of how quests can work with menus would be greatly appreciated.

After attempting a few more ideas over the course of two, almost three, hours... I finally found a solution to my problem here.

[IMG]http://i.imgur.com/xiHrowU.png[/IMG]

[IMG]http://i.imgur.com/NkNXQzj.png[/IMG]

Okay, so basically what I did here was remove the conditional branch to have the NPC check to see if you had completed the task. As it stands, my town event is on page 1 and 2 of the second event. The only difference is, the first page doesn't have the variable active, so when you go to the guild to access 'Quests', the NPC will know you haven't completed it yet. However, when you do complete the quest and return back to town, that's when the magic happens!

Page 2 will load instead which does have the variable active because it knows you have the key item. So, what I did tonight was I simply edited the conditional branch on page 2 since I didn't feel the need to have the NPC tell you that you hadn't completed the quest yet since page 2 only loads if you have completed it, so that was pointless to keep in the event. Instead, I replaced that section by including another conditional branch with dialogue and a quest event that takes place by determining if the previous quest is now OFF (which normally isn't what you'd need to do since a simple Self-Switch would do just fine, but not in my project's case because I've got too much going on in one event, lol).

I've also realized that I can store up to 99 pages for one event and each quest will probably take 2-3 pages. Unless I'm mistaken, I'll basically have to copy the entire page for the town and paste it every time I want to start an event, then paste it on the next page and have that one load when the quest is completed. I'm assuming since it's all running under one event, that Self-Switch A/B/C/D will work on every page as long as it's active on 4 pages (basically, I won't need to make a new page for A/B/C/D and page 89, for example, could still use the Self-Switch from page 3 even though page 1 already used it before for its event). This entire project, even from the beginning, has been way too complicated when it really shouldn't be, but I've had to work with what I've got here and basically hold everything together with bubblegum and duct tape, lol.

Now I know exactly why most DRPG projects I've heard of either died due to lack of interest or frustration. People told me before that making a DRPG in RPG Maker is difficult because it's simply not designed for it. Oh how I wish they were wrong, lol.

Alright, so apparently my plan to put a new quest on each page didn't work. Now when I go back to the dungeon to complete the first quest, then go back to town to turn it in, the NPC is already asking me if I've completed the second quest. I'll try just slapping on some more conditional branches to see if that helps.

4+ hours of additional testing and I still can't seem to get one quest to run after another properly in my project. The first quest finishes fine, then you can begin the second quest when you access the 'Quests' menu again. After accepting it though, if you click 'Quests' again, it repeats and I have no idea how to stop it from doing so since I have so many switches, conditional branches, and variables in place that they all basically rely on one another.


Basically...

When you finish the first quest, it flips a switch to turn that off since the quest is done. The second quest begins with a conditional branch to check to see if that switch is flipped off. Since it is, the quest can begin. However, since I need the switch flipped off to end the previous quest and initiate the next quest, I can't really move forward here without having the second quest initiation constantly repeat.

So yeah, I'm hosed for the time being. I'll bang my head against it some more after I wake up and see what happens.
What I've done in my game is I turn a switch ON when a guest is completed, and use that as a conditional check to give me part 2 of the quest. So with that in mind, you could do it this way:

Conditional branch: Check if quest 1 is done:

Inside that: Conditional branch, check if quest 2 is accepted (use another switch for acceptance!), if no, run the dialogue for it, if yes, don't re-run the dialogue for it (and add whatever dialogue should run instead while the quest is in progress).

Additionally, you might be able to do this with variables. Set the variable to 1 when  you accept the quest, and 2 (or higher if a multi-step quest) when it is done. That way you do it all in one spot.
Have you tried comment events for quest? Could make it easier to manage.
I think you should use common events to organize the sections of your event, that will make it much easier for you to handle and change them.
For example if the player selects quest in the main event, instead of having all code in that branch of the show choice, you place a single "call common event <quest>" and move those commands to that common event, it will make your events a lot more readable and usable.

That said, unfortunately you cropped away a lot of important information - an event is more than just the content. So we're a bit limited in the bughunting.

However, from your description there is one thing that might have cause the problems - do you know the difference between self-switches and regular switches?
Self-Switches got their name because they only affect the event "itself" - if you control a self-switch A in event 1 that is a different switch than the self-switch A of event 2.
If you want to transfer data between different events, you need to use the regular switches.
What I've done in my game is I turn a switch ON when a guest is completed, and use that as a conditional check to give me part 2 of the quest. So with that in mind, you could do it this way:

Conditional branch: Check if quest 1 is done:

Inside that: Conditional branch, check if quest 2 is accepted (use another switch for acceptance!), if no, run the dialogue for it, if yes, don't re-run the dialogue for it (and add whatever dialogue should run instead while the quest is in progress).

Additionally, you might be able to do this with variables. Set the variable to 1 when  you accept the quest, and 2 (or higher if a multi-step quest) when it is done. That way you do it all in one spot.

So far, I've been trying to do it with conditional branches by using variables. The problem came when I set the first conditional branch, knowing the player hadn't completed the quest yet since they just accepted it, but I had to put something there in case they clicked 'Quests' again right after accepting the quest. So, the first conditional branch says if the variable is less than 1, tell them to keep looking.

I have another event page up which checks if the variable is 1 or greater, it finishes the quest and turns it off with a switch specifically for that event. This is where things get a little hectic. Everything up to this point works fine, but the next quest is activated by having the quest for the previous switch turned off (basically, the game knows you completed the quest now, so you'll get this option the next time you click 'Quests' if you've completed it).

The thing is... Since that switch is always off now to ensure the player gets the proper dialogue, I can't seem to figure out how to break the loop, per se. I've tried putting a switch, tied into the next quest, in the 'yes' line when you accept it and turning it on so if you click 'Quests' again, it doesn't repeat this, but that didn't work, which is why I'm pretty much at a loss here, heh.

Have you tried comment events for quest? Could make it easier to manage.
I'm not even sure how I'd be able to use common events for my quests at this point. I have so many switches and variables in place now, I wouldn't know what to put where. I think it might be too late to do it this way since it would involve restructuring the entire quest system in my project right now. Secondly, even if they were easier to manage through common events, I'd still encounter the same issues I'm having now... They would just be inside of common events instead.

If I could make this work though, that would really help. I'm just not even really sure how I'd go about doing it at this point.

EDIT: Okay, so shifting all of that to common events didn't take as long as I thought, but I was right anyway, unfortunately. Even by using common events to call upon the quests, I'm still stuck in this endless loop of having it constantly accept the second quest over and over again.

I think you should use common events to organize the sections of your event, that will make it much easier for you to handle and change them.

For example if the player selects quest in the main event, instead of having all code in that branch of the show choice, you place a single "call common event <quest>" and move those commands to that common event, it will make your events a lot more readable and usable.

That said, unfortunately you cropped away a lot of important information - an event is more than just the content. So we're a bit limited in the bughunting.

However, from your description there is one thing that might have cause the problems - do you know the difference between self-switches and regular switches?

Self-Switches got their name because they only affect the event "itself" - if you control a self-switch A in event 1 that is a different switch than the self-switch A of event 2.

If you want to transfer data between different events, you need to use the regular switches.
Yeah, I should have known the actual page content and such would be important too so you'd know what switches, variables, common events, etc. were enabled. I'm not sure if it will help, but here are a few more screenshots showing what each page has enabled and such.

Event 1

----------

Page 1:

[IMG]http://i.imgur.com/5b6G0C9.png[/IMG]

Page 2:

[IMG]http://i.imgur.com/ugNagIq.png[/IMG]

Page 3:

[IMG]http://i.imgur.com/DQpxHl7.png[/IMG]

Page 4:

[IMG]http://i.imgur.com/2Y3l6ie.png[/IMG]

Page 5:

[IMG]http://i.imgur.com/MomT0xj.png[/IMG]

Event 2

----------

Page 1:

[IMG]http://i.imgur.com/z60mVFA.png[/IMG]

Page 2:

[IMG]http://i.imgur.com/JqC7oZx.png[/IMG]

Page 3:

[IMG]http://i.imgur.com/GZJmUUo.png[/IMG]

EDIT: Actually, on the subject of variables... That's not a bad idea, bgillisp. I never thought about it before, but I've been going under the assumption that each variable for the quest needs to be set to 1 if there's only one event (or monster) that needs to be completed, but I could set it to 2, 3, 4, or even higher if I wanted to as long as I set the conditional branch for completion to check if it's equal to that number. The other conditional branch could be to check if it's 1 or lower, then initiate the beginning of the quest by asking them if they wish to accept it.

EDIT2: Current predicament:

[IMG]http://i.imgur.com/yOFAjVJ.png[/IMG]

[IMG]http://i.imgur.com/rsSJL7A.png[/IMG]

I need to know why the initiation for the Dullahan quest keeps repeating itself. The else branch is designed to run if you talk to the NPC after accepting the quest and your Dullahan quest variable is less than 2 (since that's what I put it at instead of 1 this time). It just keeps looping the dialogue for accepting the quest though. You'd think that by looking over the previous quest and simply copying what you did there and pasting it here would make them both run the same way (they only have different names after all), but apparently not, lol.

EDIT3: Okay, so I might have finally solved this problem. I checked the Dullahan quest event over and over again trying to find a way to make it stop repeating, so I came up with this crazy idea to just turn the damn switch off altogether after accepting the quest. Everything else still works fine though. The NPC checks to see if you have the item as they're supposed to and after you kill the Dullahan and come back with said item, it checks out just as it should, and you complete the quest.

I was under the impression that the switch for the quest had to stay on while you were doing it, otherwise it wouldn't count. That's why I set the switch to turn off on the first quest after you completed it, which made sense to me since you weren't doing it any more. I'm not sure why this one worked this way, but I'm just glad it seems to be working now. The other quests should be a little easier for me to implement since they're not going to be one after another like this and will be accepted through their own menus with different NPCs names and such. I think the main reason why this one was so complicated is because it was just a neverending sequence of events and quests just aren't designed to run that way, imo.

A more conventional method would be to have it setup like:

1. Talk to NPC A to accept quest

2. Talk to NPC A to turn in quest

Not, you know... Have a quest on top of a quest inside of a menu where you're interacting with two different NPCs in one menu, rather than being separated. This would be so much easier if it was a third person RPG with open fields, lol. At least that way I could control the events better rather than having it all take place on one tile. Still, I wouldn't have even gotten this far without your help, guys.

Thanks!
Yeah, the variable solution is my more common approach. What I do is I set it to 1 once the quest is accepted, then once it is completed, set it to 2, and once it is turned in I set it to 3. That way you can handle what is done by a conditional branch is variable x equal to (0, 1, or 2), and handle appropriately. Then, if you wish to check if the quest is done (for assigning future quests), just check if it is 3.

Plus, if you have multi-step quests, you can use 2 for completing step 1, 3 for completing step 2, and so on. All you have to do is keep track of which variable should be last in the chain, and check for that if it is completed, then add one more to it to mark it as done.

For example, in my game I have a quest to find a missing boy. If you turn it down I set the variable to 1 (and the quest giver runs off in a huff), and if you accept it I set the variable to 2. Then, once I find the boy I set it to 3, and finally I set it to 4 once the quest is turned in.

Nice and flexible.
I only just started applying variables recently, so I wasn't even entirely sure how all of that worked. I had only been using them with 1 in them so far, but I'll keep this in mind when I decide to make a multi-part quest or just for general information on how these operate.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-making-quests-run-properly-in-a-menu-based-game.52271/