Difference between revisions of "Bethesda Tutorial Basic Quest Scripting"

m
imported>Catwheezle
m (More svelte template usage: no "Template:" needed.)
imported>Lmstearn
 
(6 intermediate revisions by 4 users not shown)
Line 64: Line 64:
<source lang="papyrus">
<source lang="papyrus">
Event OnDeath(Actor killer)
Event OnDeath(Actor killer)
        TutorialQuest.SetObjectiveDisplayed(20)
TutorialQuest.SetStage(20)
TutorialQuest.SetStage(20)
EndEvent
EndEvent
</source>
</source>
Once again, ignore the <code>SetObjectiveDisplayed(20)</code>


If you're familiar enough with programming or scripting that what you just pasted made sense to you, feel free to skip ahead to the "Scripting the Amulet" section. For everyone else, we'll go through line by line.  
If you're familiar enough with programming or scripting that what you just pasted made sense to you, feel free to skip ahead to the "Scripting the Amulet" section. For everyone else, we'll go through line by line.  
Line 84: Line 87:
If you see anything else in there, you typed something wrong. Try again!  
If you see anything else in there, you typed something wrong. Try again!  


Once you're done, close the script windows and the actor window, and save your plugin. Now it's time to script the amulet itself.  
Once you're done, close the script windows and the actor window, and save your plugin. Now it's time to script the amulet itself.


=Scripting the Amulet=
=Scripting the Amulet=
Line 102: Line 105:
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
if (newContainer == Game.GetPlayer())
if (newContainer == Game.GetPlayer())
                GSQ01.SetObjectivedisplayed(30)
GSQ01.SetStage(30)
GSQ01.SetStage(30)
endif
endif
EndEvent
EndEvent
</source>
</source>
Ignore it once again. It will be explained in the section about objectives.


There a few things to note in this script:
There a few things to note in this script:
Line 117: Line 123:
You can now play through the quest from start to finish, checking the console with [[ShowQuestVars|SQV]] to see its stage changing.  
You can now play through the quest from start to finish, checking the console with [[ShowQuestVars|SQV]] to see its stage changing.  


Players can't use the console, though, so we'll learn how to give them better feedback about the quest in the next chapter.  
Players can't be expected to use the console, though, so we'll learn how to give them better feedback about the quest in the next chapter.  


{{ProTip|The scripts for Skyrim are just text files that live in your data directory before they get compiled into bytecode. This means that if you've got a favorite text editor, you can use it to work on scripts. We've included setups for both [[Sublime Text Setup|Sublime Text]] and [[Notepad++ Setup|Notepad++]] that provide syntax highlighting, some basic autocompletion, and compilation shortcuts. If you're going to get heavily into scripting, these tools can make your life a lot easier.}}
{{ProTip|The scripts for Skyrim are just text files that live in your data directory before they get compiled into bytecode. This means that if you've got a favorite text editor, you can use it to work on scripts. We've included setups for both [[Sublime Text Setup|Sublime Text]] and [[Notepad++ Setup|Notepad++]] that provide syntax highlighting, some basic autocompletion, and compilation shortcuts. If you're going to get heavily into scripting, these tools can make your life a lot easier.}}


=Notes=
* Papyrus boxes can be [http://forums.bethsoft.com/topic/1513334-no-viable-alternative-at-input/ temperamental] after the wrong code is inserted. Okaying the form and returning to it and possibly restarting the CK can resolve.
* Removing a saved script from a papyrus box may not automatically remove the associated compiled pex in the script folder, which has an impact on testing in-game.


{{Tutorial_Bottom_Bar
{{Tutorial_Bottom_Bar
Line 126: Line 137:
|Next=Bethesda_Tutorial_Quest_Objectives
|Next=Bethesda_Tutorial_Quest_Objectives
}}
}}
{{Languages}}
Anonymous user