Making a letter item permanent (and keeping the contents)

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

Making a letter item permanent (and keeping the contents)

Post by haloterm »

I am making good progress with my little quest line.

At the beginning of the quest, the player gets a letter (which actually serves as a newspaper) which is connected with a message, so the player can read the paper.

I want to make this item permanent, so it does not disappear magically once the quest ends. But when I make the item permanent, the content is lost and it just ends up as parchment.

I use the following code:

Code: Select all

Item _BHCIssue_ letter used 1020

give pc _BHCIssue_ notify 1010

make _BHCIssue_ permanent
Is there a way to preserve both item and associated text?

Or (as I fear) is the text lost simply because the message (1020) only exists as long as the quest is running and because the message (1020) is removed with the finished quest, the item can only be empty parchment?

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

Re: Making a letter item permanent (and keeping the contents)

Post by Jay_H »

That specific item is lost when the quest ends. There's no way to make a quest item persist beyond its quest.

However, you could do "start quest NEWSPAPER" with a new quest called NEWSPAPER, that puts that item into the player's inventory. Then you can decide how long that quest would last with timers, or forever.

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

Re: Making a letter item permanent (and keeping the contents)

Post by haloterm »

Jay_H wrote: Tue Feb 04, 2020 1:25 am However, you could do "start quest NEWSPAPER" with a new quest called NEWSPAPER, that puts that item into the player's inventory. Then you can decide how long that quest would last with timers, or forever.
That sounds like a good idea! Are there any unwanted side effects (engine errors, memory issues, performance issue...) when a quest runs infinitely?

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

Re: Making a letter item permanent (and keeping the contents)

Post by haloterm »

Jay_H wrote: Tue Feb 04, 2020 1:25 am Then you can decide how long that quest would last with timers, or forever.
Sorry for asking again, but I feel a little bit stupid.

HOW do I set a quest to last forever? I tried the following (using a very un-elegant 10000 in-game-days clock):

Code: Select all

Item _BHCIssue_ letter used 1020

Clock _Infinity_ 10000.00:00

start timer _Infinity_
give pc _BHCIssue_

_Infinity_ task:
The timer runs and the quest debugger is telling me that the quest is running (which I do expect, because I never write "end quest"). Still, DFU shows the "quest finished" (1004) message immediately after starting the quest. And the item is converted to parchment again -- despite the quest still running. Confusing.

I am sure I'm overlooking anything ... (but it's late...)

Edit: Aaah, it was because I used "give pc" without "notify". Apparently "give pc" without notify means giving a quest reward, thereby ending the quest. I wanted to give the item silently to the player, without additional message at this moment, but if I have to, well...

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

Re: Making a letter item permanent (and keeping the contents)

Post by Jay_H »

Only "end quest" should terminate the quest. I don't know of other commands doing so. The main quest backbone, Sx099, runs indefinitely until its conditions are met, so there's an example of a time-unlimited quest.

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Making a letter item permanent (and keeping the contents)

Post by Hazelnut »

As Jay points out you don't need a timer to keep the quest alive. Just don't end it. Still seems like the wrong solution though.

Would it not make more sense to use a custom book for this rather than have the quest never expire just so the letter text is still available? Obviously you cannot do that until I make the change to allow specifying books in quests, but seems like you could develop and test with a letter that expires for now and switch in a book later.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Making a letter item permanent (and keeping the contents)

Post by haloterm »

Hazelnut wrote: Fri Feb 07, 2020 10:53 am Would it not make more sense to use a custom book for this rather than have the quest never expire just so the letter text is still available? Obviously you cannot do that until I make the change to allow specifying books in quests, but seems like you could develop and test with a letter that expires for now and switch in a book later.
Yes, of course this would make more sense :) I have already downloaded the tool to create custom books, but so far I have to work with what I've got.

For the book support, the following things are important for me (regardless if they would work in DFU currently; it's the "ideal" situation):

1. I want to be able to select a specific book. I understand that with your upcoming changes I will be able to do that.

2. It would be great to prevent that some of the custom books show up in bookstores -- or make sure they show up only if a quest condition is met. The reason for this is that, story-wise and narratively, some of these books (articles) are rather rare, while for others it is the player who "writes" them during the quests. They are in fact part of the reward for finishing some quests, and sometimes the text in these books (articles) points to the next quest. So these books should not appear in a shop (or in some other unrelated quest as random reward) before the quest is finished. My current approach ensures this (and I use it also to place some copies of the Black Horse Courier at certain times randomly in the world).

3. It would be great for being able to use the "parchment" icon instead of the "book" icon for some books, since the "Black Horse Courier" (in Oblivion and the BHC Skyrim mod) also is usually written on scrolls, not books. It's a newsletter, after all.

Point 1 is the most important 1; 2 and 3 would just be nice to have but I can work without it.
Jay_H wrote: Tue Feb 04, 2020 5:04 am Only "end quest" should terminate the quest. I don't know of other commands doing so. The main quest backbone, Sx099, runs indefinitely until its conditions are met, so there's an example of a time-unlimited quest.
I was assuming that "give pc an Item" (without silently or notify) ends the quest, because the documentation of the Template language states:
give pc anItem: This action bestows one or more quest items through the inventory screen. Once the PC transfers an item to his inventory, that item loses its green backdrop and becomes just another piece of the player's property.
Using this action triggers the display of the Qrc QuestComplete message, as though the command is always preceded by an unwritten say QuestComplete command.
Anyway, I now know I have to work with "get item" anyway.

For the Sx099 as example, I found there the following timer:
Clock mainquestclock 00:00 0 flag 9 range 0 0
and a related variable afterwards.

I assume this creates an infinite timer, but as I have no idea what the flags of a clock mean, I was hesitant to use that so far. It's of course a more elegant solution.

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

Re: Making a letter item permanent (and keeping the contents)

Post by haloterm »

While I was going again through my "letter" items, I noticed that I very often refer to randomly generated NPC and place names in these texts. For example the very first BHC issue the player gets at quest start has the name of a reporter which is generated by the game. Or an (actual) letter written on the back of another BHC issue refers to a certain place.

So... I think for my newspapers I will mostly stick with the method I used for now, to embed the papers better into the dynamic game world.

But I will need the custom book change still, because I need to write a book with secrets for a subquest, and finding this book is important for the story. I also want to include a book like "the best Black Horse Courier articles of 3E404" (as collection).

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Making a letter item permanent (and keeping the contents)

Post by Hazelnut »

You seem to be figuring stuff out really well. Seems there are 2 options, to random or fixed. If you use fixed locations and NPCs it's more work but you can refer to them in books. If you use the random quest generated resources then you will need to use letters with the replacement vars. Just note that if you're doing the latter and keeping quests around permanently, this will increase the amount of stuff DFU is keeping in memory & savefiles etc. Not an issue necessarily, but don't go mad with 100s. :)

See TheLacus' documentation regarding custom books. https://www.dfworkshop.net/projects/dag ... ing/books/ Seems like isUnique should do what you want, but I never tried it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Making a letter item permanent (and keeping the contents)

Post by haloterm »

Hazelnut wrote: Fri Feb 07, 2020 3:44 pm You seem to be figuring stuff out really well.
Well, a bit ;) The biggest problem initially for me was to think in threaded tasks instead of linear begin...end programming, but I've wrapped my mind around that now. It's actually not bad for an open world game.

I am currently using two (nearly) unlimited timers (still not tried Jay_H's suggestion). When I note that it makes the game unstable or gives performance issues, I will have to change to the fixed texts without dynamic names. But so far everything works good, even with all the other mods and quests that run at the same time.

Post Reply