problem with clearing a task

For all talk about quest development - creation, testing, and quest system.
Post Reply
User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

problem with clearing a task

Post by haloterm »

Once in a year I come back to DFU quest development and of course I have a question.

The player should click on a monster. If the player has some item, message A should appear and the quest ends, but if the player has not that item, message B should appear and he can return later when he has the item.

Following code snippet (I have obfuscated the actual monster and item names, to avoid spoilers :D but the logic is directly from my quest):

Code: Select all

_MonsterMessageOK_ task:
    when _clickedMyMonster_ and _hasTheItem_
        say 1024
        start task _endquest_

_MonsterMessageNotOK_ task:
    when _clickedMyMonster_ and not _hasTheItem_
        say 1021
        clear _clickedMyMonster_ _MonsterMessageNotOK_

_clickedMyMonster_ task:
    clicked foe _MyMonster_
The click condition itself works - when I don't have the item, the correct task (the one calling message 1021 - is executed.

But the clearing commands in that task somehow do not work. Making it impossible to click that monster again.

What do I do wrong?


Edit: Sorry, wrong forum, should be in quest development. If someone could move it ... thanks!

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: problem with clearing a task

Post by BadLuckBurt »

Just a guess but try clearing the task from another task. I'm not sure if tasks can clear themselves.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: problem with clearing a task

Post by haloterm »

BadLuckBurt wrote: Sun Sep 04, 2022 11:20 am Just a guess but try clearing the task from another task. I'm not sure if tasks can clear themselves.
That was what I tried first:

Code: Select all

_MonsterMessageNotOK_ task:
    when _clickedMyMonster_ and not _hasTheItem_
        say 1021

_clickedMyMonster_ task:
    clicked foe _MyMonster_
    
 _clearClickedMyMonster_ task:
    when _clickedMyMonster_
       clear _clickedMyMonster_ _clearClickedMyMonster_
But then the message (1021) gets not shown at all - I assume because there are 2 tasks with the same "when" condition and one of them is set before the other, so the other does not trigger.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: problem with clearing a task

Post by BadLuckBurt »

I'm an amateur at quest code writing but this doesn't work?

Code: Select all

_MonsterMessageOK_ task:
    when _clickedMyMonster_ and _hasTheItem_
        say 1024
        start task _endquest_

_MonsterMessageNotOK_ task:
    when _clickedMyMonster_ and not _hasTheItem_
        say 1021
        start task _clearClickedMonsterNotOK_

_clearClickedMonsterNotOK_ task:
        clear _clickedMyMonster_ _MonsterMessageNotOK_

_clickedMyMonster_ task:
    clicked foe _MyMonster_
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: problem with clearing a task

Post by haloterm »

BadLuckBurt wrote: Sun Sep 04, 2022 12:19 pm I'm an amateur at quest code writing but this doesn't work?
Unfortunately not - probably because the part

Code: Select all

_clearClickedMonsterNotOK_ task:
        clear _clickedMyMonster_ _MonsterMessageNotOK_
is not just executed when called by

Code: Select all

start task _clearClickedMonsterNotOK_
but at once (that's why in my 1st attempt I had a "when" condition to make sure it is only further evaluated if the monster has been clicked).

Hm.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: problem with clearing a task

Post by haloterm »

Okay, it seems that my problem is not the actual clearing of the task, but that the message itself with the "say" command is just shown the first time.

I noticed that after I figured out (again) how to enable the quest debugger (I forgot that it is not TAB anymore but SHIFT + CTRL + D). In the debugger it shows that the click is correctly reset, and that new clicks are also registered.

It seems I forgot that "say" messages can only be shown once.
Last edited by haloterm on Sun Sep 04, 2022 3:12 pm, edited 1 time in total.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: problem with clearing a task

Post by BadLuckBurt »

haloterm wrote: Sun Sep 04, 2022 3:03 pm Okay, it seems that my problem is not the actual clearing of the task, but that the message itself with the "say" command is just shown the first time.

I noticed that after I figured out (again) how to enable the quest debugger (I forgot that it is not TAB anymore but CTRL + D). In the debugger it shows that the click is correctly reset, and that new clicks are also registered.

It seems I forgot that "say" messages can only be shown once.
I know Interkarma is going to come back to that behaviour at some point, there's a Github issue on it. As Jehuty showed there, there are times where you only want a message to appear once but reusable messages are valuable in their own right.

I suppose you work around the limitation by copying the messages a couple of times and adjusting the quest so the recipient of the item gets more and more annoyed if you keep coming back without it to the point where the quest fails.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: problem with clearing a task

Post by haloterm »

BadLuckBurt wrote: Sun Sep 04, 2022 3:11 pm there's a Github issue on it.
Ah, found it, interesting, thanks :)

I now simply show the message once and add an entry to the log about it, so players don't forget what was shown.

Post Reply