Hi,
I wonder if anyone can help me with this?
I have a very simple mini-Quest mod which I want to work from either end without disabling the target NPC, who is Undead. The quest item is a book which has been lying there for a century, so it will not just "appear" for no reason, so I do not want to disable it.
Stage 10 (find and read a letter)
Adds Journal Entry, Update Map, Add Floating Quest Markers, SetStage(10), SetObjectiveDisplayed(10), Starts Quest
Journal Entry I have read a private letter to some guy…
Objective 10 Search the ruins for the book that interests some guy…
Stage 20 (search ruins, find and kill the revenant, take the book from his inventory)
Updates Journal Entry, Removes Floating Quest Markers, SetStage(20), SetObjectiveCompleted(10), SetObjectiveDisplayed(20)
Journal Entry I have found the ancient tome that interests Some Guy.
Objective 20 Study the Book Some Guy is interested in.
Stage 30 (Readthe Book)
Read the Book, Update Journal, acquire the secret knowledge as a hidden perk added to player, SetObjectiveCompleted(20), SetStage(30), End Quest
These all work fine.
In case the player just explores and find the book on his own, I added Stage 25
Stage 25 (find and kill the revenant, take book from his inventory)
Starts Quest, Updates journal, disables letter, Set Stage(25), SetObjectiveDisplayed(25)
Journal Entry I have found an ancient tome…
Stage 25 Read the Book…
Stage 35 (Read the Book)
Read the Book, Update Journal, acquire the secret knowledge as a hidden perk added to player, SetObjectiveCompleted(25), SetStage(35), End Quest
I've tweaked it as best I can and it works perfectly forwards, but if I find the book before reading the letter, it goes to Stage 20 instead of 35 when I read the book.
If I use If/Else, it won't compile, but if I use If/ElseIf it compiles fine. I suspect OnRead() won't allow arguments, though.
If I read the note it starts Stage 10, then when I take the book from the corpse, it goes to Stage 20 and updates the journal, then when I read the book and it goes to Stage 30 and completes with the correct journal entry.
If I do not read the note and take the book from the corpse, the Quest Starts and it displays Stage 25, then when I read the book it updates but with the Stage 20 journal entry instead of Stage 35 and completes.
Each journal entry has slightly different text so I can tell which Stage it belongs to.
Scriptname SWSQ_QuestStartSCRIPT extends ObjectReference
Quest Property SWSQ_Quest Auto
int Property SWSQ_Quest_Stage Auto
ObjectReference Property SWSQ_MapQuestMRKR Auto
ObjectReference Property SWSQ_Note Auto
Event onRead()
If SWSQ_Quest.GetStage() < 10
SWSQ_Quest.setStage(10)
SWSQ_Quest.SetObjectiveDisplayed(10)
SWSQ_MapQuestMRKR.addtomap()
ElseIf SWSQ_Quest.GetStage() > 10
SWSQ_Note.Disable()
EndIf
EndEvent
Scriptname SWSQ_QuestStopSCRIPT extends ObjectReference
Quest Property SWSQ_Quest Auto
Perk Property SWSQ_QuestPerk auto
ObjectReference Property SWSQ_Note Auto
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
; Letter was read first
If SWSQ_Quest.GetStage() == 10
SWSQ_Quest.SetObjectiveCompleted(10) ; "I have found THE book"
SWSQ_Quest.SetStage(20)
SWSQ_Quest.SetObjectiveDisplayed(20)
; Book is discovered first
ElseIf SWSQ_Quest.GetStage() < 10
SWSQ_Note.Disable()
SWSQ_Quest.SetStage(25) ; "I have found A book"
SWSQ_Quest.SetObjectiveDisplayed(25)
EndIf
EndEvent
Event onRead()
; Letter is read first
If SWSQ_Quest.GetStage() == 20
SWSQ_Quest.SetStage(30)
SWSQ_Quest.SetObjectiveCompleted(20)
Game.GetPlayer().AddPerk(SWSQ_QuestPerk)
; Book is discovered first
ElseIf SWSQ_Quest.GetStage() == 25
SWSQ_Quest.SetStage(35)
SWSQ_Quest.SetObjectiveCompleted(25)
Game.GetPlayer().AddPerk(SWSQ_QuestPerk)
EndIf
EndEvent
The Quest Fragments from the Aliases for the Map Marker and the NPC marker are:
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 12
Scriptname QF_SWSQ_Quest_02000D7C Extends Quest Hidden
;BEGIN ALIAS PROPERTY SWSQ_NPCMRKR
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SWSQ_NPCMRKR Auto
;END ALIAS PROPERTY
;BEGIN ALIAS PROPERTY SWSQ_MapQuestMRKR
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SWSQ_MapQuestMRKR Auto
;END ALIAS PROPERTY
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Is there anything you can see that might cause this? Stage 20 is being completed even if it is set at Stage 25 and should go to Stage 35.
But if it IS at Stage 20, it goes to Stage 30 as intended.
I suspect that arguments don't work with OnRead(), but I can't find anything definitive about it either way.
Cheers!
~