Repeating trigger/timers within a quest?

For all talk about quest development - creation, testing, and quest system.
Sappho20
Posts: 67
Joined: Wed Jun 29, 2022 8:54 am

Repeating trigger/timers within a quest?

Post by Sappho20 »

Is it possible to create a repeating trigger/timer within a quest for flavor text?
Basically, I am writing a series of linked quests where the player has/is guarding a companion. For the purpose of immersion, I want the player to not only have the face on the side of the screen, but two or three times a day to have flavor text to give their companion personality, remind you they are there and give you some mild comic relief at times.
I have tried and I have found only two ways to do this but neither seem great:
One is two quests that start each other in a ‘closed loop’. I’ve seen this done in other companion mods, but I can’t do this as it appears impossible to stop the loop once started and I want the companion to leave you in the end of the quests.
The second method is to have a silly number of timers that follow each other and trigger the flavor text. The problem is I need to guess the amount of time the quest is active, and as 30 timers is 10 to 15 days of 2 – 3 texts a day the quests have ridiculous numbers of timers to trigger flavor text. Also, if the player takes longer than I guess the texts will stop before the quest is finished.
I would just like a repeating trigger for the flavor text that can repeat whilst the quest is active and trigger the text until the quest ends. This will allow the player to take their time and I could also create a ‘home’ quest from which all other quests begin from and will stop flavor texts when the story has finished. Is there a way to do this? It seems to me that timers can only time once and cannot be reset?

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Repeating trigger/timers within a quest?

Post by Jay_H »

It seems to me that timers can only time once and cannot be reset?
That's correct; timers cannot be refilled. Another limitation is that a text box cannot be shown twice; if you show text box 1010, there's no way to show it again (except for some minor exploits, but those are bugs, not features). Systems like Random Little Quests start and end the same quest repeatedly, so it refreshes the text boxes and timers in an indirect way.

Sappho20
Posts: 67
Joined: Wed Jun 29, 2022 8:54 am

Re: Repeating trigger/timers within a quest?

Post by Sappho20 »

Thanks, it's good to have that confirmed, I've spent way too much time trying to find a way to repeat a timer, now I know it cannot be done.
I have a solution, of sorts. If I use the closed loop consisting of a trigger quest and a text quest, which start each other and generate repeating text and timer, I can stop this loop if I add this:

Code: Select all

Quest: DWEventTrig
DisplayName: Living with a Baby

-- Message panels

QRC:

QuestorOffer:  [1000]

RefuseQuest:  [1001]
<ce>           

AcceptQuest:  [1002]
<ce>		You have reached the end of the Story. Do you want to keep the Baby?          

QuestFail:  [1003]
<ce>		Now I have it.                  

QuestComplete:  [1004]
<ce>		You can keep it.                 

QBN:

Person _questgiver_ named Lord_Auberon_Flyte atHome 

Clock _timer_ 04:11 12:13

--	Quest start-up:
	start timer _timer_

_timer_ task:

_daytime_ task:
    daily from 6:00 to 19:00

_chanceday_ task:
	when _daytime_ and _timer_ 
	start quest DWEventDay
	end quest

_chancenight_ task:
	when not _daytime_ and _timer_
	start quest DWEventNite
	end quest

_EndStory_ task:
	clicked npc _questgiver_
	prompt 1002 yes _yes_ no _no_

_yes_ task:
	say 1004
	start quest DWEventTrig1
	end quest

_no_ task:
	say 1003
	end quest
Then when the player gets to the last quest, they will be instructed to talk to Lord Auberon Flyte, who has a known location and he can disrupt the loop to end it. It does mean that the layer could effectively skip the entire story and go straight to the end, but this npc is obscure enough not to be a common person to talk to.

imsobadatnicknames
Posts: 371
Joined: Sun Jun 02, 2019 4:28 pm
Location: Colombia

Re: Repeating trigger/timers within a quest?

Post by imsobadatnicknames »

Jay_H wrote: Sat Jul 23, 2022 10:03 pm
It seems to me that timers can only time once and cannot be reset?
Another limitation is that a text box cannot be shown twice; if you show text box 1010, there's no way to show it again (except for some minor exploits, but those are bugs, not features).
The same text box can actually be shown several times as long as it's activated from different tasks and not from clearing and repeating the same task several times, although admittedly idk if this is what you were referring to with "some minor exploits". If so, I thought that was the intended behavior, I wasn't aware it was a bug :p

