Using the Vanilla Courier
This tutorial presents an alternative to Creating Custom Couriers and Simple custom courier. For most modders' purposes, it is sufficient to utilize the vanilla courier the same way Bethesda's own quests make use of him, with all of his generic dialogue intact, which is accomplished with no more than a single script command.
ComponentsEdit
For this implementation, you need:
- A Book base object, which will be the note which the courier delivers.
- A persistent reference to that note which you can manipulate from within a container; in this tutorial, we will create that reference through an alias.
- Your quest with one or more scripts attached to it; in this tutorial, we will add the courier command to the stage fragment script.
QuestEdit
Your quest can be started by any means you wish, whether by script, story manager event, or start game enabled. If you choose the latter option, make sure not to start your quest with the courier delivery, as we don't want the player to receive your note while he's still at Helgen. The priority and type of your quest do not matter with regard to the courier's functionality.
Note AliasEdit
First, create an alias that points to the giver of the note (any way is fine, whether Unique Actor, forced reference or radiant). This will decide the starting location of the courier. In theory, non-actor containers also work.
Next, create an alias for the note, of type "Create Reference to Object"; select your book base object, then "In" your note-giver alias. Level does not matter. Apply whichever flags you want. It may be prudent to mark the alias as "Initially Disabled", otherwise the player could steal the note before it is delivered (this works fine in theory, as you can skip past the courier stage without problems; be sure to account for courier-related dialogue though).
Close the quest after setting up these aliases so they are added as properties in your fragment script.
Courier Script PropertyEdit
Now you need to add a property to your quest fragment script. If you don't have one yet, go to the Quest Stages tab, make a new journal entry for one of your stages, enter a semicolon (;) in the papyrus fragment box, hit compile, then close and reopen the quest.
In the Scripts tab of your quest, there should be a script with a name like QF_NameOfYourQuest_0200800. Highlight this script and select Properties.
Add a property. For the type, don't choose from the drop-down list; instead, enter "WICourierScript". Then give the property a name; we will go with "CourierScript" in this example. For filling the property, there should only be one possible value (WICourier); that's the right one.
The Script CommandEdit
In the stage where you want your courier to begin seeking out the player, add the following code in the papyrus fragment box (replace "YourNote" with the name you have your note alias):
Alias_YourNote.GetReference().Enable() ;If you marked your note alias as "Initially Disabled"
CourierScript.AddItemToContainer(Alias_YourNote.GetReference())
This spawns the courier at the note-giver's location, gives him the note and sets him on his way to the player. On arrival, he will forcegreet the player and give the note using non-quest specific dialogue (such lines will have been conditioned out).
Optional ScriptsEdit
To advance the stage after the courier makes his delivery, it is recommended that you add some of the following scripts to your Note alias:
defaultSetStageOnPlayerAcquireEdit
This script will advance the quest when the player receives the note. Fill the "StageToSet" property with the number of the stage you want to advance to. "PreReqStage" is optional. The "myQST" property defaults to the alias' owning quest, so you don't need to fill it.
defaultSetStageOnCloseBookEdit
Despite what the name says, this script will advance the stage when the player opens the book. As before, fill StageToSet with the desired stage, and optionally also preReqStage. The owning quest will always be operated on in this script.
defaultsetStageAliasScriptEdit
If you did not flag the Note alias as "Quest Object", the player could drop the note without reading it. This script will let you advance the quest to a certain stage if this happens, perhaps as a way for the player to decline the quest. Fill the "stage" property with the desired stage and optionally "prereqStageOpt". Fill "TriggerType" with the number 8 (so it listens for item removal).