Difference between revisions of "Fallout 4 Simple Fetch Quest Tutorial Chapter 12: Scripting Artifact Retrieval"

no edit summary
imported>Ravelabenergy
imported>Ravelabenergy
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
[[Category:New Users]]
[[Category:New Users]]
{{Tutorial Index
{{Tutorial Index
|series=Fallout4 Scripting Quest Tutorial
|series=Fallout 4 Scripting Quest Tutorial
|chapter=12: Scripting Artifact Retrieval
|chapter=12: Scripting Artifact Retrieval
|Prev=Fallout_4_Simple_Fetch_Quest_Tutorial_Chapter_11:_Creating_Dialog_(Middle)
|Prev=Fallout_4_Simple_Fetch_Quest_Tutorial_Chapter_11:_Creating_Dialog_(Middle)
Line 8: Line 8:
}}
}}


'''Note: This tutorial uses an Action-Reaction System.'''
'''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.
 
=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
 
[[image:Picture12-1.png]]
 
=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)
 
[[image:Picture12-2.png]]
 
=Right-click over the Teddy Bear=
[[image:Picture12-3.png]]
 
=Select Edit in the Pop-Up=
 
[[image:Picture12-4.png]]
 
=Click Scripts (tab) > Add (button)=
 
Note: You might need to scroll right in order to find the Scripts tab
 
[[image:Picture12-5.png]]
 
=Click [New Script]=
 
[[image:Picture12-6.png]]
 
=Click OK=
[[image:Picture12-7.png]]
 
=Enter a Name: for the script=
 
I used AshSkowTeddyBear
 
[[image:Picture12-8.png]]
 
=Click OK=
 
Recall I said when the player retrieves the TeddyBear, it updates the Quest Stage # to retrieved (30). But the Teddy Bear needs access to the AshSkow Quest Object, this is done via a property
[[image:Picture12-9.png]]
 
=Click the Add Property Button=
[[image:Picture12-10.png]]
 
=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.
 
[[image:Picture12-11.png]]
 
=Click OK=
[[image:Picture12-12.png]]
 
=Select pQuest=
[[image:Picture12-13.png]]
 
=Click the Edit Value button=
[[image:Picture12-14.png]]
 
=Select AshSkowQuest in the Pick Object: drop-down=
[[image:Picture12-15.png]]
 
=Click OK=
 
[[image:Picture12-16.png]]
 
=Right-click over the Script Name=
[[image:Picture12-17.png]]
 
=Select Edit Source=
[[image:Picture12-18.png]]
 
=Add the following code to advance the Quest Stage # to the retrieved index=
 
Event OnActivate(ObjectReference akActionRef)
pQuest.SetStage(30)
EndEvent
 
[[image:Picture12-19.png]]
 
=File > Save to compile=
 
Check that you get Compilation succeeded in the Compiler Output textbox
 
[[image:Picture12-20.png]]
 
=Close the Window=
[[image:Picture12-21.png]]
 
=Click OK=
 
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)
 
[[image:Picture12-22.png]]
 
=Bring up the Quest and select the Quest Stages tab=
 
[[image:Picture12-23.png]]
 
=Select the Retrieved Quest Stage Index (30)=
[[image:Picture12-24.png]]
 
=Right-Click over Log Entry=
 
[[image:Picture12-25.png]]
 
=Select New=
[[image:Picture12-26.png]]
 
=Add a Log Entry, Designer Notes, and finally the Code to complete the previous objective (20) and to display the new objective (30).=
 
Compile
 
Here is the Code:
 
SetObjectiveCompleted(20)
SetObjectiveDisplayed(30)
 
[[image:Picture12-27.png]]
 
=Click on the Quest Objectives Tab=
 
Make sure you understand why we completed Objective Index 20 and now display Objective Index 30
 
[[image:Picture12-28.png]]
 
=Go Back to The Quest Stages Tab=
 
[[image:Picture12-29.png]]
 
=Click OK=
 
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.
 
[[image:Picture12-30.png]]
 
=File > Save=
[[image:Picture12-31.png]]
 
=Run Fallout 4 and ACCEPT THE QUEST, then turn around.=
 
Yes, many steps not shown, but you know the drill.
 
[[image:Picture12-32.png]]
 
=Get close to the artifact=
 
[[image:Picture12-33.png]]
 
=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.
 
[[image:Picture12-34.png]]
 
Don’t forget to quit out of the game! (ALT-F4 for the PC Master Race)