[GUIDE] Adding Quests Full Reference Source - ProjectSWGCore/NGECore2 GitHub Wiki
NOTE: This guide is in by no means done and won't be until all the task types are handled by the server
This guide will go through the process of setting up the server to recognize a quest and it's associated tasks. The beginning sections of the guide provide general knowledge on how the QuestService is able to automate a quest and what it needs to know to do so. The rest of the guide will provide a reference - a "how to" for each type of task. That doesn't mean you should skip the first part, it is still good to know how the system works this way you'll be able to know what to do a lot better ;).
Introduction
The purpose of this portion of the guide is to help explain how the quest service functions. This will only provide general concepts, not direct answers. That doesn't mean you should skip it though because it'll help answer any questions you may have.
In order for a quest to function correctly, the server needs to know the answer to three basic questions:
How?
"How should the player acquire the quest?"
When?
"When should the quest advance to the next task?"
Due to how the Star Wars Galaxies developers have designed quests, the server is effectively able to automate the most essential question:
What?
"What should happen when a player advances to the next task?"
The Quest Service is able to answer this question by using data tables found in the client files:
datatables/quest/questlist/...
datatables/quest/questtask/...
These tables themselves contain a vast amount of information and are identical to the .qst script files inside the quests folder of the client files. The main exception being that those scripts are used for the quest journal (hence the XML style). This guide will not cover the creation of those .qst scripts as the point of this guide is to focus on putting the existing quests into the game. Throughout this guide I'll be using the most basic quest that a player first gets when they arrive on Tatooine outside the Mos Eisley Starport which is given by the notorious(?) Han Solo - A Speeder For Me. For more complex examples, I'll use a different quest appropriate towards that portion of the guide. With that out of the way, lets get scripting!
Answering the How, When, & What of Quests
How
How a quest should be obtained is one of the most important parts of this guide, without being able to get a quest there would be no way to quest! In the case of A Speeder For Me, the answer to this question would be
A Speeder For Me should be given when a player first arrives on Tatooine.
Easy enough, now how about a bit more complex example, like the quest you get right after completing A Speeder For Me requiring you to talk to Pall which gives you the customization kit? You don't have to do anything then for this! Isn't that great? Why? Take a look at the clientdata/quest/tatooine/speeder_quest.qst file and go down to the last task. You'll notice an element variable in the xml called grantQuestOnComplete. As long as a .qst script has a value there, you don't have to worry about manually activating the quest because the QuestService will do it for you.
When
When to move on to the next task is a very important part to a Quest. When you first send a player a quest, the quest will begin at task 0 (this is the first task). You should be aware that there are some tasks that are marked as "invisible" in which they are not actually shown as a completed step in the Quest Journal but are important for the server. The "What" section, will explain this depth more. Continuing on, lets look at A Speeder For Me. Looking through the quest script that the SWG Developers provide and looking at visual sources from the game, we can tell that clicking on an item seems to move on to the next task. In the case of this quest, that's the only task which needs to be done so it requires little work on your part to get it into the game. To understand how you should script the "when", you'll need to look at the quest type. A Speeder For Me uses two types of tasks: Comm Player and Retrieve Item. Comm Player requires nothing on your part to do, however Retrieve Item will. Telling what to do for these will go beyond the scope of this portion of the guide, for now all you need to know is "when" the quest should move on!
What
You don't have to do anything! The server will do this step for you automatically! Do you have to tell the quest to complete? Nope, it does it automatically if there are no more tasks after the last one was called. Do you have to tell the server to give the player their awards? Nope, well yes and no - see the reference section part for how to do this - but unless it gives an item you won't have to do anything on your part. Pretty much anything you are thinking you should tell the server to do - you don't have to do.
Reference
TODO