> For the complete documentation index, see [llms.txt](https://fireworkpolymer.gitbook.io/interactions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fireworkpolymer.gitbook.io/interactions/wan-zheng-yang-li/untitled.md).

# 任务样例

这个样例会为你展示如何为玩家开始和结束一个任务，使用插件为[QUESTS](https://www.spigotmc.org/resources/quests.3711/)

此任务是要把铁锭带给NPC，我将会使用一个空任务，叫做"`bob_the_king`"。我的意思是空任务会有一个空阶段，任务本身会由interactions处理，因为我们要一些更简单的方法。

{% hint style="info" %}
因为我们要使用一些PlaceholderAPI的变量，所以记得下载以下变量

`CheckItem` 和 `Quests`\
*/papi ecloud download CheckItem (*[*https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders#checkitem*](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders#checkitem)*)*\
*/papi ecloud download Quests (*[*https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders#quests*](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders#quests)*)*
{% endhint %}

## 配置文件

```yaml
name: '{centered}&c&lBob'
starts_with:
- NPC named Bob
block_movement: true
slow_effect: false
save_conversation_progress: false
start_conversation_radius: 0
end_conversation_radius: 5
requires_permission: false
conversation:
  conversation1:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7你好，你能帮我一些事情吗?'
        time: 2
        show_name: false
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%quests_player_has_completed_quest_bob_the_king% == true'
            start_conversation: conversation6
          conditional_dialogue2:
            requires:
            - '%quests_player_has_current_quest_bob_the_king% == Yes'
            start_conversation: conversation4
    options:
      option1:
        text: '&eSure.'
        start_conversation: conversation2
      option2:
        text: '&eNot now.'
        start_conversation: conversation3
    random_dialogue: false
  conversation2:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7你能给我带个铁锭来吗?'
        - ' '
        - ' '
        time: 2
        show_name: false
      dialogue2:
        text:
        - '{centered}&eQUEST STARTED!'
        - '{centered}&f&nBob the King'
        - '{centered}'
        - '{centered}&6任务:'
        - '{centered}&7为Bob在Kryngel城带来一个铁锭.'
        time: 2
        actions:
        - 'title: 20;40;20;&6任务开始!;&fBob the King'
        - 'console_command: questadmin give %player% bob_the_king'
        show_name: false
        save_dialogue_to_player: true
    random_dialogue: false
  conversation3:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7好的，没问题.'
        time: 2
        show_name: false
    random_dialogue: false
  conversation4:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7我没看见你带了铁锭.'
        - '{centered}&7Please hurry!'
        time: 2
        show_name: false
        conditional_dialogue:
          conditional_dialogue1:
            requires:
            - '%checkitem_mat:IRON_INGOT,amt:1% == yes'
            start_conversation: conversation5
    random_dialogue: false
  conversation5:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7你有铁锭？非常好！谢了！'
        time: 2
        actions:
        - 'remove_item: IRON_INGOT;1'
        - 'console_command: questadmin finish %player% bob_the_king'
        show_name: false
        actions_after_dialogue: true
    random_dialogue: false
  conversation6:
    dialogue:
      dialogue1:
        text:
        - '{centered}&c&lBob &f:'
        - '{centered}&7再次感谢你的铁锭，祝你今天过得愉快'
        time: 2
        show_name: false
    random_dialogue: false

```
