Complete Example Scripts: Difference between revisions
Jump to navigation
Jump to search
no edit summary
imported>RedwoodElf (Formlists are not arrays. Totally different critter.) |
imported>RedwoodElf No edit summary |
||
| Line 16: | Line 16: | ||
==Scripts== | ==Scripts== | ||
===A Quest item you can drop and pick up again and set or reset objectives and Stages.=== | |||
<source lang="papyrus"> | |||
Scriptname DroppableQuestObject extends ObjectReference | |||
Event OnContainerChanged(ObjectReference NewContainer, ObjectReference OldContainer) | |||
if FromQuest.GetStage() < StageToStopQuestItem ; Are we a quest item at the current stage? | |||
if OldContainer == Game.GetPlayer() | |||
FromQuest.SetObjectiveDisplayed(ObjectiveToDisplayOnDrop,True,True) | |||
FromQuest.SetObjectiveDisplayed(ObjectiveToHideOnDrop, False) ; Uncomplete the objective completed on pickup. | |||
if UncompleteEnable | |||
FromQuest.SetObjectiveCompleted(ObjectiveToCompleteOnPickup,False) | |||
endif | |||
if StageToSetOnDrop >= 0 | |||
FromQuest.SetStage(StageToSetOnDrop) | |||
endif | |||
elseif NewContainer == Game.GetPlayer() | |||
FromQuest.SetObjectiveDisplayed(ObjectiveToDisplayOnPickup,True,True) | |||
FromQuest.SetObjectiveCompleted(ObjectiveToCompleteOnPickup) | |||
if StageToSetOnPickup >= 0 | |||
FromQuest.SetStage(StageToSetOnPickup) | |||
endif | |||
endif | |||
else ; Nope, we're not a quest item at this stage. | |||
endif | |||
EndEvent | |||
Quest Property FromQuest Auto ; Set this to the quest the item is a quest item for. | |||
Bool Property UncompleteEnable Auto ; If true, "uncomplete" the objective completed on pickup when dropped. | |||
Int Property StageToStopQuestItem = 99999 Auto ; At this stage or later, it effectively ceases to be a quest item anymore. | |||
Int Property StageToSetOnPickup = -1 Auto ; When item is picked up, set this stage in the quest (Defaults to No Stage) | |||
Int Property ObjectiveToDisplayOnPickup Auto ; What objective should be displayed when item is picked up by the player? | |||
Int Property ObjectiveToCompleteOnPickup Auto ; Usually the "Get this item" objective. | |||
Int Property StageToSetOnDrop = -1 Auto ; If player drops the item, what stage do we "go back" to? | |||
Int Property ObjectiveToDisplayOnDrop Auto ; Re-display the objective to "get" the object. | |||
Int Property ObjectiveToHideOnDrop = -1 Auto ; Should be the same as ObjectiveToDisplayOnPickup, ideally. | |||
</source> | |||
To use this script: attach it to the item you want to use, and set the properties accordingly, assigning the quest, Objectives, and Stages involved. For example, let's say that in the quest "StarsAndGarters", the garter belt of Wootazootamootagoota The Tense is set in stage 10 as Objective 10, and Displays Objective 20 "Place the belt on the statue", and sets stage 20 when picked up, and you want to go back to stage 10 if the player drops it. And after stage 30 (Player has put the belt on the statue) it no longer matters what happens to it. You would set your properties as follows: | |||
FromQuest: StarsAndGarters | |||
UncompleteEnable: True | |||
StageToStopQuestItem: 30 | |||
StageToSetOnPickup: 20 | |||
StageToSetOnDrop: 10 | |||
ObjectiveToDisplayOnPickup: 20 | |||
ObjectiveToCompleteOnPickup: 10 | |||
ObjectiveToDisplayOnDrop: 10 | |||
ObjectiveToHideOnDrop: 20 | |||
===A Trigger That Detects When The Player Enters=== | ===A Trigger That Detects When The Player Enters=== | ||