This tutorial will show you two different ways to make side quests in your Pokemon hack.
*PKSV-UI (I find this one easiest to use, but I'm sure this will work with other script editors as well)
*Notepad (To copy and paste your script into, just in case something goes wrong and you need to recompile the script)
*A basic knowledge of scripting (You will need to know how to make a Yes/No question script, how to make basic applymovement scripts, and you will also need to know what flags are and how to use them.)
There are two ways in which one could make a side quest script. The first way works like this:
The player will interact with a "message board" that will have a script detailing a quest. In this case, it will be an item exchange (the player gives an NPC an item for another item of equal or greater value.)
Once they have accepted the quest, they will talk to the NPC who, depending or whether the player has the requested item, will reward the player or say that they want that item.
We'll start with the "message board" script.
Step 1: Open your ROM in AdvanceMap and choose a map where the "message board" will be located. As for me, I like to use the Pokemart for this purpose, so I will use it in this tutorial. Create a "sign" event and place overtop where you'd like the message board to be.
Step 2: Bring up PKSV-UI and start a new script.
This script will use dynamic offsets, so type in #dyn 0x740000 and #org @start, as you would in any other script. Then type in "lock." Typing in "faceplayer" isn't needed, as it's a sign post, and not a sprite, but I do it out of habit. After that, type "Checkflag 0x#" where # is the UNSET flag you will use for this script. Then we will put "if == jump @stillhavetodo" This will tell the script whether or not you have accepted the quest, and bring you somewhere else if you have not. The next thing to type is a yes/no question. This will tell the player what the conditions of the quest are, and allow them to either accept or decline the quest. Keep in mind, you can only have 34 characters per line without them running over. Spaces count as characters. By now, your script should look like this.
Now we'll move on to the "acceptquest" and "deny quest" parts. The first thing after starting the accept quest script (aka putting in #org @acceptquest) is putting in the message that will appear to tell the player they have accepted the quest. A simple "PLAYER accepted the quest!" will suffice. Make sure to put a "callstd" with "MSG_NORMAL" or "MSG_SIGN" right afterward. Problems happen when you don't. Then, you'll want to set a flag, so that if the player interacts with the message board again, it won't ask you if you want to accept the quest when you've already accepted it. This flag should be the same one that you used in the "check flag" command from earlier. Now, you may want to put in a fanfare. If you do, type in "fanfare 0x101" followed by "waitfanfare" so that you can't exit out of the script while it's still playing. After that, release and end the "acceptquest" script. Here's what all of that should look like.
For the "deny quest" script, just make a message saying something like "Decided not to do the quest" or something along those lines.
The next step is the "stillhavetodo" script. If you've accepted the quest, but still haven't finished it, then it will send you here. The first thing to do is to set another flag. IT CANNOT BE THE SAME ONE FROM BEFORE! This flag will check to see if you've completed the quest, and if so, will send you to the "questdone" script. If that flag hasn't been set, then it will tell you that you still have to do the request. Release and end the script.
This is the "quest done" script, which you will see if you have accepted AND completed the quest. For my script, I put in a yes/no question asking if you want to read the quest again. If the player chooses yes, they will go to the "readagain" script. If they didn't pick yes, then the script will end.
In the "readagain" script, you will just have a message saying the quest, but it should be a regular message, not a yes/no question.
At the end, your script should look something like this:
The second part of the "message board" script is the NPC who made the request.
Start the script as normal. Use "lock" AND "faceplayer", as this is a person script.
Type in "checkflag" and use the flag you set when you accepted the quest. This will make the NPC say a different message than normal, depending on whether or not you have the item required.
If the that flag has been set, you will be taken to the "takingquest" script. Make a message with what the NPC will normally say. "callstd" it, release and end.
For the "takingquest" script, put another "check flag." This is the second flag you used in the "message board" script, and is the flag you will set when the quest has been completed. If that flag has been set, you will be sent to a "normal" script. Next we'll use the command "check item" The deal with "check item" is this: put the command in, and type the name of the item you're checking the bag for in all caps, followed by the number of the item that will be required. Afterwards, put in "compare 0x800D 0x1" You must do this, otherwise it won't work, and that would be sad Next you put "if 0x4 goto @has" The "0x4" means it is checking for an item amount greater than or equal to the amount specified before. Once you have all of that, put in a message that the NPC will say if you DO NOT have that item. Release and end the script.
If you have the right type and number of the item, then you will be sent to the "has" script. The first thing you do is put "applymovement 0x# @wow" The # is the event number of the person event in AdvanceMap. To find it, highlight the NPC and look to the right. The person event no. is underneath the delete button.
When you make the "wow" part, do not put an equals sign after the "#org @wow", put an "m" instead. Then put "say_" and have either "!", "?" or "!!" following the underscore. Here's what it should look like:
After that, put a message with what the NPC will say if you have the item. Something like "Wow! You have (insert item here)! Want to trade it for (insert other item here)?" "callstd" it and then type "remove item" followed by the item you are giving the NPC and the number of that item that will be removed from your bag. Right after that, type "additem" followed by the type and number of the item the NPC is giving to you. Then, you will set the flag that you checked for in the "taking quest" script. Put a little fanfare and then end the script.
If the player does not have the right type and number of the item checked for, they will be sent to the "nothave" script. Simply put a message here saying something like "I really want (insert item here), but nobody has it!" Put anything you want here. "callstd", release and end.
Finally, you will make the "normal" script. All you do here, is have the message that the NPC will normally say.
Here's the whole thing together.
The second way works like this:
The player talks to an NPC who requests a certain item. If the player has it, they will take the item and reward the player. If the player doesn't have it, then they will tell the player something and the script will end.
Step 1: Create a person event in AdvanceMap and open up a new script for them.
Step 2: Start the script and type "lock" and "faceplayer." Then type "check flag" and use a flag you haven't used on that ROM yet. Type a "whereisit" message saying something like "I lost my (insert item)! Where is it?" and "callstd" it. Directly after, type "check item"
(in case you dot know, or haven't read the first part, here's how to use "check item." Put the command in, and type the name of the item you're checking the bag for in all caps, followed by the number of the item that will be required. Afterwards, put in "compare 0x800D 0x1" You must do this, otherwise it won't work. Next you put "if 0x4 goto @has" The "0x4" means it is checking for an item amount greater than or equal to the amount specified before.)
Once you've finished the "check item" command, make another message for when the player doesn't have the item. "Callstd", release and end. Here's what you should have:
Next make a "has" script. This script is exactly the same as the "has" script in the first part.
(in case you didn't read the first part or don't know about applymovement scripts, the applymovement scripts use the person event number of the NPC and link to another script. In other words, type in "applymovement 0x# @wow" where # is the person event no. When typing the "wow" part, don't use an equals sign after the "#org @wow", use an "M". Put "say_(insert "!", "?", or "!!") end" after the "m")
You should have the "applymovement" command, then a message that the NPC will say if the player has the item (ex: "Oh my goodness! You found it!"), a "removeitem" command with the item you're giving, an "additem" command with the item you're getting, a "set flag" command with the flag you checked for before (the flag you will set so that the game knows you completed the quest) and a fanfare. Release and end the script.
After, put a "normal" script, with what the NPC will say after you have completed their quest.
Here's what it all should look like:
NOTE: If your using XSE, just type the script in PKSVUI and then change your script editor to XSE after you have compiled it in PKSVUI. This will allow you to convert the script to XSE.