-
Notifications
You must be signed in to change notification settings - Fork 8
Quests
alexdunn edited this page Sep 17, 2014
·
6 revisions
There are three types of Papyrus scripts that you can find within a Quest's menus:
- Quest Stage Fragments. These scripts are found in the Papyrus Fragment tab of the Quest Stages. They are executed when their corresponding quest stage is activated.
- Quest Scripts. These scripts are located in the Scripts tab of a Quest. They are attached to a script and run for as long as the script is active.
- Quest Alias Scripts. These scripts are associated with a Reference Alias that has been added to the Quest in its Quest Aliases tab. These scripts are attached to their
ReferenceAlias
es when the quest is activated. They do not interfere with any scripts that might be attached to the base object because these scripts are not actually attached to the base object, but rather aReferenceAlias
that points to that base object. Inside aReferenceAlias
script you can get the base object withself.GetReference()
.
It's good practice to activate scripts through the Story Manager rather than attaching scripts to existing items in the game. This increases mod compatibility. As an example, here we'll create a Story Manager event with a quest that activates a script whenever the player dies.
- Object Window -> Character -> Quest. Right click on any Quest -> New.
- Quest Data
- Event -> Kill Actor Event
- Set the ID to a name to be used in the Creation Kit, such as "SkaarPlayerDeathQuest"
- Quest Stages
- Right click on left-hand pane -> New. Index -> 0.
- Select Start Up Stage. This makes this stage the first stage that's activated for this quest.
- Right click on the Log Entry area -> New. This adds an EMPTY log entry. Leave it this way. This way, it won't show anything in the player's quest log.
- In the Papyrus Fragment tab, add some code to it:
Debug.Notification("Player death quest fired")
- Object Window -> Character -> Sm Event Node -> Kill Actor Event
- Right click on the very top node -> New Quest Node
- Click on the newly created "Stacked Quest Node *"
- Put a name for the node in the ID box, such as "SkaarKillPlayerQuestNode". Select "Shares Event". This makes sure the Story Manager doesn't stop on this event when it doesn't qualify for the given situation.
- Right click on your Stacked Quest Node -> New Quest -> Select your quest.
- Click on your Stacked Quest Node. Right click in the Node Conditions area -> New.
- Condition Function: GetIsID
- INVALID: Player
- Comparison: ==
- Value: 1.0000
- Run on: Event Data -> Victim
Now, if you die in the game you'll see this notification at the top of the screen.
- Create a new Quest and set it to fire on Script Event.
- Add an alias in the "Quest Aliases" tab for the object that you want to attach the script to when the quest is run. Add the script to the alias.
- Create a keyword to identify this event.
- Add a Quest Node to the Script Event in SM Event Node. Add your quest to that node. Set the quest's condition to Event Data -> GetIsID -> MyKeyword.
- To start your quest and activate the script associated with it, send the quest event from any script in the game:
Keyword.GetKeyword("MyKeyword").SendStoryEvent(None, None, None, 0)
- Show the currently active quest in the in-game console:
ShowQuestTargets
- Is there any way to know in a script attached to a Quest Alias what object was added to the player when it was activated via a Player Add Item story event? It is possible to know what
Form
was added, but not whatObjectReference
was added. For this reason, you can't fill a Quest Alias with theObjectReference
that was added to the player. To know whichForm
was added, add a script to yourQuest
that responds toEvent OnStoryAddToPlayer
.