For example, in my Banditry and Travelling Merchants mod, when you encounter an adventurer group, the dialogue for all of them is contained within message 1020, but I'm able to show the message three times because interacting with each npc activates the message box through a different task.

Code: Select all

Quest: ADV1
DisplayName: Adventurers

-- Message panels

QRC:

Message: 1020
<ce> Hello there! It's a beautiful day, isn't it?
<--->
<ce> We were just at ___dun_. Still recovering from
<ce> the fight, but we got some pretty good loot.
<--->
<ce> Are you perhaps an adventurer too?
<--->
<ce> I can't wait to get back to ___tavern_, have nice
<ce> mug of Ale at _tavern_ and then fall asleep.
<--->
<ce> I'm exhausted. Going through ___dun_ wasn't easy.
<--->
<ce> And where are you heading?
<---> 
<ce> What's your name, stranger?

Message: 1023
<ce> You come across a group of people
<ce> resting. They seem to be a group 
<ce> of adventurers.

Message: 1024
<ce> The adventurers look
<ce> too hurt and tired to 
<ce> fight back "Please spare us!
<ce> Have mercy!" they say as they 
<ce> hand you some of their
<ce> loot and run away.

Message: 1025
<ce> Are you trying to rob us?
<ce> %oth! What a fool!
<--->
<ce> You thought you could rob us?
<ce> Come on, let's teach this
<ce> bandit a lesson!
<--->
<ce> You're outnumbered! Do
<ce> you really think you can
<ce> get away with this?
<--->
<ce> You don't scare us, scum!

QBN:
Foe _ad1_ is Thief
Foe _ad2_ is Knight
Foe _ad3_ is Sorceror
Clock _leave_ 03:00
Item _item1_ gem
Item _item2_ book
Item _item3_ potion
Item _coin_ gold
Clock _end_ 00:03
Place _dun_ remote dungeon
Place _tavern_ remote tavern

--	Quest start-up:
    create foe _ad2_ every 0 minutes 1 times with 100% success
    create foe _ad1_ every 0 minutes 1 times with 100% success
    create foe _ad3_ every 0 minutes 1 times with 100% success
    make _item1_ permanent
    make _item2_ permanent
    make _item3_ permanent
    make _coin_ permanent
    give item _item1_ to _ad1_
    give item _item2_ to _ad2_
    give item _item3_ to _ad3_
    restrain foe _ad1_
    restrain foe _ad2_
    restrain foe _ad3_
    start timer _leave_
    say 1023

_leave_ task:
    remove foe _ad1_
    remove foe _ad2_
    remove foe _ad3_
    end quest

_clicked1_ task:
    clicked foe _ad1_

_clicked2_ task:
    clicked foe _ad2_

_clicked3_ task:
    clicked foe _ad3_

_talk1_ task:
    when _clicked1_ and not _rob_
    say 1020

_talk2_ task:
    when _clicked2_ and not _rob_
    say 1020

_talk3_ task:
    when _clicked3_ and not _rob_
    say 1020

_s0_ task:
    when skill Streetwise is at least 0

_s20_ task:
    when skill Streetwise is at least 20

_s40_ task:
    when skill Streetwise is at least 40

_s60_ task:
    when skill Streetwise is at least 60

_s80_ task:
    when skill Streetwise is at least 80

_0to20_ task:
    when _s0_ and not _s20_

_20to40_ task:
    when _s20_ and not _s40_

_40to60_ task:
    when _s40_ and not _s60_

_60to80_ task:
    when _s60_ and not _s80_

_80to100_ task:
    when _s80_

_inj1_ task:
    injured _ad1_
    start task _rob_

_inj2_ task:
    injured _ad2_
    start task _rob_

_inj3_ task:
    injured _ad3_
    start task _rob_

_rob_ task:
    legal repute -1
    start quest CONSEQUENCES

_check1_ task:
    when _rob_ and _0to20_
    pick one of _fail_ _fail_ _fail_ _fail_ _fail_ _fail_ _fail_ _fail_ _success_

_check2_ task:
    when _rob_ and _20to40_
    pick one of _fail_ _fail_ _fail_ _fail_ _fail_ _fail_ _success_ _success_

