How to handle delivering 2 required objects to complete a quest

Hi there,

I've found a very convoluted way to resolve this problem, but I'm hopeful there must be a smarter, less time-consuming way to do it.

Looking at the Quest documentation, I can't find a method that allows me to successfully deliver 2 or more requested objects to a quest giver, so that the quest can be completed.

I should say that I am using Pixie's 'Conversations' library to resolve the quest in the form of conversation topics which effectively 'hand over' the item(s) to the quest giver.

Currently I have 2 conversation topics set up that 'unhide' when the player has the quest objects in their inventory. Each topic can then be selected when in conversation with the quest giver to effectively 'hand over' the object.

I set up boolean attributes ('qinv') for both objects to switch to 'true' when they are handed over to the quest giver (called Questgiver). Then I put an 'If' script in to ask if the other object also had their 'qinv' boolean set to 'true'. If it does, then the quest completes.

What I don't know is how I would handle a quest that required more than 2 items to be delivered.

Here's the code for one of the objects' conversation scripts which moves the object (starbloom) from the player to the quest giver, and checks if the other object (cerynol) has also been delivered, then completes if both conditions are met:

msg ("Quest giver says thanks, etc.")
MoveObject (starbloom, Questgiver)
set (starbloom, "qinv", true)
if (cerynol.qinv = true) {
  msg ("'That's everything!'<br/><br/>'Now I can whip up your potion- A TIME POTION!'")
}

Does anyone know of a cleaner way to handle writing a script to deliver 2 or more items to complete a quest?

I would basically like to learn an efficient method for:
If (player) has (all required quest objects) in (inventory) then (run complete quest script) on talking to (quest giver).

I appreciate any help with this. I'm sure there must be a simpler solution!


I don't know if it's simpler, but maybe you could set the quest objects to up an integer value when given to the NPC? Or when gotten? Then the conversation would check for the full integer value?

If player.questobjects = 3 then, move objects to place and complete quest

Something like that but in real code?

Actually, I think that Pixie's convoLib lets you set a reaction, so the reaction could be set to your integer value. Then the NPC would say something like "oh, i see you found all my x objects!" and you'd complete the quest.


So I looked it up to be a little more specific.

I think it would be easy to have in each of the quest object's "when taken" script something like.

player.questobjects = player.questobjects +1

Then, how you do a reaction in ConvLib is (after enabling reactions according to the instructions) in the reactions tab

@
quest objects all gotten
player.questobjects = desired#
'So, you've finally found them all! Are you ready to hand them over?'

And then your conversation checker if the player decides to talk to the character and say yes, would be something like

If player.questobjects = desired# {
completequestscript

Or maybe you could have the "on entering room" script check if you've got all the objects and do the moving and quest object giving? ... but it might display in the wrong order.

"You've completed the quest!"
"So, you've finally..."


Wonderful, thank you! I like the idea of using integers and the reaction feature for convs - hadn't looked into that yet. I'll give it a go on the next quest I put together.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums