Jump to content

Quest Stages


Ceftadzime

Recommended Posts

If you're using a reference alias script, and advancing stages on the same quest the alias is on you can skip the property stuff and use GetOwningQuest(). So it would look like this

Scriptname NAME_OF_YOUR_SCRIPT_HERE extends ReferenceAlias
 
Event OnActivate(ObjectReference akActionRef)
     Quest kmyQuest = GetOwningQuest() ; so as to not keep calling GetOwningQuest() each time.
     If akActionREF == Game.GetPlayer() && kmyQuest.GetStage() < 20
          kmyQuest.SetObjectiveCompleted(10)
          kmyQuest.SetStage(20)
          kmyQuest.SetObjectiveDisplayed(20)
     Endif
EndEvent
Since you only need the Player ref once it's better practice to just call Game.GetPlayer() once instead of assigning a property. If you needed it multiple times you could do like I did with the quest and assign a local function variable. If you really needed the Player ref available for other places in the script you could use a script variable instead of property and assign it with an OnInit() event. There are documented issues with save game corruption (mostly from Skyrim mind you) due to papyrus having problems overflowing string tables from property assignments. So it's generally better practice to use localized script variables instead of properties whenever possible. Performance wise it's negligible unless you're doing the same calls thousands of times.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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