Fallout 4 Simple Fetch Quest Tutorial Chapter 12: Scripting Artifact Retrieval
|Fallout 4 Simple Fetch Quest Tutorial Chapter 12: Scripting Artifact Retrieval|
|Fallout 4 Scripting Quest Tutorial Series, Chapter 12: Scripting Artifact Retrieval|
|Return to Tutorial Hub|
|Previous Tutorial||Next Tutorial|
Note: This tutorial is written in Action-Reaction style — Headers are the action you have to do, and the pictures that follow depict the reaction (or result) of the Creation Kit.
- 1 Start up your Mod in the GECK
- 2 Double-click the cell containing the object to be retrieved
- 3 Right-click over the Teddy Bear
- 4 Select Edit in the Pop-Up
- 5 Click Scripts (tab) > Add (button)
- 6 Click [New Script]
- 7 Click OK
- 8 Enter a Name: for the script
- 9 Click OK
- 10 Click the Add Property Button
- 11 Select Quest as the Type: and enter a Name:
- 12 Click OK
- 13 Select pQuest
- 14 Click the Edit Value button
- 15 Select AshSkowQuest in the Pick Object: drop-down
- 16 Click OK
- 17 Right-click over the Script Name
- 18 Select Edit Source
- 19 Add the following code to advance the Quest Stage # to the retrieved index
- 20 File > Save to compile
- 21 Close the Window
- 22 Click OK
- 23 Bring up the Quest and select the Quest Stages tab
- 24 Select the Retrieved Quest Stage Index (30)
- 25 Right-Click over Log Entry
- 26 Select New
- 27 Add a Log Entry, Designer Notes, and finally the Code to complete the previous objective (20) and to display the new objective (30).
- 28 Click on the Quest Objectives Tab
- 29 Go Back to The Quest Stages Tab
- 30 Click OK
- 31 File > Save
- 32 Run Fallout 4 and ACCEPT THE QUEST, then turn around.
- 33 Get close to the artifact
- 34 Take (A) the artifact.
Start up your Mod in the GECK
- Open up your Quest
- Bring up the Cell View windows
Note: This is only if the GECK isn’t running, and yes I skipped a lot of steps because we’re far into these tutorials!
Having accepted the quest, we now need to add a scene and dialogue for when the finds the object and has to return it to the NPC.
Now We’ll introduce a new concept: scripting for objects
START: PROCEDURE ADDING CODE TO AN OBJECT
Double-click the cell containing the object to be retrieved
In our case the object is the TeddyBear and it’s in BoSHoldingCellTut.
I adjusted the windows and zoomed up so you could see the Teddy Bear (lower left) and Ash Skow (upper right)
We need to add code to the teddy bear so when the player picks it up the Quest Stage # is updated to the retrieved index # (30)
Right-click over the Teddy Bear
Select Edit in the Pop-Up
Note: You might need to scroll right in order to find the Scripts tab
Click [New Script]
Enter a Name: for the script
I used AshSkowTeddyBear
Click the Add Property Button
Select Quest as the Type: and enter a Name:
I used pQuest, for property Quest. The name is arbitrary, but subject to typical programming variable name conventions.
Select AshSkowQuest in the Pick Object: drop-down
Right-click over the Script Name
Select Edit Source
Add the following code to advance the Quest Stage # to the retrieved index
Event OnActivate(ObjectReference akActionRef) pQuest.SetStage(30) EndEvent
File > Save to compile
Check that you get Compilation succeeded in the Compiler Output textbox
Close the Window
END: PROCEDURE ADDING CODE TO AN OBJECT Picking up the Teddy Bear now updates the quest stage to 30 (object retrieved).
We now need d to tell the player the retrieve subquest (20) is completed, and display the new objective to return the object to the NPC (30)
Bring up the Quest and select the Quest Stages tab
Select the Retrieved Quest Stage Index (30)
Right-Click over Log Entry
Add a Log Entry, Designer Notes, and finally the Code to complete the previous objective (20) and to display the new objective (30).
Here is the Code:
Click on the Quest Objectives Tab
Make sure you understand why we completed Objective Index 20 and now display Objective Index 30
Go Back to The Quest Stages Tab
Yes, we could have clicked OK in Quest Objectives, but I wanted you to see that the Quest Stage Index panel had updated.
Time to test.
File > Save
Run Fallout 4 and ACCEPT THE QUEST, then turn around.
Yes, many steps not shown, but you know the drill.
Get close to the artifact
Take (A) the artifact.
You’re done. Next we just have to add dialog & code where we give the artifact back to the NPC and end the quest.
Don’t forget to quit out of the game! (ALT-F4 for the PC Master Race)