Problem with the "pay x gold do _y_" quest command.

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Post Reply
imsobadatnicknames
Posts: 371
Joined: Sun Jun 02, 2019 4:28 pm
Location: Colombia

Problem with the "pay x gold do _y_" quest command.

Post by imsobadatnicknames »

Hey, so I wanted to ask if anything about the way the "pay x gold do _y_ otherwise do _z_" quest command has changed in recent versions of the game? I'm running Beta 0.11.2 and I noticed a problem when trying to hire a group of mercenaries from my mercenaries mod. The hiring process is implemented through the following part of a quest file:

Code: Select all

_hire_ task:
	pay 1000 money do _hired_ otherwise do _poor_
So, once the _hire_ task is activated, the quest will charge you 1000 gold and do the _hired_ task, which gives you the mercenaries as travelling companions, and if you don't have 1000 gold it'll do the task _poor_ which will show you a message saying you don't have enough money.
However, when I tried to hire them, It did both: it gave me the mercenaries as companions and then displayed the "you don't have enough money" message. And then when I checked my inventory most of my gold was gone.
So, I checked a few things in the quest´s code and the quest debugger, and turns out what was happening was that, instead of charging me the money once, the "pay x gold" command kept charging me 1000 gold over and over again as long as the _hire_ task was active until I didn't have enough to pay the 1000 gold, at which point it displayed the "you don't have enough money" message.
Anyway, I can fix it by making it so that the _hired_ task deactivates the _hire_ task, so it's no big deal, but it's still weird because this wasn't the case before. Back when I first wrote this mod it just used to charge the money only once regarldless of wether the task kept activated afterwards or not, which makes me think that maybe something about the way this quest command works got changed in the newer vessions of the game? I'm not exactly sure when this started being an issue because I haven't been playing daggerfall much in the last few months, but I remember it working correctly in the alpha versions at least.

EDIT: I modified my mods to stop this issue from affecting them, but I still think it might be worth looking into this quest command because other quests that do the same thing (using this command and then not clearing the task that calls for it) might have gotten broken in the same way and started charging the player infinitely.
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: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Problem with the "pay x gold do _y_" quest command.

Post by Hazelnut »

Hi, this action allows rearming so it can be used more than once. For instance if player doesn't have the money the first time. That does mean you need to disable the task once the money is paid. As for why the behaviour changed, not sure TBH.

So I added that action in January last year and updated it January this year to allow just gold to be accepted since I could no longer use the normal action after some (apparently unnecessary) quest machine code was removed. I also needed to unset the task so it didn't fire repeatedly in my quest. The code removed was per-task click rearming, and it was restored a couple of weeks later but I'd already changed my quest and improved it so I left it.

Not sure if this is connected or not, but figured I'd mention it. My quest machine knowledge only goes so far. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply