物品条件
检查玩家身上的东西。这一页的 4 种类型在编辑器的「物品」分类里。item 的写法见 触发与目标 的「物品写法」。
例子
带着通行证、背包留 2 格空位才能接:
plugins/StarQuest/quests/示例/矿坑深处.yml
format: 1
id: 矿坑深处
name: '&7矿坑深处'
category: 示例
icon: IRON_PICKAXE
settings:
start: {command: true}
repeat: {mode: once}
requirements:
- {type: item, item: 'saved:矿坑通行证', amount: 1}
- {type: empty-slots, compare: '>=', value: 2}
rewards:
- {type: give, item: DIAMOND, amount: 2}
nodes:
开始:
type: start
x: 0
y: 100
next: [深处]
深处:
type: objective
x: 260
y: 100
track-text: 下到矿坑深处
goals:
- {type: break, material: [DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE], amount: 2}
next: [完成]
完成:
type: end
x: 520
y: 100
result: complete
saved:矿坑通行证 是先拿着那张纸输入 /sq item save 矿坑通行证 存下来的。没带时接任务会提示「需要 矿坑通行证 ×1」,背包太满时提示「背包空格需要至少 2」。
背包有物品 item
背包里(含副手)有足够数量。
item(物品):必填amount(数量)match(比对方式):id物品 ID(默认,推荐)、type只看材质、exact完全相同name-contains(名称包含):物品名字要包含这段文字lore-contains(说明包含):物品说明有一行包含这段文字
- {type: item, item: PAPER, amount: 1, name-contains: 通行证}
原版物品加了 name-contains 或 lore-contains 时,先只看材质,再看名字和说明。
手上拿着 hand
item(物品):必填amount(数量):手上那一组至少这么多offhand(副手):true= 看副手match(比对方式):同上
- {type: hand, item: 'ci:星辰法杖'}
穿着装备 armor
item(物品):必填slot(部位):any任意(默认)、head头盔、chest胸甲、legs护腿、feet靴子match(比对方式):同上
- {type: armor, item: TURTLE_HELMET, slot: head}
背包空格 empty-slots
主背包加快捷栏的空格数,不含盔甲栏和副手。
compare(比较):默认>=value(空格数):必填
- {type: empty-slots, compare: '>=', value: 3}
会踩的坑
条件只是检查,不会拿走东西。要扣掉物品,用动作「拿走物品」或目标「交付物品给 NPC」。
match: exact 连耐久、附魔都要一样,玩家用过的工具就对不上。插件物品一般用默认的 id 就好。
奖励会给好几样东西时,用「背包空格」挡一下,不然放不下的部分会寄到邮箱或掉在地上,见 背包满了。