Jump to content

Fallout 4. Enable items on Quest Stage


0arisaka0

Recommended Posts

Hello all :)

 

I am looking for assistance in scripting; I am looking to activate and deactivate several in-worldspace items upon quest stages of the vanially in-game quests.

I initially thought putting in scrip fragments, but they didn't work, so I switched to adding scripting to the in-worldspace items, but my papyrus isn;t strong enough to get it to work; they scrips I've tried complied, but didn't seem to do anything; I've gone through all the conceivable vanilla 'quest' and 'item enable' scripts I could find to see of those would work, and they didn't.

 

Any assistance would be appreciated :D

Link to comment
Share on other sites

Don't change base game objects by attaching scripts to them, there are several elegant an non invasive ways to interact with vanilla assets. Such as create your own invisible autostart quest, add reference aliases forced in the render window to the objects you want to activate and attach a script that polls for the vanilla quest updates, something like this:


Quest Property pMQ102 Auto Const Mandatory                     ; the vanilla OutOfTime quest I am watching
ReferenceAlias Property Alias_ObjectIamInterestedIn Auto Const ; the thing I want to modify as alias in my quest

Event OnQuestInit()
   StartPolling()  ; Do not call from OnInit() to avoid blocking
EndEvent

Function StartPolling() ; Also call Scriptname.StartPolling() from quest Alias_PlayerRef.OnPlayerLoadGame()
   StartTimer(60, 60) 
EndFunction

Event OnTimer(int iTimer)
If (iTimer == 60)                              ; 60 second polling update is reasonable
  If pMQ102.GetCurrentStageID() == 15          ; player has emerged from vault 111
   Alias_ObjectIamInterestedIn.GetReference().Enable()
   StartTimer(60, 60)                          ; poll for next status change
  Elseif pMQ102.GetCurrentStageID() == 30      ; player has spoken to Codsworth, the fool
   Alias_ObjectIamInterestedIn.GetReference().Disable()
   Alias_ObjectIamInterestedIn.Clear()         ; always clean up aliases to release the object ref
                                               ; game over, don't restart the timer
  EndIf
EndIf
EndEvent

HTH

Link to comment
Share on other sites

Don't change base game objects by attaching scripts to them, there are several elegant an non invasive ways to interact with vanilla assets. Such as create your own invisible autostart quest, add reference aliases forced in the render window to the objects you want to activate and attach a script that polls for the vanilla quest updates, something like this:

... 

HTH

 

Oooh that's pretty elegant. Better than the method I was thinking of using. Though fairly similar. I like this better. Thanks for posting.

 

One thing I would like to point out though is that using forced references like that would cause the objects to be changed from non persistent to persistent references. This also creates a vanilla reference edit because of that. Though I don't think there is any other solution around that.

Link to comment
Share on other sites

Yar, refs will be persistent bound to a quest, but better than hacking a base record. Preference would be to use aliases and reference variables in the remote quest if they are available, but the objects of interest may have nothing to do with it.

ReferenceAlias	Property MQ102_Alias_Codsworth	Auto
ObjectReference CodsworthRemoteRef = MQ102_Alias_Codsworth.GetReference()
CodsworthRemoteRef.Disable()
Link to comment
Share on other sites

Or, (delayed thought) as an alternative to the timer for polling the remote quest you could just register for a remote quest event ... although not robust as timer based poll because they can be missed:

Quest Property pMQ102 Auto Const Mandatory ; the vanilla OutOfTime quest I am watching

Event OnQuestInit()
   RegisterForRemoteEvent(pMQ102, "OnStageSet")
EndEvent

Event Quest.OnStageSet(Quest akSender, int auiStageID, int auiItemID)
   If akSender == pMQ102 && auiStageID == 15 
      ; do stuff 
   EndIf
EndEvent
Link to comment
Share on other sites

  • 5 years later...

As mentioned there's remote events but you could also look into the vanilla scripts associated with the particular quests. If you're lucky there are CustomEvents you can register for that might deliver some extra goodies when they fire. Just make sure the vanilla script actually calls SendCustomEvent() and not just declares one.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...