_check3_ task:
    when _rob_ and _40to60_
    pick one of _fail_ _fail_ _fail_ _fail_ _success_ _success_ _success_

_check4_ task:
    when _rob_ and _60to80_
    pick one of _fail_ _fail_ _success_ _success_ _success_ _success_

_check5_ task:
    when _rob_ and _80to100_
    pick one of _success_ _success_ _success_ _success_ _success_ _success_ _success_ _success_ _success_ _fail_ _fail_

_success_ task:
    say 1024
    remove foe _ad1_
    remove foe _ad2_
    remove foe _ad3_
    get item _item1_
    get item _item2_
    get item _item3_
    pick one of _gold_ _nogold_
    start timer _end_

_nogold_ task:

_gold_ task:
    get item _coin_

_fail_ task:
    unrestrain foe _ad1_
    unrestrain foe _ad2_
    unrestrain foe _ad3_
    say 1025

_end_ task:
    end quest

_killed1_ task:
    killed _ad1_
    legal repute -1
    start timer _end_

_killed2_ task:
    killed _ad2_
    legal repute -1
    start timer _end_

_killed3_ task:
    killed _ad3_
    legal repute -1
    start timer _end_
This is the result:

Image

Image

Image

Admittedly this is still pretty unwieldy, as it requires the creation of a task for every time you intend to show the same message box.
Released mods: https://www.nexusmods.com/users/5141135 ... files&BH=0
Daggerfall isn't the only ridiculously intrincate fantasy world simulator with the initials DF that I make mods for: http://www.bay12forums.com/smf/index.php?topic=177071.0

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Repeating trigger/timers within a quest?

Post by Jay_H »

Hmm, I wasn't aware of that. I don't think I'll report it as a bug; the original purpose behind not repeating the textbox doesn't appear affected by this. As you said, it takes a lot of work to make this happen, so it'd really only be intentional.

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

Re: Repeating trigger/timers within a quest?

Post by BadLuckBurt »

Its not a bug, its a feature :) probably intended too. Nice to know this is possible
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
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Repeating trigger/timers within a quest?

Post by Interkarma »

This was intended, but Jay made the case for messages to only be displayed once. The related issue is below, I just haven't actioned yet.

https://github.com/Interkarma/daggerfal ... ssues/2352

Once the fix for this issue is live, messages can only be presented once - ever. Unless Jay wants to rethink the report and stick with current behaviour.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Repeating trigger/timers within a quest?

Post by Jay_H »

Ah, I didn't make the connection.

I will stick with the report, since the same effect could be made by duplicating the text box into message 1021, 1022, etc. The capability will still be there, though quest files will be a bit more verbose to compensate. I believe that's not a problem.

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

Re: Repeating trigger/timers within a quest?

Post by BadLuckBurt »

Definitely not a fan of that upcoming change. It's a bit backwards to have to duplicate a full text message just to be able to show it again. As far as I see it, in that Git issue, it's completely logical that you see that message twice. Why isn't that second call just made without the 'msg' part because that seems to be optional looking at the code in CreateFoe.cs, the base regexes don't even contain the pattern for it, that's a separate string.

Maybe I'm missing something but it seems a bit heavy-handed for something that looks like it could be fixed a lot easier. If the message part isn't optional, maybe it should be, that would fix the problem right?

Code: Select all

		const string optionsMatchStr = @"msg (?<msgId>\d+)";
		
		and then
		
                return @"create foe (?<symbol>[a-zA-Z0-9_.-]+) every (?<minutes>\d+) minutes (?<infinite>indefinitely) with (?<percent>\d+)% success|" +
                       @"create foe (?<symbol>[a-zA-Z0-9_.-]+) every (?<minutes>\d+) minutes (?<count>\d+) times with (?<percent>\d+)% success|" +
                       @"(?<send>send) (?<symbol>[a-zA-Z0-9_.-]+) every (?<minutes>\d+) minutes (?<count>\d+) times with (?<percent>\d+)% success|" +
                       @"(?<send>send) (?<symbol>[a-zA-Z0-9_.-]+) every (?<minutes>\d+) minutes with (?<percent>\d+)% success";
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
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Repeating trigger/timers within a quest?

Post by Interkarma »

Maybe there's a compromise to be found here? Let me think on it before I get back to grinding bugs again. I'll see what I can do.

Post Reply