Talk:Reset - Quest

Revision as of 18:18, 7 December 2013 by imported>Arthmoor

On my custom quest, Quest.Reset() is working fine. Maybe it got fixed or it is only broken for standard quests? -- Jsquirrel

Quite strange then... it doesn't work for me. I'm using the CK version 1.5.24 and Skyrim is version 1.6.89.0.

This is the code I used to test:

Scriptname fg109TestQuestScript extends Quest

Event OnInit()
	Debug.Notification("Quest was initialized.")
	RegisterForSingleUpdate(10)
EndEvent

Event OnReset()
	Utility.Wait(1)
	Debug.Notification("Quest was reset.")
EndEvent

Event OnUpdate()
	Debug.Notification("Quest is updating.")
	if (Game.GetPlayer().IsSneaking())
		Stop()
		Utility.Wait(1)
		Start()
	else
		Reset()
	endif
EndEvent
Scriptname fg109TestMEScript extends ActiveMagicEffect

Quest Property fg109TestQuest Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Debug.Notification("Attempting to restart the quest.")
	if (akTarget.IsSneaking())
		fg109TestQuest.Stop()
		Utility.Wait(1)
		fg109TestQuest.Start()
	else
		fg109TestQuest.Reset()
	endif
EndEvent

Neither the Reset in the quest script nor the one in the magic effect script caused the message in either the OnInit block nor the message in the OnReset block to show up. The calls to Stop and Start did work in both scripts. Also, as noted in the OnReset notes, the message in the OnReset block is never shown, even when the quest is restarted successfully. --Fg109 15:39, 15 June 2012 (EDT)

Interesting. I'm using CK version 1.6.89.0 (current version from Steam) and game version 1.6.89.0.6 (also from Steam).

In my quest, an NPC hides a book in a chest at a certain time each day, if it is not already there (using a custom package). The player then gets asked by another NPC to find the book, advancing through a quest line that leads the player to eventually drop the book back on the table where it belongs. Dropping the book leads to this code being executed (much simplified version):

Event onContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
  Quest q = self.GetOwningQuest()

  if ((akOldContainer == Game.GetPlayer()) && !akNewContainer && (q.GetStage() == 150))
    q.SetObjectiveCompleted(40)
    q.SetStage(0)
    q.Reset()
  endIf
endEvent

I am not using the OnReset event, though, and when I added OnReset()-Code it didn't fire for me either. But I can see in my quest log in-game that the quest has been reset and thus the diary can be hidden again. Note also that my quest does not complete while it is in the hide-find-return loop. It repeats until you catch the thief in the act, which is the only way to complete the quest. -- Jsquirrel

Maybe it's the SetStage(0) that's causing you to think the quest has been reset, when it actually hasn't. What happens if you take that out of the code? --Fg109 14:52, 21 June 2012 (EDT)
This doesn't work because OnReset() is not a member of the Quest script. So it will not respond to that event at all. Quest.Reset() does in fact do what it's supposed to, it just will not trigger an OnReset() event to tell you that. Arthmoor (talk) 2013-12-07T18:18:19 (EST)
Return to "Reset - Quest" page.