This example will show you a conversation that will start and finish a Quests for the player using the plugin QUESTS.
The quest will consist on bringing an iron ingot to the NPC. I will use an empty quest called bob_the_king. What I mean by an empty quest is that it will have an empty stage, the quest itself will be managed by my plugin Interactions because we want something simple.
name:'{centered}&c&lBob'starts_with:- NPC named Bobblock_movement:trueslow_effect:falsesave_conversation_progress:falsestart_conversation_radius:0end_conversation_radius:5requires_permission:falseconversation:conversation1:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7Hello, can you help me with something?'time:2show_name:falseconditional_dialogue:conditional_dialogue1:requires: - '%quests_player_has_completed_quest_bob_the_king% == true'start_conversation:conversation6conditional_dialogue2:requires: - '%quests_player_has_current_quest_bob_the_king% == Yes'start_conversation:conversation4options:option1:text:'&eSure.'start_conversation:conversation2option2:text:'&eNot now.'start_conversation:conversation3random_dialogue:falseconversation2:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7Could you bring me an iron ingot please?' - ' ' - ' 'time:2show_name:falsedialogue2:text: - '{centered}&eQUEST STARTED!' - '{centered}&f&nBob the King' - '{centered}' - '{centered}&6Objective:' - '{centered}&7Bring x1 Iron Ingot to Bob on Kryngel city.'time:2actions: - 'title: 20;40;20;&6QUEST STARTED!;&fBob the King' - 'console_command: questadmin give %player% bob_the_king'show_name:falsesave_dialogue_to_player:truerandom_dialogue:falseconversation3:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7Ok no problem.'time:2show_name:falserandom_dialogue:falseconversation4:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7I don''t see an iron ingot with you.' - '{centered}&7Please hurry!'time:2show_name:falseconditional_dialogue:conditional_dialogue1:requires: - '%checkitem_mat:IRON_INGOT,amt:1% == yes'start_conversation:conversation5random_dialogue:falseconversation5:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7You have the iron ingot? Perfect, thanks!'time:2actions: - 'remove_item: IRON_INGOT;1' - 'console_command: questadmin finish %player% bob_the_king'show_name:falseactions_after_dialogue:truerandom_dialogue:falseconversation6:dialogue:dialogue1:text: - '{centered}&c&lBob &f:' - '{centered}&7Thank you again for the iron ingot. Have' - '{centered}&7a nice day.'time:2show_name:falserandom_dialogue:false
Explanation
We have 6 different conversations, I will explain what each of them does.
The first time the player speaks with this NPC, it will ask for help and show 2 options. The first option will send the player to conversation2 and the second option to conversation3.
If the player has already completed the quest bob_the_king , conversation6 will be started instead. If the player is currently doing the quest, conversation4 will be started.
These conditions/requirements are managed by the conditional dialogues. In the case of the plugin Quests each variable will return something else (it's king of weird)
%quests_player_has_completed_quest_<quest>% should return true or false.
%quests_player_has_current_quest_<quest>% should return Yes or No.
The player wants to help the NPC so conversation2 starts and a console_command action is defined, which will start the quest executing this command from the console:
questadmin give %player% <quest>
The player doesn't want to help the NPC so nothing happens and the conversation ends.
This conversation will start when the player is currently doing the quest and speaks again with this NPC. First, the conditional dialogue will be verified. If the player has at least x1 Iron Ingot in its inventory, conversation5 will start.
If the player doesn't have x1 iron ingot a dialogue will be sended telling that the player doesn't have the iron ingot and the conversation ends.
This conversation will start when the player speaks with the NPC having an iron ingot. The following command will be executed, finishing the quest:
questadmin finish %player% bob_the_king
It is important also to remove the iron ingot from the player's inventory using the remove_item action: remove_item: IRON_INGOT;1
This conversation will start when the player speaks with the NPC having already finished the quest. We don't want the player to access the quest again so we just send a new dialogue that ends the conversation.