"have item" with permanent items?

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

"have item" with permanent items?

Post by haloterm »

I am a bit confused.

To check if the player has a permanent custom book in his inventory, I want to use the following:

Code: Select all

Item _PressPass_ book key 1025470710

have _PressPass_ set _HasPressPass_

_HasPressPass_ task:

_victoryR_ task:
    when _HasPressPass_
        say 1031
It is a custom book made permanent in another (previous) quest. I.e. the player got it as reward in quest 1 and now, in quest 2, I want to check if he has it in his inventory.

I have used this kind of code a lot already with non-permanent quest items (those with green background). But this time it does not work. The "HasPressPass" will never switch to true, even if I add the book in question in the console with "addbook 1025470710"

The book exists and works, the ID is correct of course (tested it), but it simply seems not to be recognized.

Can only non-permanent quest items (or items created by the current quest) be used with "have"?

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

Re: "have item" with permanent items?

Post by imsobadatnicknames »

Sadly, I think "have _item_ set _task_" can only be triggered by a specific instance of the item created by the current quest. E.g. if a quest sends you to get some clover that's hidden away in a dungeon, you can't pop in by the local apothecary and buy some clover to turn it in and pass the quest, as the have condition will only be triggered by the specific clover instance created in the quest dungeon. Each quest only knows of and cares about the specific instances of items created by itself. The quest you're writing has absolutely zero awareness of the Press Pass you got from a previous quest.

I saw your post about this in the Black Horse Courier thread.
If you want the press pass to be recognized by other quests, I don't think there's a way to do it but I think you can probably fudge it to make it seem like other quests recognize it.

Maybe you can make the same quest that gives you the press pass also activate one of the unused global variables, and then have the other quests play out differently if said global variable is active? That way it'd seem like they're reacting differently because you have the press pass.
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
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: "have item" with permanent items?

Post by Hazelnut »

Once you make it permanent then the item is a normal item that's not part of the quest system anymore I think. I'm not an expert on the quest machine so I could be wrong.
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: "have item" with permanent items?

Post by haloterm »

Thanks for answering!
imsobadatnicknames wrote: Thu Oct 08, 2020 1:49 pm Maybe you can make the same quest that gives you the press pass also activate one of the unused global variables, and then have the other quests play out differently if said global variable is active? That way it'd seem like they're reacting differently because you have the press pass.
Hm, yes, a global variable would be an easy way, but not very good because there are so few of them.

As alternative, I thought about creating a custom faction, so at the moment when the player gets the press pass, his repute will change with the new faction by

Code: Select all

change repute with _qgiver_ by nn
which according to the docs will "propagate that change to all the factions allied with and repudiated by _qgiver_." Then I could use

Code: Select all

when repute with aFaction is at least nnn
(where aFaction is the faction of qgiver from the previous quest).

But for doing that I would need to study Hazelnut's Archaeologist mod very careful and creating a custom faction or guild just for this one little check may be a bit over the top for what I need.

So I guess I will use a global variable instead.

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

Re: "have item" with permanent items?

Post by Hazelnut »

Why not leave it as a quest item, or does that require that the quest is never finished?

You may need to read through the code to work this out.
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: "have item" with permanent items?

Post by haloterm »

Hazelnut wrote: Thu Oct 08, 2020 3:59 pm Why not leave it as a quest item, or does that require that the quest is never finished?
When I create a quest item in quest 1, this item vanishes when quest 1 ends, so I can't use it in quests 2 ... n. So quest 1 would indeed have be a never-ending quest (and this only if I really could check in quest 2 ... n for quest items created in quest 1 -- aren't they too restricted to quest 1?)

But I already have a few never-ending quests which I use for newspaper items. These are parchment items with message. In these messages I include names of NPCs, places and the player character (like the player name is written as author, whereas NPC and location names are mentioned in the newspaper texts). These items are already done by nearly infinite quests (27 years... maybe I reduce that to 1 year. I guess that is enough for the player to take note of the item and read them several times, so maybe they can be destroyed after that time). I do this because otherwise the NPC/location/player names could not be part of the texts (can't be reference in permanent custom books), and this would be not immersive.

So, as I already use this not-so-elegant solution a few times, I want to avoid to use it for another item.

For my particular "press pass" item, the idea is as follows:

The player does the first 4 chained quests. In the end, he is awarded with the press pass, indicating that he is reporter for the Black Horse Courier. I intended to use that one in lots of other quests to check if the player is reporter or not. Depending on the result of this check, the quests play out differently.

For example, in one quest the player witnesses a bank robbery. While the robbery itself is the same and the Black Horse Courier will publish an article about the robbery, the text of the article is completely different if the player is regarded as reporter or not. He will also get a payment from the Black Horse Courier if the player is reporting, whereas he won't get payment if the article is not written by him, but by some NPC.

Finally, if the player is reporter, other quests get started than if he is not reporter.


So it's all quite complex, because quests are chained in multiple ways, multiple paths and multiple endings.

That's why I now go with a global variable. It's much easier and painless, and I want to focus on the content, not the programming.

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

Re: "have item" with permanent items?

Post by Hazelnut »

Fair enough, probably best to use the global var then unless Interkarma comes up with something I am unaware of.

Why do you have a timer of 27 years on your main quest script at all? It's not mandatory AFAIK.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: "have item" with permanent items?

Post by imsobadatnicknames »

Hazelnut wrote: Thu Oct 08, 2020 3:59 pm Why not leave it as a quest item, or does that require that the quest is never finished?
Afaik, quests seem to only be aware of the existance of an item if its a specific instance of the item created through themselves.

If I have a quest that requires me to get en emerald, and it includes a "have _emerald_ set _havemerald_" condition, this condition will only be triggered if I have the specific emerald created by this quest, and will never be trigered by any emeralds obtained from other sources (including other quests).

So, even if haloterm left the press pass as a quest item and set the quest he obtained it through to never end, other subsequent quests would have no awareness of it and no way to check if the player has it in their inventory.
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
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: "have item" with permanent items?

Post by haloterm »

Hazelnut wrote: Thu Oct 08, 2020 5:46 pm Fair enough, probably best to use the global var then unless Interkarma comes up with something I am unaware of.

Why do you have a timer of 27 years on your main quest script at all? It's not mandatory AFAIK.
Without the timer, the parchment items with the newspaper texts are lost. As I explained, these newspapers can't be permanent custom books, because these could not dynamically include NPC and location names.

27 years seemed long enough to me for a playthrough.

I don't know how to make a quest "really" infinite.

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

Re: "have item" with permanent items?

Post by imsobadatnicknames »

haloterm wrote: Thu Oct 08, 2020 6:40 pm 27 years seemed long enough to me for a playthrough.

I don't know how to make a quest "really" infinite.
You can just not include an end condition

For most quests this would be bad practice, but since it's a quest that's suppsoed to stay running through your entire playthrough, I don't think there should be any problem with it
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

Post Reply