To see this problem in action, accept quests from the Fighters Guild then immediately speak to the quest giver once again. Many of their scripts will immediately give player a reward, even though you haven't moved from the spot. Not all quests have this problem, but many of the Fighters Guild quests do experience it.
So I thought I'd put together a quick tutorial on how to properly script quest completion. Let's start with an example of a bad quest script from M0B00Y06.
The error is happening in S.02, which has a single trigger condition "clicked npc _qgiver_". The moment you click on the quest giver, this task will be executed whether you've completed the quest or not.
Code: Select all
_S.02_ task: clicked npc _qgiver_ give pc _gold_ end quest _clearclick_ task: when _S.02_ and not _S.01_ clear _S.02_ _clearclick_
You'll note there's a _clearclick_ task which is supposed to be checking for quest completion and clearing the click, but it doesn't matter because S.02 has already been executed.
Here's the correct way to script a quest ending, from CUSTOM01.
There are three parts to this:
Code: Select all
_questorClicked_ task: clicked npc _questgiver_ _clearclick_ task: when _questorClicked_ and not _necromancerDead_ clear _questorClicked_ _clearclick_ _rewardPlayer_ task: when _questorClicked_ and _necromancerDead_ give pc _reward_ end quest
- _questorClicked_ task picks up the click on quest giver.
- _clearclick_ task checks the quest ending condition(s) and clears both _questorClicked_ and itself when quest not completed.
- _rewardPlayer_ task will check both _questorClicked_ and quest ending condition(s) and only then gives player their reward and end quest.
Many of these quest scripts will need to be fixed eventually. Fortunately this is an easier job now everything is in plain text and people can send a PR.
For now though, I'm happy to have the same bugs as classic Daggerfall because these problems actually help me confirm my quest engine is properly emulating classic - because the same bad script behaviours are present in both.