Single script attached to multiple quest objects?

Post » Wed Jun 20, 2012 7:19 pm

As the title says... Is it possible? If so, how?

Thanks :)
User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am

Post » Wed Jun 20, 2012 1:26 pm

yes it is.
open each object you have in mind then link the script and set all the properties for all of them
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Wed Jun 20, 2012 8:41 pm

I'd do it in the quest aliases tab...that way you don't have to edit the quest objects themselves, only the "roles" they play in the quest.

Here's a script I use to make a Droppable Quest Item:

Scriptname DroppableQuestItemAliasRefScript extends ReferenceAlias  ; When on an alias instead of an object.ObjectReference Property MyObject AutoBool Property Popup = True Auto ; Set this to false if the object is in a container or NPC.Event OnCellLoad()    if Popup        MyObject = GetRef()        MyObject.MoveTo(MyObject,0.0,0.0,400.0) ; This will keep it from being underneath a rock, as Boss Treasure Locations have an alarming habit of doing.    EndifEndEventEvent OnContainerChanged(ObjectReference NewContainer, ObjectReference OldContainer)    if FromQuest.GetStage() < StageToStopQuestItem ; Are we a quest item at the current stage?        if OldContainer == Game.GetPlayer()            if ObjectiveToDisplayOnDrop >= 0                FromQuest.SetObjectiveDisplayed(ObjectiveToDisplayOnDrop,True,True)            endif            if ObjectiveToHideOnDrop >= 0                FromQuest.SetObjectiveDisplayed(ObjectiveToHideOnDrop, False) ; Uncomplete the objective completed on pickup.            endif            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.    endifEndEventQuest 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 the item is dropped.Int Property StageToStopQuestItem = 99999 Auto ; At this stage or later, it effectively ceases to be a quest item anymore as far as the script is concerned.; Be absolutely sure this stage is set BEFORE removing the quest item  if it's being given to an NPC or otherwise taken away at the end of it's useful life.Int Property StageToSetOnPickup = -1 AutoInt Property ObjectiveToDisplayOnPickup AutoInt Property ObjectiveToCompleteOnPickup Auto ; Usually the "Get this item" objectiveInt Property StageToSetOnDrop = -1 Auto  Int Property ObjectiveToDisplayOnDrop = -1  Auto  ; Re-display the objective to "get it."Int Property ObjectiveToHideOnDrop  = -1 Auto ; If we haven't got it, we can't do what we wanted to with it, can we? Should be the same as ObjectiveToDisplayOnPickup, ideally. 
User avatar
Alan Whiston
 
Posts: 3358
Joined: Sun May 06, 2007 4:07 pm

Post » Wed Jun 20, 2012 2:58 pm

You can also add scripts to individual references, instead of their base objects... I wonder if that'll make the references persistent.
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Wed Jun 20, 2012 8:27 am

You can also add scripts to individual references, instead of their base objects... I wonder if that'll make the references persistent.

If it registers them for update, or an animation event, or runs a while loop, yes.
User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am


Return to V - Skyrim