Page 1 of 1

Quests Conditions applying only once?

Posted: Tue Apr 18, 2023 2:38 am
by NicoMozes
Good morning Toni,
I hope you are well!

I am trying to set some farming quests to be dependent on the time of the day. A mission to plant some crops, that can only be offered by the quest Giver, when a Lua Variable TimeOfDay is = to an int between 0 and 3. (0 = morning, 1 = Midday, 2 = Evening, 3 = Night)

I have the code done to update this variable at runtime, and its all good, however, the mission availability is not working as intended.

I have the mission with the following condition:
Lua Variable TimeOfDay == 1.

The game state begins with TimeOfDay at 0. I click a button to fast forward time to the next slot, and I update the variable at this point via script:
DialogueLua.SetVariable("TimeOfDay", desiredTime);

This updates correctly. The quest becomes grantable and all good.

The problem comes when the time moves again, the variable TimeOfDay has changed, but the quest remains grantable.

Is there a better way to do this? To make quests dependent on the time of the day?

JFI im using Azure Dynamic Sky for the time and weather.

Thanks for the help as always!
Nico

Re: Quests Conditions applying only once?

Posted: Tue Apr 18, 2023 8:40 am
by Tony Li
Hi,

When a quest's offer conditions become true, the quest marks itself as offerable and then stops monitoring the offer conditions -- so it won't know that it's past the time when it can offer the quest.

Here are a couple of ideas:

- Since you're using the Dialogue System, check it in a Dialogue System conversation. When the player interacts with the NPC, start a DS conversation. Check the Lua variable and branch accordingly.

- Or make a subclass of QuestGiver and use it for this NPC. Override GetOfferableQuests(). Call base.GetOfferableQuests(). Then loop through each of the quests. Set the quest state to WaitingToStart. Then call its quest.offerConditionSet.StartChecking(quest.BecomeOfferable) method. Then check if the quest is still offerable. If not, remove it from the offerableQuests list. One catch here: This only works if your quests use offer conditions that immediately check their conditions when told to StartChecking. If the quest's offer conditions wait for a message from the message system, it of course won't receive that message again, so it won't become offerable.

- Or, perhaps simpler, override GetOfferableQuests(). Instead of setting quests to WaitingToStart and re-running StartChecking, just check the quest's offerConditionSet for Lua conditions. If it has any, use Lua.IsTrue to check if the Lua condition is still true. If it's false, remove the quest from the offerableQuests list.

Re: Quests Conditions applying only once?

Posted: Tue Apr 18, 2023 11:04 am
by NicoMozes
Hi Toni,

Ok thanks for the info and the couple of Ideas.

I will look into it : )

Cheers,
Nico

Re: Quests Conditions applying only once?

Posted: Tue Apr 18, 2023 12:59 pm
by Tony Li
Glad to help!